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


Python pkg_resources.evaluate_marker方法代码示例

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


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

示例1: test_ordering

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import evaluate_marker [as 别名]
def test_ordering(python_version_mock):
    assert evaluate_marker("python_full_version > '2.7.3'") is True 
开发者ID:pypa,项目名称:pkg_resources,代码行数:4,代码来源:test_markers.py

示例2: marker_passes

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import evaluate_marker [as 别名]
def marker_passes(marker):
        """
        Given an environment marker, return True if the marker is valid
        and matches this environment.
        """
        return (
            not marker
            or not pkg_resources.invalid_marker(marker)
            and pkg_resources.evaluate_marker(marker)
        ) 
开发者ID:saadnpq,项目名称:matrixcli,代码行数:12,代码来源:ptr.py

示例3: marker_passes

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import evaluate_marker [as 别名]
def marker_passes(marker):
		"""
		Given an environment marker, return True if the marker is valid
		and matches this environment.
		"""
		return (
			not marker
			or not pkg_resources.invalid_marker(marker)
			and pkg_resources.evaluate_marker(marker)
		) 
开发者ID:AI-DI,项目名称:Brancher,代码行数:12,代码来源:ptr.py

示例4: dependencies

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import evaluate_marker [as 别名]
def dependencies(self, extra=None):
    """Access the dependencies of this Wheel.

    Args:
      extra: if specified, include the additional dependencies
            of the named "extra".

    Yields:
      the names of requirements from the metadata.json, in lexical order.
    """
    # TODO(mattmoor): Is there a schema to follow for this?
    dependency_set = set()

    run_requires = self.metadata().get('run_requires', [])
    for requirement in run_requires:
      if requirement.get('extra') != extra:
        # Match the requirements for the extra we're looking for.
        continue
      marker = requirement.get('environment')
      if marker and not pkg_resources.evaluate_marker(marker):
        # The current environment does not match the provided PEP 508 marker,
        # so ignore this requirement.
        continue
      requires = requirement.get('requires', [])
      for entry in requires:
        # Strip off any trailing versioning data.
        parts = re.split('[ ><=()]', entry)
        dependency_set.add(parts[0])

    return sorted(dependency_set) 
开发者ID:bazelbuild,项目名称:rules_python,代码行数:32,代码来源:whl.py

示例5: dependencies

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import evaluate_marker [as 别名]
def dependencies(self, extra=None):
    """Access the dependencies of this Wheel.

    Args:
      extra: if specified, include the additional dependencies
            of the named "extra".

    Yields:
      the names of requirements from the metadata.json
    """
    # TODO(mattmoor): Is there a schema to follow for this?
    run_requires = self.metadata().get('run_requires', [])
    for requirement in run_requires:
      if requirement.get('extra') != extra:
        # Match the requirements for the extra we're looking for.
        continue
      marker = requirement.get('environment')
      if marker and not pkg_resources.evaluate_marker(marker):
        # The current environment does not match the provided PEP 508 marker,
        # so ignore this requirement.
        continue
      requires = requirement.get('requires', [])
      for entry in requires:
        # Strip off any trailing versioning data.
        parts = re.split('[ ><=()]', entry)
        yield parts[0] 
开发者ID:TriggerMail,项目名称:rules_pyz,代码行数:28,代码来源:wheeltool.py

示例6: run

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import evaluate_marker [as 别名]
def run(self):
        from pkg_resources import evaluate_marker
        requirements = self.distribution.install_requires + ['mock>=2.0.0', 'pytest-cov', 'pytest'] +\
            [v for k, v in self.distribution.extras_require.items() if not k.startswith(':') or evaluate_marker(k[1:])]
        self.distribution.fetch_build_eggs(requirements)
        self.run_tests() 
开发者ID:zalando,项目名称:patroni,代码行数:8,代码来源:setup.py

示例7: pytest_configure

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import evaluate_marker [as 别名]
def pytest_configure(config):
    msgs = []

    if not os.path.exists(_testdata):
        msg = "testdata not available! "
        if os.path.exists(os.path.join(_root, ".git")):
            msg += ("Please run git submodule update --init --recursive " +
                    "and then run tests again.")
        else:
            msg += ("The testdata doesn't appear to be included with this package, " +
                    "so finding the right version will be hard. :(")
        msgs.append(msg)

    if config.option.update_xfail:
        # Check for optional requirements
        req_file = os.path.join(_root, "requirements-optional.txt")
        if os.path.exists(req_file):
            with open(req_file, "r") as fp:
                for line in fp:
                    if (line.strip() and
                        not (line.startswith("-r") or
                             line.startswith("#"))):
                        if ";" in line:
                            spec, marker = line.strip().split(";", 1)
                        else:
                            spec, marker = line.strip(), None
                        req = pkg_resources.Requirement.parse(spec)
                        if marker and not pkg_resources.evaluate_marker(marker):
                            msgs.append("%s not available in this environment" % spec)
                        else:
                            try:
                                installed = pkg_resources.working_set.find(req)
                            except pkg_resources.VersionConflict:
                                msgs.append("Outdated version of %s installed, need %s" % (req.name, spec))
                            else:
                                if not installed:
                                    msgs.append("Need %s" % spec)

        # Check cElementTree
        import xml.etree.ElementTree as ElementTree

        try:
            import xml.etree.cElementTree as cElementTree
        except ImportError:
            msgs.append("cElementTree unable to be imported")
        else:
            if cElementTree.Element is ElementTree.Element:
                msgs.append("cElementTree is just an alias for ElementTree")

    if msgs:
        pytest.exit("\n".join(msgs)) 
开发者ID:morpheus65535,项目名称:bazarr,代码行数:53,代码来源:conftest.py


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