当前位置: 首页>>代码示例>>Python>>正文


Python CookBook.get_recipes_list方法代码示例

本文整理汇总了Python中cerbero.build.cookbook.CookBook.get_recipes_list方法的典型用法代码示例。如果您正苦于以下问题:Python CookBook.get_recipes_list方法的具体用法?Python CookBook.get_recipes_list怎么用?Python CookBook.get_recipes_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cerbero.build.cookbook.CookBook的用法示例。


在下文中一共展示了CookBook.get_recipes_list方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipes_list [as 别名]
 def run(self, config, args):
     cookbook = CookBook(config)
     recipes = cookbook.get_recipes_list()
     if len(recipes) == 0:
         m.message(_("No recipes found"))
     for recipe in recipes:
         m.message("%s - %s" % (recipe.name, recipe.version))
开发者ID:jpakkane,项目名称:cerbero,代码行数:9,代码来源:list.py

示例2: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipes_list [as 别名]
    def run(self, config, args):
        cookbook = CookBook(config)
        if args.recipe == 'all':
            recipes = cookbook.get_recipes_list()
        else:
            recipes = [cookbook.get_recipe(args.recipe)]
        if len(recipes) == 0:
            m.message(_("No recipes found"))
        tagname = args.tagname
        tagdescription = args.tagdescription
        force = args.force
        for recipe in recipes:
            if recipe.stype != SourceType.GIT and \
               recipe.stype != SourceType.GIT_TARBALL:
                m.message(_("Recipe '%s' has a custom source repository, "
                        "skipping") % recipe.name)
                continue

            recipe.fetch(checkout=False)

            tags = git.list_tags(recipe.repo_dir)
            exists = (tagname in tags)
            if exists:
                if not force:
                    m.warning(_("Recipe '%s' tag '%s' already exists, "
                            "not updating" % (recipe.name, tagname)))
                    continue
                git.delete_tag(recipe.repo_dir, tagname)

            commit = 'origin/sdk-%s' % recipe.version
            git.create_tag(recipe.repo_dir, tagname, tagdescription,
                    commit)
开发者ID:deepak6,项目名称:cerbero,代码行数:34,代码来源:tag.py

示例3: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipes_list [as 别名]
    def run(self, config, args):
        cookbook = CookBook(config)
        recipes = cookbook.get_recipes_list()
        if len(recipes) == 0:
            m.message(_("No recipes found"))
        for recipe in recipes:
            try:
                current = recipe.built_version().split("\n")[0]
            except:
                current = "Not checked out"

            m.message("%s - %s (current checkout: %s)" % (recipe.name, recipe.version, current))
开发者ID:GStreamer,项目名称:cerbero,代码行数:14,代码来源:list.py

示例4: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipes_list [as 别名]
    def run(self, config, args):
        if config.target_platform != Platform.WINDOWS:
            raise UsageError(_('%s command can only be used targetting '
                             'Windows platforms') % self.name)

        if args.output_dir is not None and not os.path.exists(args.output_dir):
            os.makedirs(args.output_dir)

        cookbook = CookBook(config)
        recipes = cookbook.get_recipes_list()
        for recipe in recipes:
            try:
                recipe.gen_library_file(args.output_dir)
            except Exception, e:
                m.message(_("Error generaring library files for %s:\n %s") %
                          (recipe.name, e))
开发者ID:AlertMe,项目名称:cerbero,代码行数:18,代码来源:genlibfiles.py

示例5: PackageTest

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipes_list [as 别名]
class PackageTest(unittest.TestCase):

    def setUp(self):
        self.config = Config()
        self.config.cache_file = '/dev/null'
        self.cookbook = CookBook(self.config, False)

    def testSetGetConfig(self):
        self.assertEquals(self.config, self.cookbook.get_config())
        self.cookbook.set_config(None)
        self.assertIsNone(self.cookbook._config)

    def testCacheMissing(self):
        status = {'test': 'test'}
        self.cookbook.set_status(status)
        self.cookbook._restore_cache()
        self.assertEquals(self.cookbook.status, {})

    def testSaveCache(self):
        tmp = tempfile.NamedTemporaryFile()
        status = {'test': 'test'}
        self.cookbook.set_status(status)
        self.cookbook.get_config().cache_file = tmp.name
        self.cookbook.save()
        with open(self.cookbook._cache_file(self.config), 'rb') as f:
            loaded_status = pickle.load(f)
            self.assertEquals(status, loaded_status)

    def testLoad(self):
        tmp = tempfile.NamedTemporaryFile()
        status = {'test': 'test'}
        self.cookbook.get_config().cache_file = tmp.name
        with open(tmp.name, 'wb') as f:
            pickle.dump(status, f)
        self.cookbook._restore_cache()
        self.assertEquals(status, self.cookbook.status)

    def testAddGetRecipe(self):
        recipe = Recipe1(self.config)
        self.failUnlessRaises(RecipeNotFoundError, self.cookbook.get_recipe,
                              recipe.name)
        self.cookbook.add_recipe(recipe)
        self.assertEquals(recipe, self.cookbook.recipes[recipe.name])
        self.assertEquals(recipe, self.cookbook.get_recipe(recipe.name))
        self.assertEquals(self.cookbook.get_recipes_list(), [recipe])

    def testGetRecipesStatus(self):
        recipe = Recipe1(self.config)
        self.cookbook._restore_cache()
        self.assertEquals(self.cookbook.status, {})
        self.cookbook.add_recipe(recipe)
        self.assertEquals(len(self.cookbook.status), 0)
        status = self.cookbook._recipe_status(recipe.name)
        self.assertEquals(len(self.cookbook.status), 1)
        self.assertEquals(status.steps, [])
        status.steps.append('1')
        status = self.cookbook._recipe_status(recipe.name)
        self.assertEquals(len(self.cookbook.status), 1)
        self.assertEquals(status.steps[0], '1')

    def testUpdateStatus(self):
        recipe = Recipe1(self.config)
        self.cookbook.add_recipe(recipe)
        self.cookbook._restore_cache()
        self.cookbook.update_step_status(recipe.name, 'fetch')
        status = self.cookbook._recipe_status(recipe.name)
        self.assertEquals(status.steps, ['fetch'])
        self.cookbook.update_step_status(recipe.name, 'build')
        status = self.cookbook._recipe_status(recipe.name)
        self.assertEquals(status.steps, ['fetch', 'build'])
        self.cookbook.update_step_status(recipe.name, 'install')
        status = self.cookbook._recipe_status(recipe.name)
        self.assertEquals(status.steps, ['fetch', 'build', 'install'])
        for step in ['fetch', 'build', 'install']:
            self.assertTrue(self.cookbook.step_done(recipe.name, step))

    def testBuildStatus(self):
        recipe = Recipe1(self.config)
        self.cookbook.add_recipe(recipe)
        self.cookbook._restore_cache()
        self.cookbook.update_build_status(recipe.name, True)
        self.assertTrue(self.cookbook.status[recipe.name].needs_build)
        self.cookbook.update_build_status(recipe.name, False)
        self.assertFalse(self.cookbook.status[recipe.name].needs_build)

    def testResetRecipeStatus(self):
        recipe = Recipe1(self.config)
        self.cookbook.add_recipe(recipe)
        self.cookbook._restore_cache()
        self.cookbook.reset_recipe_status(recipe.name)
        status = self.cookbook._recipe_status(recipe.name)
        self.assertEquals(status.steps, [])
        self.assertTrue(self.cookbook.status[recipe.name].needs_build)
开发者ID:UIKit0,项目名称:ore-infinium,代码行数:95,代码来源:test_cerbero_build_cookbook.py

示例6: PackagesStore

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipes_list [as 别名]

#.........这里部分代码省略.........
        def get_package_deps(package_name, visited=[], depslist=[]):
            if package_name in visited:
                return
            visited.append(package_name)
            p = self.get_package(package_name)
            depslist.append(p)
            for p_name in p.deps:
                get_package_deps(p_name, visited, depslist)
            return depslist

        deps = []
        for p in metapackage.list_packages():
            deps.extend(get_package_deps(p, [], []))
        return remove_list_duplicates(deps)

    def _list_metapackage_files(self, metapackage):
        l = []
        for p in self._list_metapackage_deps(metapackage):
            l.extend(p.files_list())
        # remove duplicates and sort
        return sorted(list(set(l)))

    def _load_packages(self):
        self._packages = {}
        packages = defaultdict(dict)
        repos = self._config.get_packages_repos()
        for reponame, (repodir, priority) in repos.iteritems():
            packages[int(priority)].update(
                    self._load_packages_from_dir(repodir))
        # Add packages by ascending pripority
        for key in sorted(packages.keys()):
            self._packages.update(packages[key])
        # Add a package for every recipe
        for recipe in self.cookbook.get_recipes_list():
            if not recipe.allow_package_creation:
                continue
            p = self._package_from_recipe(recipe)
            if p.name in self._packages.keys():
                m.warning("Package with name '%s' already exists, not including it", p.name)
            else:
                self._packages[p.name] = p

    def _package_from_recipe(self, recipe):
        p = package.Package(self._config, self, self.cookbook)
        p.name = '%s-pkg' % recipe.name
        p.license = recipe.licenses
        if recipe.built_version():
            version = recipe.built_version()
        else:
            version = recipe.version
        p.version = '%s-%s' % (version, self.cookbook.recipe_file_hash(recipe.name))
        p.files = ['%s' % recipe.name]
        p.load_files()
        return p

    def _load_packages_from_dir(self, repo):
        packages_dict = {}
        packages = shell.find_files('*%s' % self.PKG_EXT, repo)
        packages.extend(shell.find_files('*/*%s' % self.PKG_EXT, repo))
        for f in packages:
            p = self._load_package_from_file(f)
            if p is None:
                m.warning(_("Could not found a valid package in %s") % f)
                continue
            packages_dict[p.name] = p
        return packages_dict
开发者ID:fluendo,项目名称:cerbero,代码行数:70,代码来源:packagesstore.py


注:本文中的cerbero.build.cookbook.CookBook.get_recipes_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。