本文整理汇总了Python中pip._internal.pep425tags.get_supported方法的典型用法代码示例。如果您正苦于以下问题:Python pep425tags.get_supported方法的具体用法?Python pep425tags.get_supported怎么用?Python pep425tags.get_supported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip._internal.pep425tags
的用法示例。
在下文中一共展示了pep425tags.get_supported方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tags
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def get_tags(self):
# type: () -> List[Pep425Tag]
"""
Return the supported PEP 425 tags to check wheel candidates against.
The tags are returned in order of preference (most preferred first).
"""
if self._valid_tags is None:
tags = get_supported(
version_info=self._given_py_version_info,
platforms=self.platforms,
abi=self.abi,
impl=self.implementation,
)
self._valid_tags = tags
return self._valid_tags
示例2: get_tags
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def get_tags(self):
# type: () -> List[Pep425Tag]
"""
Return the supported PEP 425 tags to check wheel candidates against.
The tags are returned in order of preference (most preferred first).
"""
if self._valid_tags is None:
# Pass versions=None if no py_version_info was given since
# versions=None uses special default logic.
py_version_info = self._given_py_version_info
if py_version_info is None:
versions = None
else:
versions = [version_info_to_nodot(py_version_info)]
tags = get_supported(
versions=versions,
platform=self.platform,
abi=self.abi,
impl=self.implementation,
)
self._valid_tags = tags
return self._valid_tags
示例3: support_index_min
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def support_index_min(self, tags=None):
"""
Return the lowest index that one of the wheel's file_tag combinations
achieves in the supported_tags list e.g. if there are 8 supported tags,
and one of the file tags is first in the list, then return 0. Returns
None is the wheel is not supported.
"""
if tags is None: # for mock
tags = pep425tags.get_supported()
indexes = [tags.index(c) for c in self.file_tags if c in tags]
return min(indexes) if indexes else None
示例4: supported
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def supported(self, tags=None):
"""Is this wheel supported on this system?"""
if tags is None: # for mock
tags = pep425tags.get_supported()
return bool(set(tags).intersection(self.file_tags))
示例5: support_index_min
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def support_index_min(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> Optional[int]
"""
Return the lowest index that one of the wheel's file_tag combinations
achieves in the supported_tags list e.g. if there are 8 supported tags,
and one of the file tags is first in the list, then return 0. Returns
None is the wheel is not supported.
"""
if tags is None: # for mock
tags = pep425tags.get_supported()
indexes = [tags.index(c) for c in self.file_tags if c in tags]
return min(indexes) if indexes else None
示例6: supported
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def supported(self, tags=None):
# type: (Optional[List[Pep425Tag]]) -> bool
"""Is this wheel supported on this system?"""
if tags is None: # for mock
tags = pep425tags.get_supported()
return bool(set(tags).intersection(self.file_tags))
示例7: populate_link
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def populate_link(self, finder, upgrade, require_hashes):
# type: (PackageFinder, bool, bool) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that self.link may still be None - if Upgrade is False and the
requirement is already installed.
If require_hashes is True, don't use the wheel cache, because cached
wheels, always built locally, have different hashes than the files
downloaded from the index server and thus throw false hash mismatches.
Furthermore, cached wheels at present have undeterministic contents due
to file modification times.
"""
if self.link is None:
self.link = finder.find_requirement(self, upgrade)
if self._wheel_cache is not None and not require_hashes:
old_link = self.link
supported_tags = pep425tags.get_supported()
self.link = self._wheel_cache.get(
link=self.link,
package_name=self.name,
supported_tags=supported_tags,
)
if old_link != self.link:
logger.debug('Using cached wheel link: %s', self.link)
# Things that are valid for all kinds of requirements?
示例8: __init__
# 需要导入模块: from pip._internal import pep425tags [as 别名]
# 或者: from pip._internal.pep425tags import get_supported [as 别名]
def __init__(
self,
platforms=None, # type: Optional[List[str]]
py_version_info=None, # type: Optional[Tuple[int, ...]]
abi=None, # type: Optional[str]
implementation=None, # type: Optional[str]
):
# type: (...) -> None
"""
:param platforms: A list of platform strings or None. If None,
searches for packages that are supported by the current system.
Otherwise, will find packages that can be built on the platforms
passed in. These packages will only be downloaded for
distribution: they will not be built locally.
:param py_version_info: An optional tuple of ints representing the
Python version information to use (e.g. `sys.version_info[:3]`).
This can have length 1, 2, or 3 when provided.
:param abi: A string or None. This is passed to pep425tags.py's
get_supported() function as is.
:param implementation: A string or None. This is passed to
pep425tags.py's get_supported() function as is.
"""
# Store the given py_version_info for when we call get_supported().
self._given_py_version_info = py_version_info
if py_version_info is None:
py_version_info = sys.version_info[:3]
else:
py_version_info = normalize_version_info(py_version_info)
py_version = '.'.join(map(str, py_version_info[:2]))
self.abi = abi
self.implementation = implementation
self.platforms = platforms
self.py_version = py_version
self.py_version_info = py_version_info
# This is used to cache the return value of get_tags().
self._valid_tags = None # type: Optional[List[Pep425Tag]]