本文整理匯總了Python中pkg_resources.invalid_marker方法的典型用法代碼示例。如果您正苦於以下問題:Python pkg_resources.invalid_marker方法的具體用法?Python pkg_resources.invalid_marker怎麽用?Python pkg_resources.invalid_marker使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pkg_resources
的用法示例。
在下文中一共展示了pkg_resources.invalid_marker方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_extras
# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import invalid_marker [as 別名]
def check_extras(dist, attr, value):
"""Verify that extras_require mapping is valid"""
try:
for k,v in value.items():
if ':' in k:
k,m = k.split(':',1)
if pkg_resources.invalid_marker(m):
raise DistutilsSetupError("Invalid environment marker: "+m)
list(pkg_resources.parse_requirements(v))
except (TypeError,ValueError,AttributeError):
raise DistutilsSetupError(
"'extras_require' must be a dictionary whose values are "
"strings or lists of strings containing valid project/version "
"requirement specifiers."
)
示例2: check_extras
# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import invalid_marker [as 別名]
def check_extras(dist, attr, value):
"""Verify that extras_require mapping is valid"""
try:
for k, v in value.items():
if ':' in k:
k, m = k.split(':', 1)
if pkg_resources.invalid_marker(m):
raise DistutilsSetupError("Invalid environment marker: " + m)
list(pkg_resources.parse_requirements(v))
except (TypeError, ValueError, AttributeError):
raise DistutilsSetupError(
"'extras_require' must be a dictionary whose values are "
"strings or lists of strings containing valid project/version "
"requirement specifiers."
)
示例3: _check_extra
# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import invalid_marker [as 別名]
def _check_extra(extra, reqs):
name, sep, marker = extra.partition(':')
if marker and pkg_resources.invalid_marker(marker):
raise DistutilsSetupError("Invalid environment marker: " + marker)
list(pkg_resources.parse_requirements(reqs))
示例4: marker_passes
# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import invalid_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)
)
示例5: marker_passes
# 需要導入模塊: import pkg_resources [as 別名]
# 或者: from pkg_resources import invalid_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)
)