-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new --pure-wheel command line option to also build pure Python wheel. If not selected, build will fail with a wheel that does not contain platform-specific code once built. Also add a new CIBW_PURE_WHEEL environment variable for this option. Reference: #1021 Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
- Loading branch information
1 parent
51b50db
commit d9f6db2
Showing
6 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from test import test_projects | ||
|
||
from . import utils | ||
|
||
pure_python_project = test_projects.TestProject() | ||
pure_python_project.files[ | ||
"setup.py" | ||
] = """ | ||
from setuptools import Extension, setup | ||
setup( | ||
name="spam", | ||
py_modules=['spam'], | ||
version="0.1.0", | ||
) | ||
""" | ||
|
||
pure_python_project.files[ | ||
"spam.py" | ||
] = """ | ||
def a_function(): | ||
pass | ||
""" | ||
|
||
|
||
def test(tmp_path, capfd): | ||
# this test checks that if a pure wheel is generated, the build should | ||
# pass with the pure wheel option. | ||
project_dir = tmp_path / "project" | ||
pure_python_project.generate(project_dir) | ||
|
||
env = { | ||
"CIBW_PURE_WHEEL": "yes", | ||
# this shouldn't depend on the version of python, so build only CPython 3.6 | ||
"CIBW_BUILD": "cp36-*", | ||
} | ||
|
||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=env) | ||
print("produced wheels:", actual_wheels) | ||
|
||
captured = capfd.readouterr() | ||
print("out", captured.out) | ||
print("err", captured.err) | ||
assert "Build failed because a pure Python wheel was generated" not in captured.err | ||
|
||
# check that the expected wheels are produced | ||
expected_wheels = ["spam-0.1.0-py3-none-any.whl"] | ||
assert set(actual_wheels) == set(expected_wheels) |