sysroot: add a set of base system files
This commit is contained in:
@@ -58,19 +58,21 @@ class Component:
|
||||
class Manifest:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
self.base = None
|
||||
self.components = {}
|
||||
|
||||
def load(self):
|
||||
with open(self.path, 'r') as f:
|
||||
self.data = json.load(f)
|
||||
|
||||
if 'components' not in self.data:
|
||||
return 0
|
||||
if 'components' in self.data:
|
||||
for n, t in self.data['components'].items():
|
||||
component = Component()
|
||||
component.deserialise(t)
|
||||
self.components[n] = component
|
||||
|
||||
for n, t in self.data['components'].items():
|
||||
component = Component()
|
||||
component.deserialise(t)
|
||||
self.components[n] = component
|
||||
if 'base' in self.data:
|
||||
self.base = self.data['base']
|
||||
|
||||
|
||||
def save(self):
|
||||
@@ -81,6 +83,9 @@ class Manifest:
|
||||
|
||||
self.data['components'] = component_data
|
||||
|
||||
if self.base is not None:
|
||||
self.data['base'] = self.base
|
||||
|
||||
with open(self.path, 'w') as f:
|
||||
json.dump(self.data, f, indent=4)
|
||||
|
||||
@@ -97,5 +102,14 @@ class Manifest:
|
||||
self.components[name] = component
|
||||
return component
|
||||
|
||||
|
||||
def set_base(self, path):
|
||||
self.base = path
|
||||
|
||||
|
||||
def get_base(self):
|
||||
return self.base
|
||||
|
||||
|
||||
def get_all_components(self):
|
||||
return self.components
|
||||
|
||||
Reference in New Issue
Block a user