-
Notifications
You must be signed in to change notification settings - Fork 295
Adding support for building manylinux2010 wheels #135
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
28d7b22
Adding support for building manylinux2010 wheels
YannickJadoul b0daac4
Solving the case where `auditwheel repair` creates multiple wheels fo…
YannickJadoul bdc5830
Adding test accessing manylinux2010-only ABI
YannickJadoul b00da68
Making sure 08_manylinux2010_only test does not work on manylinux1
YannickJadoul 17b8590
Skipping manylinux1 for 08_manylinux2010_only test
YannickJadoul ecd9a02
Adapting tests to new test framework from #137
YannickJadoul 235567c
Updating dockcross images in docker images test, including the new do…
YannickJadoul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -24,13 +24,19 @@ def get_python_configurations(build_selector): | |
| PythonConfiguration(identifier='cp35-manylinux1_i686', path='/opt/python/cp35-cp35m'), | ||
| PythonConfiguration(identifier='cp36-manylinux1_i686', path='/opt/python/cp36-cp36m'), | ||
| PythonConfiguration(identifier='cp37-manylinux1_i686', path='/opt/python/cp37-cp37m'), | ||
| PythonConfiguration(identifier='cp27-manylinux2010_x86_64', path='/opt/python/cp27-cp27m'), | ||
| PythonConfiguration(identifier='cp27-manylinux2010_x86_64', path='/opt/python/cp27-cp27mu'), | ||
| PythonConfiguration(identifier='cp34-manylinux2010_x86_64', path='/opt/python/cp34-cp34m'), | ||
| PythonConfiguration(identifier='cp35-manylinux2010_x86_64', path='/opt/python/cp35-cp35m'), | ||
| PythonConfiguration(identifier='cp36-manylinux2010_x86_64', path='/opt/python/cp36-cp36m'), | ||
| PythonConfiguration(identifier='cp37-manylinux2010_x86_64', path='/opt/python/cp37-cp37m'), | ||
| ] | ||
|
|
||
| # skip builds as required | ||
| return [c for c in python_configurations if build_selector(c.identifier)] | ||
|
|
||
|
|
||
| def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment, manylinux1_images): | ||
| def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment, manylinux_images): | ||
| try: | ||
| subprocess.check_call(['docker', '--version']) | ||
| except: | ||
|
|
@@ -42,8 +48,9 @@ def build(project_dir, output_dir, test_command, test_requires, before_build, bu | |
|
|
||
| python_configurations = get_python_configurations(build_selector) | ||
| platforms = [ | ||
| ('manylinux1_x86_64', manylinux1_images.get('x86_64') or 'quay.io/pypa/manylinux1_x86_64'), | ||
| ('manylinux1_i686', manylinux1_images.get('i686') or 'quay.io/pypa/manylinux1_i686'), | ||
| ('manylinux1_x86_64', manylinux_images.get('manylinux1_x86_64') or 'quay.io/pypa/manylinux1_x86_64'), | ||
| ('manylinux1_i686', manylinux_images.get('manylinux1_i686') or 'quay.io/pypa/manylinux1_i686'), | ||
| ('manylinux2010_x86_64', manylinux_images.get('manylinux2010_x86_64') or 'quay.io/pypa/manylinux2010_x86_64'), | ||
| ] | ||
|
|
||
| for platform_tag, docker_image in platforms: | ||
|
|
@@ -80,10 +87,11 @@ def build(project_dir, output_dir, test_command, test_requires, before_build, bu | |
| if [[ "$built_wheel" == *none-any.whl ]]; then | ||
| # pure python wheel - just copy | ||
| mv "$built_wheel" /tmp/delocated_wheel | ||
| delocated_wheel=(/tmp/delocated_wheel/*.whl) | ||
| else | ||
| auditwheel repair "$built_wheel" -w /tmp/delocated_wheel | ||
| auditwheel repair --plat {platform_tag} "$built_wheel" -w /tmp/delocated_wheel | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mayeut I saw your PR pypa/manylinux#293 adding |
||
| delocated_wheel=(/tmp/delocated_wheel/*-{platform_tag}.whl) | ||
| fi | ||
| delocated_wheel=(/tmp/delocated_wheel/*.whl) | ||
|
|
||
| # Install the wheel we just built | ||
| "$PYBIN/pip" install "$delocated_wheel" | ||
|
|
@@ -115,6 +123,7 @@ def build(project_dir, output_dir, test_command, test_requires, before_build, bu | |
| ), | ||
| build_verbosity_flag=' '.join(get_build_verbosity_extra_flags(build_verbosity)), | ||
| environment_exports='\n'.join(environment.as_shell_commands()), | ||
| platform_tag=platform_tag, | ||
| uid=os.getuid(), | ||
| gid=os.getgid(), | ||
| ) | ||
|
|
||
This file contains hidden or 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 hidden or 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,22 @@ | ||
| import os, pytest | ||
| import utils | ||
|
|
||
| def test(): | ||
| project_dir = os.path.dirname(__file__) | ||
|
|
||
| if utils.platform != 'linux': | ||
| pytest.skip('the docker test is only relevant to the linux build') | ||
|
|
||
| # build the wheels | ||
| # CFLAGS environment veriable is ecessary to fail on 'malloc_info' (on manylinux1) during compilation/linking, | ||
| # rather than when dynamically loading the Python | ||
| utils.cibuildwheel_run(project_dir, add_env={ | ||
| 'CIBW_ENVIRONMENT': 'CFLAGS="$CFLAGS -Werror=implicit-function-declaration"', | ||
| 'CIBW_SKIP': '*-manylinux1_*', | ||
| }) | ||
|
|
||
| # also check that we got the right wheels | ||
| expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') | ||
| if '-manylinux1_' not in w] | ||
| actual_wheels = os.listdir('wheelhouse') | ||
| assert set(actual_wheels) == set(expected_wheels) |
This file contains hidden or 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,7 @@ | ||
| from setuptools import setup, Extension | ||
|
|
||
| setup( | ||
| name="spam", | ||
| ext_modules=[Extension('spam', sources=['spam.c'])], | ||
| version="0.1.0", | ||
| ) |
This file contains hidden or 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,57 @@ | ||
| #include <Python.h> | ||
| #if defined(__linux__) | ||
| #include <malloc.h> | ||
| #endif | ||
|
|
||
| static PyObject * | ||
| spam_system(PyObject *self, PyObject *args) | ||
| { | ||
| const char *command; | ||
| int sts = 0; | ||
|
|
||
| if (!PyArg_ParseTuple(args, "s", &command)) | ||
| return NULL; | ||
|
|
||
| #if defined(__linux__) | ||
| sts = malloc_info(0, stdout); | ||
| #endif | ||
| if (sts == 0) { | ||
| sts = system(command); | ||
| } | ||
| return PyLong_FromLong(sts); | ||
| } | ||
|
|
||
| /* Module initialization */ | ||
|
|
||
| #if PY_MAJOR_VERSION >= 3 | ||
| #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) | ||
| #define MOD_DEF(m, name, doc, methods, module_state_size) \ | ||
| static struct PyModuleDef moduledef = { \ | ||
| PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ | ||
| m = PyModule_Create(&moduledef); | ||
| #define MOD_RETURN(m) return m; | ||
| #else | ||
| #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) | ||
| #define MOD_DEF(m, name, doc, methods, module_state_size) \ | ||
| m = Py_InitModule3(name, methods, doc); | ||
| #define MOD_RETURN(m) return; | ||
| #endif | ||
|
|
||
| static PyMethodDef module_methods[] = { | ||
| {"system", (PyCFunction)spam_system, METH_VARARGS, | ||
| "Execute a shell command."}, | ||
| {NULL} /* Sentinel */ | ||
| }; | ||
|
|
||
| MOD_INIT(spam) | ||
| { | ||
| PyObject* m; | ||
|
|
||
| MOD_DEF(m, | ||
| "spam", | ||
| "Example module", | ||
| module_methods, | ||
| -1) | ||
|
|
||
| MOD_RETURN(m) | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these default images be here, or should they actually be in
main.py?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joerick This is about the code style, rather than platform/ABI-related. Any preferences, here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joerick Thus linor code organizational detail is still open, as well.