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


Python CookBook.get_recipe方法代码示例

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


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

示例1: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
    def run(self, config, args):
        cookbook = CookBook(config)
        recipe_name = args.recipe[0]
        all_deps = args.all
        graph = args.graph

        if all_deps:
            recipes = cookbook.list_recipe_deps(recipe_name)
        else:
            recipes = [cookbook.get_recipe(x) for x in
                        cookbook.get_recipe(recipe_name).list_deps()]

        if len(recipes) == 0:
            m.message(_('%s has 0 dependencies') % recipe_name)
            return
        if not graph:
            for recipe in recipes:
                # Don't print the recipe we asked for
                if recipe.name == recipe_name:
                    continue
                m.message(recipe.name)
        else:
            def print_dep(cookbook, recipe, level=0, already_shown=[]):
                m.message("%s%s" %( " " * 3 * level, recipe.name))
                already_shown.append(recipe)
                for r in [cookbook.get_recipe(x) for x in recipe.list_deps()]:
                    if not r in already_shown:
                        print_dep(cookbook, r, level + 1, already_shown)
                    elif not r.name == recipe.name:
                        m.message("%s(%s)" % ( " " * 3 * (level + 1), r.name))
            print_dep(cookbook, cookbook.get_recipe(recipe_name))
开发者ID:AlertMe,项目名称:cerbero,代码行数:33,代码来源:deps.py

示例2: list_gstreamer_plugins_by_category

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
def list_gstreamer_plugins_by_category(config):
        cookbook = CookBook(config)
        # For plugins named differently
        replacements = {'decodebin2': 'uridecodebin', 'playbin': 'playback',
                        'encodebin': 'encoding', 'souphttpsrc': 'soup',
                        'siren': 'gstsiren', 'sdpelem': 'sdp',
                        'rtpmanager': 'gstrtpmanager', 'scaletempoplugin' : 'scaletempo',
                        'mpegdemux': 'mpegdemux2', 'rmdemux': 'realmedia'}
        plugins = defaultdict(list)
        for r in ['gstreamer', 'gst-plugins-base', 'gst-plugins-good',
                  'gst-plugins-bad', 'gst-plugins-ugly', 'gst-ffmpeg', 'gst-rtsp-server']:
            r = cookbook.get_recipe(r)
            for attr_name in dir(r):
                if attr_name.startswith('files_plugins_'):
                    cat_name = attr_name[len('files_plugins_'):]
                    plugins_list = getattr(r, attr_name)
                elif attr_name.startswith('platform_files_plugins_'):
                    cat_name = attr_name[len('platform_files_plugins_'):]
                    plugins_dict = getattr(r, attr_name)
                    plugins_list = plugins_dict.get(config.target_platform, [])
                else:
                    continue
                for e in plugins_list:
                    if not e.startswith('lib/gstreamer-'):
                        continue
                    plugins[cat_name].append(e[25:-8])
        return plugins, replacements
开发者ID:KeTao,项目名称:cerbero,代码行数:29,代码来源:custom.py

示例3: list_gstreamer_1_0_plugins_by_category

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
def list_gstreamer_1_0_plugins_by_category(config):
        cookbook = CookBook(config)
        plugins = defaultdict(list)
        for r in ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0',
                  'gst-plugins-bad-1.0', 'gst-plugins-ugly-1.0',
                  'gst-libav-1.0', 'gst-editing-services-1.0', 'gst-rtsp-server-1.0']:
            r = cookbook.get_recipe(r)
            for attr_name in dir(r):
                if attr_name.startswith('files_plugins_'):
                    cat_name = attr_name[len('files_plugins_'):]
                    plugins_list = getattr(r, attr_name)
                elif attr_name.startswith('platform_files_plugins_'):
                    cat_name = attr_name[len('platform_files_plugins_'):]
                    plugins_dict = getattr(r, attr_name)
                    plugins_list = plugins_dict.get(config.target_platform, [])
                else:
                    continue
                for e in plugins_list:
                    if not e.startswith('lib/gstreamer-'):
                        continue
                    c = e.split('/')
                    if len(c) != 3:
                        continue
                    e = c[2]
                    # we only care about files with the replaceable %(mext)s extension
                    if not e.endswith ('%(mext)s'):
                        continue
                    if e.startswith('libgst'):
                        e = e[6:-8]
                    else:
                        e = e[3:-8]
                    plugins[cat_name].append(e)
        return plugins
开发者ID:centricular,项目名称:cerbero,代码行数:35,代码来源:custom.py

示例4: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
    def run(self, config, args):
        cookbook = CookBook(config)
        failed = []
        p_name = args.package[0]

        store = PackagesStore(config)
        p = store.get_package(p_name)
        ordered_recipes = map(lambda x: cookbook.get_recipe(x),
                    p.recipes_dependencies())

        for recipe in ordered_recipes:
            if cookbook.recipe_needs_build(recipe.name):
                raise CommandError(_("Recipe %s is not built yet" % recipe.name))

        for recipe in ordered_recipes:
            # call step function
            stepfunc = None
            try:
                stepfunc = getattr(recipe, 'check')
            except:
                m.message('%s has no check step, skipped' % recipe.name)

            if stepfunc:
                try:
                    m.message('Running checks for recipe %s' % recipe.name)
                    stepfunc()
                except Exception, ex:
                    failed.append(recipe.name)
                    m.warning(_("%s checks failed: %s") % (recipe.name, ex))
开发者ID:SniperPan,项目名称:CerberoAnalyze,代码行数:31,代码来源:checkpackage.py

示例5: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
    def run(self, config, args):
        cookbook = CookBook(config)
        recipe_name = args.recipe[0]
        recursive = args.recursive

        recipe = cookbook.get_recipe(recipe_name)

        if recursive:
            ordered_recipes = cookbook.list_recipe_deps(recipe_name)
        else:
            ordered_recipes = [recipe]

        for recipe in ordered_recipes:
            if cookbook.recipe_needs_build(recipe.name):
                raise FatalError(_("Recipe %s is not built yet" % recipe.name))

        for recipe in ordered_recipes:
            # call step function
            stepfunc = None
            try:
                stepfunc = getattr(recipe, 'check')
            except:
                m.message('%s has no check step, skipped' % recipe.name)

            if stepfunc:
                try:
                    stepfunc()
                except FatalError as e:
                    raise e
                except Exception as ex:
                    raise FatalError(_("Error running %s checks: %s") %
                        (recipe.name, ex))
开发者ID:centricular,项目名称:cerbero,代码行数:34,代码来源:check.py

示例6: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [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

示例7: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
    def run(self, config, args):
        cookbook = CookBook(config)
        recipe_name = args.recipe[0]
        all_deps = args.all

        if all_deps:
            recipes = cookbook.list_recipe_deps(recipe_name)
        else:
            recipes = [cookbook.get_recipe(x) for x in
                        cookbook.get_recipe(recipe_name).list_deps()]

        if len(recipes) == 0:
            m.message(_('%s has 0 dependencies') % recipe_name)
            return
        for recipe in recipes:
            # Don't print the recipe we asked for
            if recipe.name == recipe_name:
                continue
            m.message(recipe.name)
开发者ID:BigBrother-International,项目名称:gst-cerbero,代码行数:21,代码来源:deps.py

示例8: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
    def run(self, config, args):
        name = args.name[0]
        version = args.version[0]
        filename = os.path.join(config.recipes_dir, '%s.recipe' % name)
        if not args.force and os.path.exists(filename):
            m.warning(_("Recipe '%s' (%s) already exists, "
                "use -f to replace" % (name, filename)))
            return

        template_args = {}

        template = RECEIPT_TPL
        template_args['name'] = name
        template_args['version'] = version

        if args.licenses:
            licenses = args.licenses.split(',')
            self.validate_licenses(licenses)
            template += LICENSES_TPL
            template_args['licenses'] = ', '.join(
                    ['License.' + self.supported_licenses[l] \
                        for l in licenses])

        if args.commit:
            template += COMMIT_TPL
            template_args['commit'] = args.commit

        if args.origin:
            template += ORIGIN_TPL
            template_args['origin'] = args.origin

        if args.deps:
            template += DEPS_TPL
            deps = args.deps.split(',')
            cookbook = CookBook(config)
            for dname in deps:
                try:
                    recipe = cookbook.get_recipe(dname)
                except RecipeNotFoundError as ex:
                    raise UsageError(_("Error creating recipe: "
                            "dependant recipe %s does not exist") % dname)
            template_args['deps'] = deps

        try:
            f = open(filename, 'w')
            f.write(template % template_args)
            f.close()

            m.action(_("Recipe '%s' successfully created in %s") %
                    (name, filename))
        except IOError as ex:
            raise FatalError(_("Error creating recipe: %s") % ex)
开发者ID:centricular,项目名称:cerbero,代码行数:54,代码来源:add_recipe.py

示例9: run

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
    def run(self, config, args):
        cookbook = CookBook(config)
        recipe_name = args.recipe[0]

        recipe = cookbook.get_recipe(recipe_name)
        # call step function
        stepfunc = None
        try:
            stepfunc = getattr(recipe, "clean")
        except:
            print "%s has no clean step, skipped" % recipe.name

        if stepfunc:
            try:
                stepfunc()
            except FatalError, e:
                raise e
            except Exception, ex:
                raise FatalError(_("Error running %s checks: %s") % (recipe.name, ex))
开发者ID:RoyinRolland,项目名称:cerbero,代码行数:21,代码来源:cleanone.py

示例10: list_gstreamer_1_0_plugins_by_category

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [as 别名]
def list_gstreamer_1_0_plugins_by_category(config):
        cookbook = CookBook(config)
        # For plugins named differently
        replacements = {'decodebin': 'playback', 'playbin': 'playback',
                        'uridecodebin': 'playback', 'sdpelem': 'sdp',
                        'encodebin': 'encoding', 'souphttpsrc': 'soup',
                        'siren': 'gstsiren', 'scaletempoplugin' : 'scaletempo',
                        'rmdemux': 'realmedia', 'camerabin2': 'camerabin'}
        plugins = defaultdict(list)
        for r in ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0',
                  'gst-plugins-bad-1.0', 'gst-plugins-ugly-1.0',
                  'gst-libav-1.0', 'gst-editing-services-1.0', 'gst-rtsp-server-1.0',
                  'gst-omx', 'gst-rpicamsrc']:
            r = cookbook.get_recipe(r)
            for attr_name in dir(r):
                if attr_name.startswith('files_plugins_'):
                    cat_name = attr_name[len('files_plugins_'):]
                    plugins_list = getattr(r, attr_name)
                elif attr_name.startswith('platform_files_plugins_'):
                    cat_name = attr_name[len('platform_files_plugins_'):]
                    plugins_dict = getattr(r, attr_name)
                    plugins_list = plugins_dict.get(config.target_platform, [])
                else:
                    continue
                for e in plugins_list:
                    if not e.startswith('lib/gstreamer-'):
                        continue
                    c = e.split('/')
                    if len(c) != 3:
                        continue
                    e = c[2]
                    if e.startswith('libgst'):
                        e = e[6:-8]
                    else:
                        e = e[3:-8]
                    plugins[cat_name].append(e)
        return plugins, replacements
开发者ID:zdydek,项目名称:cerbero,代码行数:39,代码来源:custom.py

示例11: PackageTest

# 需要导入模块: from cerbero.build.cookbook import CookBook [as 别名]
# 或者: from cerbero.build.cookbook.CookBook import get_recipe [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


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