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


Python MetaData.fromdict方法代码示例

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


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

示例1: test_meta_sorting_version_strip

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]
def test_meta_sorting_version_strip():
    m1 = MetaData.fromdict({'package':
                                {'name': 'a'},
                            'requirements':
                                {'build': ['b > 1.2']}})
    m2 = MetaData.fromdict({'package':
                                {'name': 'b'}})
    metas = sort_dependency_order([m1, m2])
    assert_equal([meta.name() for meta in metas], ['b', 'a'])
开发者ID:TomAugspurger,项目名称:Obvious-CI,代码行数:11,代码来源:test_build_directory__channels.py

示例2: testing_metadata

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]
def testing_metadata(request, testing_config):
    d = defaultdict(dict)
    d['package']['name'] = request.function.__name__
    d['package']['version'] = '1.0'
    d['build']['number'] = '1'
    d['build']['entry_points'] = []
    d['requirements']['build'] = ['python']
    d['requirements']['run'] = ['python']
    d['test']['commands'] = ['echo "A-OK"', 'exit 0']
    d['about']['home'] = "sweet home"
    d['about']['license'] = "contract in blood"
    d['about']['summary'] = "a test package"
    testing_config.variant = get_default_variants()[0]
    return MetaData.fromdict(d, config=testing_config)
开发者ID:jjhelmus,项目名称:conda-build,代码行数:16,代码来源:conftest.py

示例3: test_metadata

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]
def test_metadata(request, test_config):
    d = defaultdict(dict)
    d['package']['name'] = request.function.__name__
    d['package']['version'] = '1.0'
    d['build']['number'] = '1'
    d['build']['entry_points'] = []
    # MetaData does the auto stuff if the build string is None
    d['build']['string'] = None
    d['requirements']['build'] = ['python']
    d['requirements']['run'] = ['python']
    d['test']['commands'] = ['echo "A-OK"', 'exit 0']
    d['about']['home'] = "sweet home"
    d['about']['license'] = "contract in blood"
    d['about']['summary'] = "a test package"

    return MetaData.fromdict(d, config=test_config)
开发者ID:ESSS,项目名称:conda-build,代码行数:18,代码来源:utils.py

示例4: execute

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]
def execute(args, parser):
    d = defaultdict(dict)
    d['package']['name'] = args.name
    d['package']['version'] = args.version
    d['build']['number'] = args.build_number
    d['build']['entry_points'] = args.entry_points
    # MetaData does the auto stuff if the build string is None
    d['build']['string'] = args.build_string
    d['requirements']['run'] = args.dependencies
    d['about']['home'] = args.home
    d['about']['license'] = args.license
    d['about']['summary'] = args.summary
    m = MetaData.fromdict(d)

    build(m)
    handle_binstar_upload(bldpkg_path(m), args)
开发者ID:ezralanglois,项目名称:conda-build,代码行数:18,代码来源:main_metapackage.py

示例5: create_metapackage

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]
def create_metapackage(name, version, entry_points=(), build_string=None, build_number=0,
                       dependencies=(), home=None, license_name=None, summary=None, config=None):
    # local import to avoid circular import, we provid create_metapackage in api
    from conda_build.api import build

    if not config:
        config = Config()

    d = defaultdict(dict)
    d['package']['name'] = name
    d['package']['version'] = version
    d['build']['number'] = build_number
    d['build']['entry_points'] = entry_points
    # MetaData does the auto stuff if the build string is None
    d['build']['string'] = build_string
    d['requirements']['run'] = dependencies
    d['about']['home'] = home
    d['about']['license'] = license_name
    d['about']['summary'] = summary
    d = dict(d)
    m = MetaData.fromdict(d, config=config)
    config.compute_build_id(m.name())

    return build(m, config=config, need_source_download=False)
开发者ID:ESSS,项目名称:conda-build,代码行数:26,代码来源:metapackage.py

示例6: run

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]

#.........这里部分代码省略.........
            if hasattr(self.distribution, 'tests_require'):
                # A lot of packages use extras_require['test'], but
                # tests_require is the one that is officially supported by
                # setuptools.
                d['test']['requires'] = [spec_from_line(i) for i in
                    self.distribution.tests_require or []]

            d['about']['home'] = metadata.url
            # Don't worry about classifiers. This isn't skeleton pypi. We
            # don't need to make this work with random stuff in the wild. If
            # someone writes their setup.py wrong and this doesn't work, it's
            # their fault.
            d['about']['license'] = metadata.license
            d['about']['summary'] = metadata.description

            # This is similar logic from conda skeleton pypi
            entry_points = getattr(self.distribution, 'entry_points', [])
            if entry_points:
                if isinstance(entry_points, string_types):
                    # makes sure it is left-shifted
                    newstr = "\n".join(x.strip() for x in
                        entry_points.splitlines())
                    c = configparser.ConfigParser()
                    entry_points = {}
                    try:
                        c.readfp(StringIO(newstr))
                    except Exception as err:
                        # This seems to be the best error here
                        raise DistutilsGetoptError("ERROR: entry-points not understood: " +
                                                   str(err) + "\nThe string was" + newstr)
                    else:
                        for section in config.sections():
                            if section in ['console_scripts', 'gui_scripts']:
                                value = ['%s=%s' % (option, config.get(section, option))
                                         for option in config.options(section)]
                                entry_points[section] = value
                            else:
                                # Make sure setuptools is added as a dependency below
                                entry_points[section] = None

                if not isinstance(entry_points, dict):
                    raise DistutilsGetoptError("ERROR: Could not add entry points. They were:\n" +
                                               entry_points)
                else:
                    rs = entry_points.get('scripts', [])
                    cs = entry_points.get('console_scripts', [])
                    gs = entry_points.get('gui_scripts', [])
                    # We have *other* kinds of entry-points so we need
                    # setuptools at run-time
                    if not rs and not cs and not gs and len(entry_points) > 1:
                        d['requirements']['run'].append('setuptools')
                        d['requirements']['build'].append('setuptools')
                    entry_list = rs + cs + gs
                    if gs and conda.config.platform == 'osx':
                        d['build']['osx_is_app'] = True
                    if len(cs + gs) != 0:
                        d['build']['entry_points'] = entry_list
                        if metadata.conda_command_tests is True:
                            d['test']['commands'] = list(map(unicode,
                                                             pypi.make_entry_tests(entry_list)))

            if 'setuptools' in d['requirements']['run']:
                d['build']['preserve_egg_dir'] = True

            if metadata.conda_import_tests:
                if metadata.conda_import_tests is True:
                    d['test']['imports'] = ((self.distribution.packages or []) +
                                            (self.distribution.py_modules or []))
                else:
                    d['test']['imports'] = metadata.conda_import_tests

            if (metadata.conda_command_tests and not
                    isinstance(metadata.conda_command_tests,
                    bool)):
                d['test']['commands'] = list(map(unicode, metadata.conda_command_tests))

            d = dict(d)
            m = MetaData.fromdict(d)
            # Shouldn't fail, but do you really trust the code above?
            m.check_fields()
            build.build(m, post=False)
            # Do the install
            if not PY3:
                # Command is an old-style class in Python 2
                install.run(self)
            else:
                super().run()
            build.build(m, post=True)
            build.test(m)
            if self.binstar_upload:
                class args:
                    binstar_upload = self.binstar_upload
                handle_binstar_upload(render.bldpkg_path(m), args)
            else:
                no_upload_message = """\
# If you want to upload this package to anaconda.org later, type:
#
# $ anaconda upload %s
""" % render.bldpkg_path(m)
                print(no_upload_message)
开发者ID:e-gillies-ix,项目名称:conda-build,代码行数:104,代码来源:bdist_conda.py

示例7: get_noarch_python_meta

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]
def get_noarch_python_meta(meta):
    d = meta.meta
    d['build']['noarch'] = "python"
    return MetaData.fromdict(d, config=meta.config)
开发者ID:conda,项目名称:conda-build,代码行数:6,代码来源:utils.py

示例8: setUp

# 需要导入模块: from conda_build.metadata import MetaData [as 别名]
# 或者: from conda_build.metadata.MetaData import fromdict [as 别名]
 def setUp(self):
     self.meta = MetaData.fromdict({'package': {'name': 'test_pkg'},
                                    'requirements': {'build': []}})
开发者ID:scopatz,项目名称:conda-smithy,代码行数:5,代码来源:test_configure_feedstock.py


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