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,30 +49,24 @@ 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 [
56
- "CIBW_BEFORE_BUILD"
57
- ] = """
58
- pip install -r {package}/build-requirements.txt
59
- """ .replace (
60
- "\n " , " "
61
- )
52
+ env ["CIBW_BEFORE_BUILD" ] = "pip install -r {package}/build-requirements.txt"
62
53
63
- # download a copy of clang to use to compile on linux. this was probably built in 2018,
64
- # speeds up compilation 2x
65
- env ["CIBW_BEFORE_BUILD_LINUX" ] = (
66
- """
67
- (cd / && curl -L %s | tar xzf -) &&
68
- pip install -r {package}/build-requirements.txt
69
- """ .replace (
70
- "\n " , " "
71
- )
72
- % LLVM_URL
73
- )
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 [
58
+ "CIBW_BEFORE_ALL_LINUX"
59
+ ] = "command -v yum && yum install -y llvm-toolset-7.0 || apk add --no-cache clang"
74
60
75
61
# the double negative is counterintuitive, https://github.com/pypa/pip/issues/5735
62
+ # add llvm paths to environment to eliminate scl usage (like manylinux image does for gcc toolset).
63
+ # specifying redhat paths for musllinux shouldn't harm but is not desired (see overrides-related comment above).
76
64
env ["CIBW_ENVIRONMENT" ] = "MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=3 PIP_NO_BUILD_ISOLATION=no"
77
65
env ["CIBW_ENVIRONMENT_LINUX" ] = (
78
- "MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=3 PIP_NO_BUILD_ISOLATION=no " + "CC=/opt/llvm/bin/clang"
66
+ "MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=3 PIP_NO_BUILD_ISOLATION=no "
67
+ + "PATH=$PATH:/opt/rh/llvm-toolset-7.0/root/usr/bin "
68
+ + "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rh/llvm-toolset-7.0/root/usr/lib64 "
69
+ + "CC=clang"
79
70
)
80
71
env [
81
72
"CIBW_ENVIRONMENT_WINDOWS"
0 commit comments