def __init__(self, path): """ Create settings object with the stored settings from the given path. """ # Load the settings data if the file exists if os.path.exists(path): settings_data = util.yaml_load(open(path)) else: settings_data = None # Lookup data based on the presence of the configuration data if settings_data is None: toolset_dict = None self.name = 'none' else: toolset_dict = settings_data.get('toolset', None) self.name = settings_data.get('name', 'unknown') # Create toolset if possible otherwise get the default if toolset_dict is None: self.toolset = build.Toolset.lookup_by_name(build.DefaultToolsetName) else: self.toolset = build.Toolset.create_from_dict(toolset_dict)
def __init__(self, path): """ Create settings object with the stored settings from the given path. """ # Load the settings data if the file exists if os.path.exists(path): settings_data = util.yaml_load(open(path)) else: settings_data = None # Lookup data based on the presence of the configuration data if settings_data is None: toolset_dict = None self.name = 'none' else: toolset_dict = settings_data.get('toolset', None) self.name = settings_data.get('name', 'unknown') # Create toolset if possible otherwise get the default if toolset_dict is None: self.toolset = build.Toolset.lookup_by_name( build.DefaultToolsetName) else: self.toolset = build.Toolset.create_from_dict(toolset_dict)
def _read_info(self, xpa_path): """ Read the manifest data out of the xpa_path. """ with tarfile.open(xpa_path) as tar: # Pull out and parse the metadata return util.yaml_load(tar.extractfile('xpkg.yml'))
def _load_db(self): """ Load DB from disk. """ self._db = util.yaml_load(open(self._db_path)) # Handle the empty database case if self._db is None: self._db = {} # Build a list of directories and the counts of package that reference # them self._gen_dir_counts()