Merge pull request #3001 from mozilla/setup-py-decoder-windows

Windows support in setup.py decoder wheel installation (Fixes #2992)
This commit is contained in:
Reuben Morais 2020-05-19 16:10:35 +02:00 committed by GitHub
commit 4ce7da717b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,12 +10,15 @@ from setuptools import find_packages, setup
def get_decoder_pkg_url(version, artifacts_root=None): def get_decoder_pkg_url(version, artifacts_root=None):
is_arm = 'arm' in platform.machine() is_arm = 'arm' in platform.machine()
is_mac = 'darwin' in sys.platform is_mac = 'darwin' in sys.platform
is_win = 'win32' in sys.platform
is_64bit = sys.maxsize > (2**31 - 1) is_64bit = sys.maxsize > (2**31 - 1)
if is_arm: if is_arm:
tc_arch = 'arm64-ctc' if is_64bit else 'arm-ctc' tc_arch = 'arm64-ctc' if is_64bit else 'arm-ctc'
elif is_mac: elif is_mac:
tc_arch = 'osx-ctc' tc_arch = 'osx-ctc'
elif is_win:
tc_arch = 'win-ctc'
else: else:
tc_arch = 'cpu-ctc' tc_arch = 'cpu-ctc'
@ -23,7 +26,7 @@ def get_decoder_pkg_url(version, artifacts_root=None):
branch = "v{}".format(version) branch = "v{}".format(version)
plat = platform.system().lower() plat = platform.system().lower()
arch = platform.machine() arch = platform.machine().lower()
if plat == 'linux' and arch == 'x86_64': if plat == 'linux' and arch == 'x86_64':
plat = 'manylinux1' plat = 'manylinux1'
@ -31,6 +34,9 @@ def get_decoder_pkg_url(version, artifacts_root=None):
if plat == 'darwin': if plat == 'darwin':
plat = 'macosx_10_10' plat = 'macosx_10_10'
if plat == 'windows':
plat = 'win'
is_ucs2 = sys.maxunicode < 0x10ffff is_ucs2 = sys.maxunicode < 0x10ffff
m_or_mu = 'mu' if is_ucs2 else 'm' m_or_mu = 'mu' if is_ucs2 else 'm'