|
| 1 | +====================================== |
| 2 | +Automated wheels building with scripts |
| 3 | +====================================== |
| 4 | + |
| 5 | +Steps required to build wheels on Linux, MacOSX and Windows have been automated. The following sections outline how to use the associated scripts. |
| 6 | + |
| 7 | +Linux |
| 8 | +----- |
| 9 | + |
| 10 | +On any linux distribution with docker and bash installed, running the script dockcross-manylinux-build-wheels.sh will create 64-bit wheels for both python 2.x and python 3.x in the dist directory. |
| 11 | + |
| 12 | +For example:: |
| 13 | + |
| 14 | + $ git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git |
| 15 | + [...] |
| 16 | + |
| 17 | + $ ./scripts/dockcross-manylinux-build-wheels.sh |
| 18 | + [...] |
| 19 | + |
| 20 | + $ ls -1 dist/ |
| 21 | + itk-4.11.0.dev20170218-cp27-cp27m-manylinux1_x86_64.whl |
| 22 | + itk-4.11.0.dev20170218-cp27-cp27mu-manylinux1_x86_64.whl |
| 23 | + itk-4.11.0.dev20170218-cp34-cp34m-manylinux1_x86_64.whl |
| 24 | + itk-4.11.0.dev20170218-cp35-cp35m-manylinux1_x86_64.whl |
| 25 | + itk-4.11.0.dev20170218-cp36-cp36m-manylinux1_x86_64.whl |
| 26 | + |
| 27 | +MacOSX |
| 28 | +------ |
| 29 | + |
| 30 | +First install the Python.org MacOSX Python's. This step requires sudo:: |
| 31 | + |
| 32 | + ./scripts/macpython-install-python.sh |
| 33 | + |
| 34 | + |
| 35 | +Then, build the wheels:: |
| 36 | + |
| 37 | + $ ./scripts/macpython-build-wheels.sh |
| 38 | + [...] |
| 39 | + |
| 40 | + $ ls -1 dist/ |
| 41 | + itk-4.11.0.dev20170213-cp27-cp27m-macosx_10_6_x86_64.whl |
| 42 | + itk-4.11.0.dev20170213-cp34-cp34m-macosx_10_6_x86_64.whl |
| 43 | + itk-4.11.0.dev20170213-cp35-cp35m-macosx_10_6_x86_64.whl |
| 44 | + itk-4.11.0.dev20170213-cp36-cp36m-macosx_10_6_x86_64.whl |
| 45 | + |
| 46 | +Windows |
| 47 | +------- |
| 48 | + |
| 49 | +First, install Microsoft Visual C++ Compiler for Python 2.7, Visual Studio 2015, Git, and CMake, which should be added to the system PATH environmental variable. |
| 50 | + |
| 51 | +Open a PowerShell terminal as Administrator, and install Python:: |
| 52 | + |
| 53 | + PS C:\> Set-ExecutionPolicy Unrestricted |
| 54 | + PS C:\> iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1')) |
| 55 | + |
| 56 | +In a PowerShell prompt:: |
| 57 | + |
| 58 | + PS C:\Windows> cd C:\ |
| 59 | + PS C:\> git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git IPP |
| 60 | + PS C:\> cd IPP |
| 61 | + PS C:\IPP> .\scripts\windows-build-wheels.ps1 |
| 62 | + [...] |
| 63 | + |
| 64 | + PS C:\IPP> ls dist |
| 65 | + Directory: C:\IPP\dist |
| 66 | + |
| 67 | + |
| 68 | + Mode LastWriteTime Length Name |
| 69 | + ---- ------------- ------ ---- |
| 70 | + -a---- 4/9/2017 5:21 PM 59435508 itk-4.11.0.dev20170407-cp27-cp27m-win_amd64.whl |
| 71 | + -a---- 4/9/2017 11:14 PM 63274441 itk-4.11.0.dev20170407-cp35-cp35m-win_amd64.whl |
| 72 | + -a---- 4/10/2017 2:08 AM 63257220 itk-4.11.0.dev20170407-cp36-cp36m-win_amd64.whl |
| 73 | + |
| 74 | +We need to work in a short directory to avoid path length limitations on Windows, so the repository is cloned into C:\IPP. Also, it is very important to disable antivirus checking on the C:\IPP directory. Otherwise, the build system conflicts with the antivirus when many files are created and deleted quickly, which can result in Access Denied errors. Windows 10 ships with an antivirus application, Windows Defender, that is enabled by default. |
| 75 | + |
| 76 | +sdist |
| 77 | +----- |
| 78 | + |
| 79 | +To create source distributions, sdist's, that will be used by pip to compile a wheel for installation if a binary wheel is not available for the current Python version or platform:: |
| 80 | + |
| 81 | + $ python setup.py sdist --formats=gztar,zip |
| 82 | + [...] |
| 83 | + |
| 84 | + $ ls -1 dist/ |
| 85 | + itk-4.11.0.dev20170216.tar.gz |
| 86 | + itk-4.11.0.dev20170216.zip |
0 commit comments