Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def expected_wheel_name(fmt):
return fmt.format(get_abbr_impl() + get_impl_ver(), get_abi_tag())
def get_windows_platform_name():
libname = 'libmgrs'
try:
import wheel.pep425tags
name = wheel.pep425tags.get_abbr_impl() + \
wheel.pep425tags.get_impl_ver() + \
'-' + wheel.pep425tags.get_platform()
return libname + '.' + name + '.pyd'
except ImportError:
return libname + '.pyd'
plat_name = 'any'
else:
plat_name = self.plat_name or get_platform()
if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize == 2147483647:
plat_name = 'linux_i686'
plat_name = plat_name.replace('-', '_').replace('.', '_')
if self.root_is_pure:
if self.universal:
impl = 'py2.py3'
else:
impl = self.python_tag
tag = (impl, 'none', plat_name)
else:
impl_name = get_abbr_impl()
impl_ver = get_impl_ver()
# PEP 3149
abi_tag = str(get_abi_tag()).lower()
tag = (impl_name + impl_ver, abi_tag, plat_name)
supported_tags = pep425tags.get_supported(
supplied_platform=plat_name if self.plat_name_supplied else None)
# XXX switch to this alternate implementation for non-pure:
assert tag == supported_tags[0], "%s != %s" % (tag, supported_tags[0])
return tag
if system == "Windows":
service_pack = platform.win32_ver()[2]
kernel = uname[3] # 5.1.2600
release = uname[2] # XP, 2000, 7
version = uname[3] + service_pack # 5.1.2600 SP3, 6.1.7601 SP1
elif system == "Darwin":
kernel = uname[2] # 12.2.0
release = "OSX" # OSX
version = platform.mac_ver()[0] # 10.8.2
elif system == "Linux":
kernel = uname[2] # 3.2.5
release = platform.linux_distribution()[0] # Ubuntu
version = platform.linux_distribution()[1] # 12.04
# Emulate PEP 425 naming conventions - e.g. cp27-cp27mu-linux_x86_64.
pep425tag = "%s%s-%s-%s" % (pep425tags.get_abbr_impl(),
pep425tags.get_impl_ver(),
str(pep425tags.get_abi_tag()).lower(),
pep425tags.get_platform())
return cls.from_keywords(
session=session,
system=system,
architecture=architecture,
node=uname[1],
release=release,
version=version,
machine=uname[4], # x86, x86_64
kernel=kernel,
fqdn=fqdn,
pep425tag=pep425tag,
)
# pypi).
# TODO: Add actual distro detection, instead of
# relying on limited_api option.
if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize > 2147483647 \
and self.py_limited_api:
plat_name = 'manylinux1_x86_64'
plat_name = plat_name.replace('-', '_').replace('.', '_')
if self.root_is_pure:
if self.universal:
impl = 'py2.py3'
else:
impl = self.python_tag
tag = (impl, 'none', plat_name)
else:
impl_name = get_abbr_impl()
impl_ver = get_impl_ver()
impl = impl_name + impl_ver
# We don't work on CPython 3.1, 3.0.
if self.py_limited_api and (impl_name + impl_ver).startswith('cp3'):
impl = self.py_limited_api
if sys.platform == "win32":
abi_tag = 'none'
else:
abi_tag = 'abi3'
else:
abi_tag = str(get_abi_tag()).lower()
tag = (impl, abi_tag, plat_name)
supported_tags = pep425tags.get_supported(
supplied_platform=plat_name if self.plat_name_supplied else None)
# XXX switch to this alternate implementation for
# non-pure:
if system == "Windows":
service_pack = platform.win32_ver()[2]
kernel = uname[3] # 5.1.2600
release = uname[2] # XP, 2000, 7
version = uname[3] + service_pack # 5.1.2600 SP3, 6.1.7601 SP1
elif system == "Darwin":
kernel = uname[2] # 12.2.0
release = "OSX" # OSX
version = platform.mac_ver()[0] # 10.8.2
elif system == "Linux":
kernel = uname[2] # 3.2.5
release = platform.linux_distribution()[0] # Ubuntu
version = platform.linux_distribution()[1] # 12.04
# Emulate PEP 425 naming conventions - e.g. cp27-cp27mu-linux_x86_64.
pep425tag = "%s%s-%s-%s" % (pep425tags.get_abbr_impl(),
pep425tags.get_impl_ver(),
str(pep425tags.get_abi_tag()).lower(),
pep425tags.get_platform())
return cls.from_keywords(
session=session,
system=system,
architecture=architecture,
node=uname[1],
release=release,
version=version,
machine=uname[4], # x86, x86_64
kernel=kernel,
fqdn=fqdn,
pep425tag=pep425tag,
)