Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.distlib.wheel Namespace Reference

Data Structures

class  Mounter
 
class  Wheel
 

Functions

 _derive_abi ()
 
 _get_suffixes ()
 
 _load_dynamic (name, path)
 
 _get_glibc_version ()
 
 compatible_tags ()
 
 is_compatible (wheel, tags=None)
 

Variables

 logger = logging.getLogger(__name__)
 
 cache = None
 
str IMP_PREFIX = 'pp'
 
 VER_SUFFIX = sysconfig.get_config_var('py_version_nodot')
 
str PYVER = 'py' + VER_SUFFIX
 
str IMPVER = IMP_PREFIX + VER_SUFFIX
 
 ARCH = get_platform().replace('-', '_').replace('.', '_')
 
 ABI = sysconfig.get_config_var('SOABI')
 
 FILENAME_RE = re.compile(, re.IGNORECASE | re.VERBOSE)
 
 NAME_VERSION_RE = re.compile(, re.IGNORECASE | re.VERBOSE)
 
 SHEBANG_RE = re.compile(br'\s*#![^\r\n]*')
 
 SHEBANG_DETAIL_RE = re.compile(br'^(\s*#!("[^"]+"|\S+))\s+(.*)$')
 
str SHEBANG_PYTHON = b'#!python'
 
str SHEBANG_PYTHONW = b'#!pythonw'
 
o to_posix = lambda o
 
 imp = None
 
 _hook = Mounter()
 
 COMPATIBLE_TAGS = compatible_tags()
 

Function Documentation

◆ _derive_abi()

_derive_abi ( )
protected

Definition at line 59 of file wheel.py.

59 def _derive_abi():
60 parts = ['cp', VER_SUFFIX]
61 if sysconfig.get_config_var('Py_DEBUG'):
62 parts.append('d')
63 if IMP_PREFIX == 'cp':
64 vi = sys.version_info[:2]
65 if vi < (3, 8):
66 wpm = sysconfig.get_config_var('WITH_PYMALLOC')
67 if wpm is None:
68 wpm = True
69 if wpm:
70 parts.append('m')
71 if vi < (3, 3):
72 us = sysconfig.get_config_var('Py_UNICODE_SIZE')
73 if us == 4 or (us is None and sys.maxunicode == 0x10FFFF):
74 parts.append('u')
75 return ''.join(parts)
for i

References pip._vendor.distlib.wheel._derive_abi(), and i.

Referenced by pip._vendor.distlib.wheel._derive_abi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _get_glibc_version()

_get_glibc_version ( )
protected

Definition at line 977 of file wheel.py.

977def _get_glibc_version():
978 import platform
979 ver = platform.libc_ver()
980 result = []
981 if ver[0] == 'glibc':
982 for s in ver[1].split('.'):
983 result.append(int(s) if s.isdigit() else 0)
984 result = tuple(result)
985 return result
986

References i.

Referenced by pip._vendor.distlib.wheel.compatible_tags().

Here is the caller graph for this function:

◆ _get_suffixes()

_get_suffixes ( )
protected

Definition at line 112 of file wheel.py.

112def _get_suffixes():
113 if imp:
114 return [s[0] for s in imp.get_suffixes()]
115 else:
117

References i.

Referenced by pip._vendor.distlib.wheel.compatible_tags().

Here is the caller graph for this function:

◆ _load_dynamic()

_load_dynamic (   name,
  path 
)
protected

Definition at line 118 of file wheel.py.

118def _load_dynamic(name, path):
119 # https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
120 if imp:
121 return imp.load_dynamic(name, path)
122 else:
125 sys.modules[name] = module
127 return module
128

References i.

Referenced by Mounter.load_module().

Here is the caller graph for this function:

◆ compatible_tags()

compatible_tags ( )
Return (pyver, abi, arch) tuples compatible with this Python.

Definition at line 987 of file wheel.py.

987def compatible_tags():
988 """
989 Return (pyver, abi, arch) tuples compatible with this Python.
990 """
991 versions = [VER_SUFFIX]
992 major = VER_SUFFIX[0]
993 for minor in range(sys.version_info[1] - 1, - 1, -1):
994 versions.append(''.join([major, str(minor)]))
995
996 abis = []
997 for suffix in _get_suffixes():
998 if suffix.startswith('.abi'):
999 abis.append(suffix.split('.', 2)[1])
1000 abis.sort()
1001 if ABI != 'none':
1002 abis.insert(0, ABI)
1003 abis.append('none')
1004 result = []
1005
1006 arches = [ARCH]
1007 if sys.platform == 'darwin':
1008 m = re.match(r'(\w+)_(\d+)_(\d+)_(\w+)$', ARCH)
1009 if m:
1010 name, major, minor, arch = m.groups()
1011 minor = int(minor)
1012 matches = [arch]
1013 if arch in ('i386', 'ppc'):
1014 matches.append('fat')
1015 if arch in ('i386', 'ppc', 'x86_64'):
1016 matches.append('fat3')
1017 if arch in ('ppc64', 'x86_64'):
1018 matches.append('fat64')
1019 if arch in ('i386', 'x86_64'):
1020 matches.append('intel')
1021 if arch in ('i386', 'x86_64', 'intel', 'ppc', 'ppc64'):
1022 matches.append('universal')
1023 while minor >= 0:
1024 for match in matches:
1025 s = '%s_%s_%s_%s' % (name, major, minor, match)
1026 if s != ARCH: # already there
1027 arches.append(s)
1028 minor -= 1
1029
1030 # Most specific - our Python version, ABI and arch
1031 for abi in abis:
1032 for arch in arches:
1033 result.append((''.join((IMP_PREFIX, versions[0])), abi, arch))
1034 # manylinux
1035 if abi != 'none' and sys.platform.startswith('linux'):
1036 arch = arch.replace('linux_', '')
1037 parts = _get_glibc_version()
1038 if len(parts) == 2:
1039 if parts >= (2, 5):
1040 result.append((''.join((IMP_PREFIX, versions[0])), abi,
1041 'manylinux1_%s' % arch))
1042 if parts >= (2, 12):
1043 result.append((''.join((IMP_PREFIX, versions[0])), abi,
1044 'manylinux2010_%s' % arch))
1045 if parts >= (2, 17):
1046 result.append((''.join((IMP_PREFIX, versions[0])), abi,
1047 'manylinux2014_%s' % arch))
1048 result.append((''.join((IMP_PREFIX, versions[0])), abi,
1049 'manylinux_%s_%s_%s' % (parts[0], parts[1],
1050 arch)))
1051
1052 # where no ABI / arch dependency, but IMP_PREFIX dependency
1053 for i, version in enumerate(versions):
1054 result.append((''.join((IMP_PREFIX, version)), 'none', 'any'))
1055 if i == 0:
1056 result.append((''.join((IMP_PREFIX, version[0])), 'none', 'any'))
1057
1058 # no IMP_PREFIX, ABI or arch dependency
1059 for i, version in enumerate(versions):
1060 result.append((''.join(('py', version)), 'none', 'any'))
1061 if i == 0:
1062 result.append((''.join(('py', version[0])), 'none', 'any'))
1063
1064 return set(result)
1065
1066

References pip._vendor.distlib.wheel._get_glibc_version(), pip._vendor.distlib.wheel._get_suffixes(), and i.

Here is the call graph for this function:

◆ is_compatible()

is_compatible (   wheel,
  tags = None 
)

Definition at line 1072 of file wheel.py.

1072def is_compatible(wheel, tags=None):
1073 if not isinstance(wheel, Wheel):
1074 wheel = Wheel(wheel) # assume it's a filename
1075 result = False
1076 if tags is None:
1077 tags = COMPATIBLE_TAGS
1078 for ver, abi, arch in tags:
1079 if ver in wheel.pyver and abi in wheel.abi and arch in wheel.arch:
1080 result = True
1081 break
1082 return result

References i.

Variable Documentation

◆ _hook

_hook = Mounter()
protected

Definition at line 164 of file wheel.py.

◆ ABI

ABI = sysconfig.get_config_var('SOABI')

Definition at line 55 of file wheel.py.

◆ ARCH

ARCH = get_platform().replace('-', '_').replace('.', '_')

Definition at line 53 of file wheel.py.

◆ cache

cache = None

Definition at line 36 of file wheel.py.

◆ COMPATIBLE_TAGS

COMPATIBLE_TAGS = compatible_tags()

Definition at line 1067 of file wheel.py.

◆ FILENAME_RE

FILENAME_RE = re.compile(, re.IGNORECASE | re.VERBOSE)

Definition at line 79 of file wheel.py.

◆ imp

imp = None

Definition at line 108 of file wheel.py.

◆ IMP_PREFIX

str IMP_PREFIX = 'pp'

Definition at line 39 of file wheel.py.

◆ IMPVER

str IMPVER = IMP_PREFIX + VER_SUFFIX

Definition at line 51 of file wheel.py.

◆ logger

logger = logging.getLogger(__name__)

Definition at line 34 of file wheel.py.

◆ NAME_VERSION_RE

NAME_VERSION_RE = re.compile(, re.IGNORECASE | re.VERBOSE)

Definition at line 89 of file wheel.py.

◆ PYVER

str PYVER = 'py' + VER_SUFFIX

Definition at line 50 of file wheel.py.

◆ SHEBANG_DETAIL_RE

SHEBANG_DETAIL_RE = re.compile(br'^(\s*#!("[^"]+"|\S+))\s+(.*)$')

Definition at line 96 of file wheel.py.

◆ SHEBANG_PYTHON

str SHEBANG_PYTHON = b'#!python'

Definition at line 97 of file wheel.py.

◆ SHEBANG_PYTHONW

str SHEBANG_PYTHONW = b'#!pythonw'

Definition at line 98 of file wheel.py.

◆ SHEBANG_RE

SHEBANG_RE = re.compile(br'\s*#![^\r\n]*')

Definition at line 95 of file wheel.py.

◆ to_posix

o to_posix = lambda o

Definition at line 101 of file wheel.py.

Referenced by Wheel.build(), and Wheel.write_records().

◆ VER_SUFFIX

str VER_SUFFIX = sysconfig.get_config_var('py_version_nodot')

Definition at line 47 of file wheel.py.