24
24
import subprocess
25
25
from typing import Dict
26
26
27
- # Clang package we use on Linux
28
- LLVM_URL = 'https://github.com/mypyc/mypy_mypyc-wheels/releases/download/llvm/llvm-centos-5.tar.gz'
29
-
30
27
# Mypy repository root
31
28
ROOT_DIR = os .path .dirname (os .path .dirname (__file__ ))
32
29
@@ -38,7 +35,7 @@ def create_environ(python_version: str) -> Dict[str, str]:
38
35
env ['CIBW_BUILD' ] = f"cp{ python_version } -*"
39
36
40
37
# Don't build 32-bit wheels
41
- env ['CIBW_SKIP' ] = "*-manylinux_i686 *-win32 *-musllinux_* "
38
+ env ['CIBW_SKIP' ] = "*-manylinux_i686 *-musllinux_i686 *-win32 "
42
39
43
40
# Apple Silicon support
44
41
# When cross-compiling on Intel, it is not possible to test arm64 and
@@ -52,22 +49,22 @@ def create_environ(python_version: str) -> Dict[str, str]:
52
49
# mypy's isolated builds don't specify the requirements mypyc needs, so install
53
50
# requirements and don't use isolated builds. we need to use build-requirements.txt
54
51
# with recent mypy commits to get stub packages needed for compilation.
55
- env ['CIBW_BEFORE_BUILD' ] = """
56
- pip install -r {package}/build-requirements.txt
57
- """ .replace ('\n ' , ' ' )
52
+ env ['CIBW_BEFORE_BUILD' ] = 'pip install -r {package}/build-requirements.txt'
58
53
59
- # download a copy of clang to use to compile on linux. this was probably built in 2018,
60
- # speeds up compilation 2x
61
- env ['CIBW_BEFORE_BUILD_LINUX' ] = """
62
- (cd / && curl -L %s | tar xzf -) &&
63
- pip install -r {package}/build-requirements.txt
64
- """ .replace ('\n ' , ' ' ) % LLVM_URL
54
+ # install clang using available package manager. platform-specific configuration overrides is only possible with
55
+ # pyproject.toml. once project fully transitions, properly adjust cibuildwheel configuration to each platform.
56
+ # https://cibuildwheel.readthedocs.io/en/stable/options/#overrides
57
+ env ['CIBW_BEFORE_ALL_LINUX' ] = 'command -v yum && yum install -y llvm-toolset-7.0 || apk add --no-cache clang'
65
58
66
59
# the double negative is counterintuitive, https://github.com/pypa/pip/issues/5735
60
+ # add llvm paths to environment to eliminate scl usage (like manylinux image does for gcc toolset).
61
+ # specifying redhat paths for musllinux shouldn't harm but is not desired (see overrides-related comment above).
67
62
env ['CIBW_ENVIRONMENT' ] = 'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=3 PIP_NO_BUILD_ISOLATION=no'
68
63
env ['CIBW_ENVIRONMENT_LINUX' ] = (
69
64
'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=3 PIP_NO_BUILD_ISOLATION=no ' +
70
- 'CC=/opt/llvm/bin/clang'
65
+ 'PATH=$PATH:/opt/rh/llvm-toolset-7.0/root/usr/bin ' +
66
+ 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rh/llvm-toolset-7.0/root/usr/lib64 ' +
67
+ 'CC=clang'
71
68
)
72
69
env ['CIBW_ENVIRONMENT_WINDOWS' ] = (
73
70
'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=2 PIP_NO_BUILD_ISOLATION=no'
0 commit comments