當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。