Release 12.0.0.18257
[platform/core/csapi/tizenfx.git] / packaging / maketfm.py
old mode 100644 (file)
new mode 100755 (executable)
index 3641785..8364ed1
@@ -1,25 +1,41 @@
-import os
+import os, re
 import xml.etree.ElementTree as ET
 
 scrpit_dir = os.path.dirname(os.path.abspath(__file__))
 spec_dir = os.path.join(scrpit_dir, "csapi-tizenfx.spec")
-tree = ET.parse("../pkg/Tizen.NET/Tizen.NET.nuspec")
+nuspec_file = os.path.join(scrpit_dir, "../pkg/Tizen.NET/Tizen.NET.nuspec")
+tree = ET.parse(nuspec_file)
 root = tree.getroot()
 
-tfm_list = []
+tfm_list1 = [] #tizen90, tizen80, tizen70, tizen60, tizen50, tizen40
+tfm_list2 = [] #tizen10.0
+tfm_list3 = [] #net6.0-tizen9.0, net6.0-tizen8.0, net6.0-tizen, net6.0
 for meta_child in root.iter():
     if meta_child.tag == "{http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd}metadata":
         for depen_child in meta_child:
             if depen_child.tag == "{http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd}dependencies":
                 for group in depen_child:
                     tfm = group.attrib["targetFramework"].lower()
-                    tfm = tfm.replace(".", "")
-                    tfm = tfm.replace("20", "2.0")
-                    if tfm.strip():
-                        tfm_list.append(tfm)
+                    if tfm.startswith("tizen"):
+                        if len(tfm) == 8:
+                            tfm_list1.append(tfm.replace(".", "").strip())
+                        else:
+                            tfm_list2.append(tfm.strip())
+                    elif tfm.startswith("net"):
+                        if len(tfm) < 8:
+                            tfm_list3.append(tfm.strip() + "-tizen")
+                        tfm_list3.append(tfm.strip())
 
-tfm_list = list(set(tfm_list))
-tfm_list.sort(reverse=True)
+
+tfm_list1 = list(set(tfm_list1))
+tfm_list1.sort(reverse=True)
+tfm_list2 = list(set(tfm_list2))
+tfm_list2.sort(reverse=True)
+tfm_list3 = list(set(tfm_list3))
+tfm_list3.sort(key=len)
+tfm_list3.sort(key=lambda s: float(re.search(r'(\d+)\.', s).group()[0]))
+tfm_list3.reverse()
+tfm_list = tfm_list3 + tfm_list2 + tfm_list1
 
 f = open(spec_dir,'r')
 origin_data = f.read()