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


Python cookbook.CookBook类代码示例

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


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

示例1: run

    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,代码行数:29,代码来源:checkpackage.py

示例2: list_gstreamer_plugins_by_category

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,代码行数:27,代码来源:custom.py

示例3: run

    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,代码行数:32,代码来源:tag.py

示例4: run

 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,代码行数:7,代码来源:list.py

示例5: run

    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,代码行数:32,代码来源:check.py

示例6: run

    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,代码行数:31,代码来源:deps.py

示例7: list_gstreamer_1_0_plugins_by_category

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,代码行数:33,代码来源:custom.py

示例8: create_cookbook

def create_cookbook(config):
    cb = CookBook(config, False)

    for klass in [Recipe1, Recipe2, Recipe3, Recipe4, Recipe5]:
        r = klass(config)
        r.__file__ = "test/test_build_common.py"
        cb.add_recipe(r)
    return cb
开发者ID:RoyinRolland,项目名称:cerbero,代码行数:8,代码来源:test_build_common.py

示例9: run

    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,代码行数:12,代码来源:list.py

示例10: run

    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,代码行数:52,代码来源:add_recipe.py

示例11: run

    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,代码行数:16,代码来源:genlibfiles.py

示例12: run

    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,代码行数:19,代码来源:cleanone.py

示例13: run

    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,代码行数:19,代码来源:deps.py

示例14: __init__

    def __init__(self, config, load=True):
        self._config = config

        self._packages = {}  # package_name -> package

        self.cookbook = CookBook(config, load)
        # used in tests to skip loading a dir with packages definitions
        if not load:
            return

        if not os.path.exists(config.packages_dir):
            raise FatalError(_("Packages dir %s not found") %
                             config.packages_dir)
        self._load_packages()
开发者ID:fluendo,项目名称:cerbero,代码行数:14,代码来源:packagesstore.py

示例15: list_gstreamer_1_0_plugins_by_category

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,代码行数:37,代码来源:custom.py


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