Release 8.0.0.15407
[platform/core/csapi/tizenfx.git] / packaging / makerid.py
1 #!/usr/bin/python3
2
3 import json
4 import os
5
6 scrpit_dir = os.path.dirname(os.path.abspath(__file__))
7 runtime_dir = os.path.join(scrpit_dir, "../pkg/Tizen.NET/runtime.json")
8 spec_dir = os.path.join(scrpit_dir, "csapi-tizenfx.spec")
9
10 with open(runtime_dir) as json_file:
11     json_data = json.load(json_file)
12     json_string = json_data["runtimes"]
13
14     key_list = json_string.keys()
15     rid_list = []
16
17     for key in key_list:
18         key = key.replace("-armel", "")
19         key = key.replace("-arm64", "")
20         key = key.replace("-x86", "")
21         key = key.replace("-x64", "")
22         key = key.replace("tizen.", "")
23         key = key.replace("tizen", "")
24         if key.strip():
25             rid_list.append(key)
26
27     rid_list = list(set(rid_list))
28     rid_list.sort()
29
30     f = open(spec_dir,'r')
31     origin_data = f.read()
32     f.close()
33
34     new_data = origin_data.replace("@rid_version@", ':'.join(rid_list))
35
36     f = open(spec_dir, 'w')
37     f.write(new_data)
38     f.close()