32
32
# Clang package we use on Linux
33
33
LLVM_URL = 'https://github.com/mypyc/mypy_mypyc-wheels/releases/download/llvm/llvm-centos-5.tar.gz'
34
34
35
+ # Script to configure 64-bit MSVC compiler executable
36
+ VCVARS64 = (
37
+ r'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise' +
38
+ r'\VC\Auxiliary\Build\vcvars64.bat'
39
+ )
40
+
35
41
# Mypy repository root
36
42
ROOT_DIR = os .path .dirname (os .path .dirname (__file__ ))
37
43
@@ -53,18 +59,22 @@ def create_environ(python_version: str) -> Dict[str, str]:
53
59
#
54
60
# TODO: remove use of mypy-requirements.txt once we no longer need to support
55
61
# building pre modular typeshed releases
56
- env [ 'CIBW_BEFORE_BUILD' ] = """
62
+ install_deps = """
57
63
pip install -r {package}/mypy-requirements.txt &&
58
64
(pip install -r {package}/build-requirements.txt || true)
59
65
""" .replace ('\n ' , ' ' )
66
+ env ['CIBW_BEFORE_BUILD' ] = install_deps
60
67
61
68
# download a copy of clang to use to compile on linux. this was probably built in 2018,
62
69
# speeds up compilation 2x
63
- env ['CIBW_BEFORE_BUILD_LINUX' ] = """
64
- (cd / && curl -L %s | tar xzf -) &&
65
- pip install -r {package}/mypy-requirements.txt &&
66
- (pip install -r {package}/build-requirements.txt || true)
67
- """ .replace ('\n ' , ' ' ) % LLVM_URL
70
+ env ['CIBW_BEFORE_BUILD_LINUX' ] = (
71
+ "(cd / && curl -L %s | tar xzf -) && %s" % (LLVM_URL , install_deps )
72
+ )
73
+
74
+ # IMPORTANT: The build can run out of memory if we don't use a 64-bit compiler on Windows.
75
+ env ['CIBW_BEFORE_BUILD_WINDOWS' ] = (
76
+ 'call "%s" && %s' % (VCVARS64 , install_deps )
77
+ )
68
78
69
79
# the double negative is counterintuitive, https://github.com/pypa/pip/issues/5735
70
80
env ['CIBW_ENVIRONMENT' ] = 'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=3 PIP_NO_BUILD_ISOLATION=no'
0 commit comments