8000 Use a 64-bit C compiler on Windows to build wheels by JukkaL · Pull Request #10097 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Use a 64-bit C compiler on Windows to build wheels #10097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use a 64-bit C compiler on Windows to build wheels
This will hopefully fix out of memory errors.

Work on #10074.
  • Loading branch information
JukkaL committed Feb 16, 2021
commit e7217d62036cfe5cb34ab9fa90b093749789c3b4
22 changes: 16 additions & 6 deletions misc/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
# Clang package we use on Linux
LLVM_URL = 'https://github.com/mypyc/mypy_mypyc-wheels/releases/download/llvm/llvm-centos-5.tar.gz'

# Script to configure 64-bit MSVC compiler executable
VCVARS64 = (
r'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise' +
r'\VC\Auxiliary\Build\vcvars64.bat'
)

# Mypy repository root
ROOT_DIR = os.path.dirname(os.path.dirname(__file__))

Expand All @@ -53,18 +59,22 @@ def create_environ(python_version: str) -> Dict[str, str]:
#
# TODO: remove use of mypy-requirements.txt once we no longer need to support
# building pre modular typeshed releases
env['CIBW_BEFORE_BUILD'] = """
install_deps = """
pip install -r {package}/mypy-requirements.txt &&
(pip install -r {package}/build-requirements.txt || true)
""".replace('\n', ' ')
env['CIBW_BEFORE_BUILD'] = install_deps

# download a copy of clang to use to compile on linux. this was probably built in 2018,
# speeds up compilation 2x
env['CIBW_BEFORE_BUILD_LINUX'] = """
(cd / && curl -L %s | tar xzf -) &&
pip install -r {package}/mypy-requirements.txt &&
(pip install -r {package}/build-requirements.txt || true)
""".replace('\n', ' ') % LLVM_URL
env['CIBW_BEFORE_BUILD_LINUX'] = (
"(cd / && curl -L %s | tar xzf -) && %s" % (LLVM_URL, install_deps)
)

# IMPORTANT: The build can run out of memory if we don't use a 64-bit compiler on Windows.
env['CIBW_BEFORE_BUILD_WINDOWS'] = (
'call "%s" && %s' % (VCVARS64, install_deps)
)

# the double negative is counterintuitive, https://github.com/pypa/pip/issues/5735
env['CIBW_ENVIRONMENT'] = 'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=3 PIP_NO_BUILD_ISOLATION=no'
Expand Down
0