Skip to content

Commit b10533a

Browse files
authored
Merge pull request #10 from SimpleITK/ensure-wheels-are-available-on-the-host
BUG: manylinux: Ensure generated wheels are available on the host
2 parents 2272492 + aad0590 commit b10533a

4 files changed

Lines changed: 56 additions & 9 deletions

File tree

README.md

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,68 @@
22

33
This project provides a `setup.py` script that build SimpleITK Python wheel. [SimpleITK](http://www.simpleitk.org) is a simplified programming layer on top of the [Insight Segmentation and Registration Toolkit](https://itk.org) (ITK). ITK is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis.
44

5-
## Building the SimpleITK Python wheel module
5+
## Automated wheels building with scripts
66

7-
Building the wheel requires:
7+
Steps required to build wheels on Linux, MacOSX and Windows have been automated. The
8+
following sections outline how to use the associated scripts.
9+
10+
### Linux
11+
12+
On any linux distribution with `docker` and `bash` installed, running the script
13+
`dockcross-manylinux-build-wheels.sh` will create 32 and 64-bit wheels for both
14+
python 2.x and python 3.x in the `dist` directory.
15+
16+
For example:
17+
18+
```bash
19+
$ git clone git://github.com/SimpleITK/SimpleITKPythonPackage.git
20+
[...]
21+
22+
$ ./scripts/dockcross-manylinux-build-wheels.sh
23+
[...]
24+
25+
$ ls -1 dist/
26+
SimpleITK-0.11.0-cp27-cp27m-manylinux1_i686.whl
27+
SimpleITK-0.11.0-cp27-cp27m-manylinux1_x86_64.whl
28+
SimpleITK-0.11.0-cp27-cp27mu-manylinux1_i686.whl
29+
SimpleITK-0.11.0-cp27-cp27mu-manylinux1_x86_64.whl
30+
SimpleITK-0.11.0-cp33-cp33m-manylinux1_i686.whl
31+
SimpleITK-0.11.0-cp33-cp33m-manylinux1_x86_64.whl
32+
SimpleITK-0.11.0-cp34-cp34m-manylinux1_i686.whl
33+
SimpleITK-0.11.0-cp34-cp34m-manylinux1_x86_64.whl
34+
SimpleITK-0.11.0-cp35-cp35m-manylinux1_i686.whl
35+
SimpleITK-0.11.0-cp35-cp35m-manylinux1_x86_64.whl
36+
```
37+
38+
### MacOSX
39+
40+
*To be documented*
41+
42+
### Windows
43+
44+
*To be documented*
45+
46+
## Prerequisites
47+
48+
Building wheels requires:
849
* [CMake](https://cmake.org)
950
* Git
10-
* C++ Compiler
51+
* C++ Compiler - Platform specific requirements are summarized in [scikit-build documentation](http://scikit-build.readthedocs.io).
1152
* Python
1253

54+
## Detailed build instructions
55+
56+
### Building SimpleITK Python wheels
57+
1358
Build the SimpleITK Python wheel with the following command:
1459

1560
```
1661
mkvirtualenv build-sitk
17-
pip install -r requirements.txt
62+
pip install -r requirements-dev.txt
1863
python setup.py bdist_wheel
1964
```
2065

21-
## Efficiently building wheels for different version of python
66+
### Efficiently building wheels for different version of python
2267

2368
If on a given platform you would like to build wheels for different version of python, you can build the SimpleITK core libraries first and reuse them when building each wheel.
2469

@@ -35,7 +80,7 @@ python setup.py bdist_wheel -- \
3580
```
3681

3782
## Miscellaneous
38-
Written by Jean-Christophe Fillion-Robin from the Kitware Inc.
83+
Written by Jean-Christophe Fillion-Robin from Kitware Inc.
3984

4085
It is covered by the Apache License, Version 2.0:
4186

File renamed without changes.

scripts/dockcross-manylinux-build-wheels.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ script_dir="`cd $(dirname $0); pwd`"
1212

1313
# Build wheels
1414
pushd $script_dir/..
15-
/tmp/dockcross-manylinux-x64 ./scripts/internal/manylinux-build-wheels.sh
16-
/tmp/dockcross-manylinux-x86 ./scripts/internal/manylinux-build-wheels.sh
15+
mkdir -p dist
16+
DOCKER_ARGS="-v $(pwd)/dist:/work/dist/"
17+
/tmp/dockcross-manylinux-x64 -a "$DOCKER_ARGS" ./scripts/internal/manylinux-build-wheels.sh
18+
/tmp/dockcross-manylinux-x86 -a "$DOCKER_ARGS" ./scripts/internal/manylinux-build-wheels.sh
1719
popd

scripts/internal/manylinux-build-wheels.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ for PYBIN in /opt/python/*/bin; do
5454
echo "PYTHON_INCLUDE_DIR:${PYTHON_INCLUDE_DIR}"
5555
echo "PYTHON_LIBRARY:${PYTHON_LIBRARY}"
5656

57-
${PYBIN}/pip install --user -r /work/requirements-dev.txt
57+
${PYBIN}/pip install -r /work/requirements-dev.txt
5858
${PYBIN}/python setup.py bdist_wheel -G Ninja -- \
5959
-DSimpleITK_DIR:PATH=/work/standalone-${arch}-build/SimpleITK-superbuild/SimpleITK-build \
6060
-DSimpleITK_SOURCE_DIR:PATH=/work/standalone-${arch}-build/SimpleITK \

0 commit comments

Comments
 (0)