コード例 #1
0
ファイル: lifecycle.py プロジェクト: untriangle/snapcraft
def execute(step, part_names=None):
    """Exectute until step in the lifecycle.

    Lifecycle execution will happen for each step iterating over all
    the available parts, if part_names is specified, only those parts
    will run.

    If one of the parts to execute has an after keyword, execution is
    forced until the stage step for such part. If part_names was provided
    and after is not in this set, an exception will be raised.

    :param str step: A valid step in the lifecycle: pull, build, strip or snap.
    :raises RuntimeError: If a prerequesite of the part needs to be staged
                          and such part is not in the list of parts to iterate
                          over.
    :returns: A dict with the snap name, version and architectures.
    """
    config = snapcraft.yaml.load_config()
    repo.install_build_packages(config.build_tools)

    _Executor(config).run(step, part_names)

    return {
        'name': config.data['name'],
        'version': config.data['version'],
        'arch': config.data['architectures']
    }
コード例 #2
0
    def install_test_packages(self, test_pkgs, mock_apt, mock_env):
        mock_env.copy.return_value = {}
        mock_apt_cache = mock_apt.Cache.return_value
        mock_apt_cache_with = mock_apt_cache.__enter__.return_value
        mock_apt_cache_with.__getitem__.side_effect = lambda p: test_pkgs[p]

        repo.install_build_packages(test_pkgs.keys())
コード例 #3
0
ファイル: lifecycle.py プロジェクト: dplanella/snapcraft
def execute(step, part_names=None):
    """Exectute until step in the lifecycle.

    Lifecycle execution will happen for each step iterating over all
    the available parts, if part_names is specified, only those parts
    will run.

    If one of the parts to execute has an after keyword, execution is
    forced until the stage step for such part. If part_names was provided
    and after is not in this set, an exception will be raised.

    :param str step: A valid step in the lifecycle: pull, build, strip or snap.
    :raises RuntimeError: If a prerequesite of the part needs to be staged
                          and such part is not in the list of parts to iterate
                          over.
    :returns: A dict with the snap name, version and architectures.
    """
    config = snapcraft.yaml.load_config()
    repo.install_build_packages(config.build_tools)

    _Executor(config).run(step, part_names)

    return {'name': config.data['name'],
            'version': config.data['version'],
            'arch': config.data['architectures'],
            'type': config.data.get('type', '')}
コード例 #4
0
ファイル: test_repo.py プロジェクト: squidsoup/snapcraft
    def install_test_packages(self, test_pkgs, mock_apt, mock_env):
        mock_env.copy.return_value = {}
        mock_apt_cache = mock_apt.Cache.return_value
        mock_apt_cache_with = mock_apt_cache.__enter__.return_value
        mock_apt_cache_with.__getitem__.side_effect = lambda p: test_pkgs[p]

        repo.install_build_packages(test_pkgs.keys())
コード例 #5
0
ファイル: test_repo.py プロジェクト: techraf/snapcraft
    def test_invalid_package_requested(self):
        with self.assertRaises(EnvironmentError) as raised:
            repo.install_build_packages(['package-does-not-exist'])

        self.assertEqual(
            "Could not find a required package in 'build-packages': "
            '"The cache has no package named \'package-does-not-exist\'"',
            str(raised.exception))
コード例 #6
0
ファイル: test_repo.py プロジェクト: 0-T-0/snapcraft
    def test_invalid_package_requested(self):
        with self.assertRaises(EnvironmentError) as raised:
            repo.install_build_packages(['package-does-not-exist'])

        self.assertEqual(
            "Could not find a required package in 'build-packages': "
            '"The cache has no package named \'package-does-not-exist\'"',
            str(raised.exception))