Refactor expected_wheels function
This commit is contained in:
+34
-33
@@ -81,60 +81,61 @@ def expected_wheels(package_name, package_version, manylinux_versions=None,
|
|||||||
# {python tag} and {abi tag} are closely related to the python interpreter used to build the wheel
|
# {python tag} and {abi tag} are closely related to the python interpreter used to build the wheel
|
||||||
# so we'll merge them below as python_abi_tag
|
# so we'll merge them below as python_abi_tag
|
||||||
|
|
||||||
|
if manylinux_versions is None:
|
||||||
|
if pm.machine() == 'x86_64':
|
||||||
|
manylinux_versions = ['manylinux1', 'manylinux2010']
|
||||||
|
else:
|
||||||
|
manylinux_versions = ['manylinux2014']
|
||||||
|
|
||||||
python_abi_tags = ['cp35-cp35m', 'cp36-cp36m', 'cp37-cp37m', 'cp38-cp38']
|
python_abi_tags = ['cp35-cp35m', 'cp36-cp36m', 'cp37-cp37m', 'cp38-cp38']
|
||||||
extra_x86_python_abi_tags = ['cp27-cp27m', 'pp27-pypy_73', 'pp36-pypy36_pp73']
|
|
||||||
|
if pm.machine() == 'x86_64':
|
||||||
|
python_abi_tags += ['cp27-cp27m', 'pp27-pypy_73', 'pp36-pypy36_pp73']
|
||||||
|
|
||||||
if platform == 'linux':
|
if platform == 'linux':
|
||||||
if pm.machine() not in ['x86_64', 'i686']:
|
|
||||||
if manylinux_versions is None:
|
|
||||||
manylinux_versions = ['manylinux2014']
|
|
||||||
architectures = {'cp': [pm.machine()]}
|
|
||||||
else:
|
|
||||||
if manylinux_versions is None:
|
|
||||||
manylinux_versions = ['manylinux1', 'manylinux2010']
|
|
||||||
python_abi_tags += extra_x86_python_abi_tags
|
|
||||||
python_abi_tags.append('cp27-cp27mu') # python 2.7 has 2 different ABI on manylinux
|
python_abi_tags.append('cp27-cp27mu') # python 2.7 has 2 different ABI on manylinux
|
||||||
architectures = {'cp': ['x86_64', 'i686'], 'pp': ['x86_64']}
|
|
||||||
platform_tags = {}
|
wheels = []
|
||||||
for python_implemention in architectures:
|
|
||||||
platform_tags[python_implemention] = [
|
for python_abi_tag in python_abi_tags:
|
||||||
'{manylinux_version}_{architecture}'.format(
|
platform_tags = []
|
||||||
manylinux_version=manylinux_version, architecture=architecture)
|
|
||||||
for architecture in architectures[python_implemention]
|
if platform == 'linux':
|
||||||
|
architectures = [pm.machine()]
|
||||||
|
|
||||||
|
if pm.machine() == 'x86_64' and python_abi_tag.startswith('cp'):
|
||||||
|
architectures.append('i686')
|
||||||
|
|
||||||
|
platform_tags = [
|
||||||
|
'{}_{}'.format(manylinux_version, architecture)
|
||||||
|
for architecture in architectures
|
||||||
for manylinux_version in manylinux_versions
|
for manylinux_version in manylinux_versions
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_platform_tags(python_abi_tag):
|
|
||||||
return platform_tags[python_abi_tag[:2]]
|
|
||||||
elif platform == 'windows':
|
elif platform == 'windows':
|
||||||
python_abi_tags += extra_x86_python_abi_tags
|
if python_abi_tag.startswith('cp'):
|
||||||
platform_tags = {'cp': ['win32', 'win_amd64'], 'pp': ['win32']}
|
platform_tags = ['win32', 'win_amd64']
|
||||||
|
else:
|
||||||
def get_platform_tags(python_abi_tag):
|
platform_tags = ['win32']
|
||||||
return platform_tags[python_abi_tag[:2]]
|
|
||||||
|
|
||||||
elif platform == 'macos':
|
elif platform == 'macos':
|
||||||
python_abi_tags += extra_x86_python_abi_tags
|
|
||||||
|
|
||||||
def get_platform_tags(python_abi_tag):
|
|
||||||
default_version = '10.7' if python_abi_tag.startswith('pp') else '10.9'
|
default_version = '10.7' if python_abi_tag.startswith('pp') else '10.9'
|
||||||
return ['macosx_{}_x86_64'.format((macosx_deployment_target or default_version).replace('.', '_'))]
|
platform_tags = ['macosx_{}_x86_64'.format((macosx_deployment_target or default_version).replace('.', '_'))]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise Exception('unsupported platform')
|
raise Exception('unsupported platform')
|
||||||
|
|
||||||
templates = []
|
for platform_tag in platform_tags:
|
||||||
for python_abi_tag in python_abi_tags:
|
wheels.append('{package_name}-{package_version}-{python_abi_tag}-{platform_tag}.whl'.format(
|
||||||
for platform_tag in get_platform_tags(python_abi_tag):
|
|
||||||
templates.append('{package_name}-{package_version}-{python_abi_tag}-{platform_tag}.whl'.format(
|
|
||||||
package_name=package_name, package_version=package_version,
|
package_name=package_name, package_version=package_version,
|
||||||
python_abi_tag=python_abi_tag, platform_tag=platform_tag
|
python_abi_tag=python_abi_tag, platform_tag=platform_tag
|
||||||
))
|
))
|
||||||
|
|
||||||
if IS_WINDOWS_RUNNING_ON_TRAVIS:
|
if IS_WINDOWS_RUNNING_ON_TRAVIS:
|
||||||
# Python 2.7 isn't supported on Travis.
|
# Python 2.7 isn't supported on Travis.
|
||||||
templates = [t for t in templates if '-cp27-' not in t and '-pp2' not in t]
|
wheels = [w for w in wheels if '-cp27-' not in w and '-pp2' not in w]
|
||||||
|
|
||||||
return templates
|
return wheels
|
||||||
|
|
||||||
|
|
||||||
platform = None
|
platform = None
|
||||||
|
|||||||
Reference in New Issue
Block a user