-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manifest.py
76 lines (68 loc) · 2.05 KB
/
Manifest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import toml
from collections import OrderedDict
DEFINES ="Defines"
REPOSITORY = "Repo"
RESERVE_KEY = (DEFINES,REPOSITORY,"Test")
class Manifest():
def __init__(self, manifest_file):
self.manifest_file = manifest_file
self.repos = {}
self.build_cate = {}
self.defines = OrderedDict()
@property
def RepoConf(self):
if not self.repos:
try:
self.ReadConf()
except:
self.repos = {}
return self.repos
@property
def BuildCate(self):
if not self.build_cate:
try:
self.ReadConf()
except:
self.build_cate = {}
return self.build_cate
@property
def Defines(self):
if not self.defines:
try:
self.ReadConf()
except:
self.defines = {}
return self.defines
@property
def TestType(self):
if not self.test:
try:
self.ReadConf()
except:
self.test = {}
return self.test
def ReadConf(self):
proj_conf = toml.load(self.manifest_file)
#print(proj_conf)
self.repos = proj_conf.get("Repo",{})
self.defines = proj_conf.get('Defines',{})
self.test = proj_conf.get('Test',{})
for key in proj_conf:
if key not in RESERVE_KEY:
self.build_cate[key] = proj_conf[key]
if __name__ == "__main__":
target_platform = r'D:\pytest1\step\Ovmf.toml'
manifest = Manifest(target_platform)
for e in manifest.RepoConf:
print(e)
print(manifest.TestType)
print(manifest.Defines)
workspace = manifest.Defines.get("workspace",".")
repo_mgr = RepoMgr(workspace, repo_conf)
print(manifest.TestType['IncrementBuild']['FileNeedCompare'])
#print(manifest.RepoConf)
#print(manifest.Defines)
#print(manifest.BuildCate)
#print(manifest.BuildCate.get("Basic"))
#for step in manifest.BuildCate.get("Basic").get('step'):
# print(step)