Skip to content

Commit

Permalink
Fix incompatibility with cibuildwheel for 32-bit Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Jun 5, 2022
1 parent 5174504 commit ce07d4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

* **Breaking Change**: Drop support for python 3.6, which is end of life
* Fix incompatibility with cibuildwheel for 32-bit Windows in [#951](https://github.com/PyO3/maturin/pull/951)

## [0.12.19] - 2022-06-05

Expand Down
14 changes: 14 additions & 0 deletions maturin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
"""

import os
import platform
import shlex
import shutil
import subprocess
import sys
import struct
from subprocess import SubprocessError
from typing import Dict

Expand All @@ -34,6 +36,15 @@ def get_maturin_pep517_args():
return args


def _additional_pep517_args():
# Support building for 32-bit Python on x64 Windows
if platform.system().lower() == "windows" and platform.machine().lower() == "amd64":
pointer_width = struct.calcsize("P") * 8
if pointer_width == 32:
return ["--target", "i686-pc-windows-msvc"]
return []


# noinspection PyUnusedLocal
def _build_wheel(
wheel_directory, config_settings=None, metadata_directory=None, editable=False
Expand All @@ -49,8 +60,10 @@ def _build_wheel(
"--compatibility",
"off",
]
command.extend(_additional_pep517_args())
if editable:
command.append("--editable")

pep517_args = get_maturin_pep517_args()
if pep517_args:
command.extend(pep517_args)
Expand Down Expand Up @@ -151,6 +164,7 @@ def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
"--interpreter",
sys.executable,
]
command.extend(_additional_pep517_args())
pep517_args = get_maturin_pep517_args()
if pep517_args:
command.extend(pep517_args)
Expand Down

0 comments on commit ce07d4f

Please sign in to comment.