コード例 #1
0
ファイル: core.py プロジェクト: jlisee/xpkg
    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)
コード例 #2
0
    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)
コード例 #3
0
ファイル: core.py プロジェクト: jlisee/xpkg
    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'))
コード例 #4
0
    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'))
コード例 #5
0
ファイル: core.py プロジェクト: jlisee/xpkg
    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()
コード例 #6
0
    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()