Skip to content

Commit 69d6590

Browse files
committed
Merge branch 'master' into release
2 parents dccd66d + c1700b7 commit 69d6590

10 files changed

+90
-37
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ venvs
1010
venv-*
1111
ITK-*
1212
libpython-not-needed-symbols-exported-by-interpreter
13+
tools/
1314

1415
# Python
1516
*.py[cod]

CMakeLists.txt

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ if(ITKPythonPackage_SUPERBUILD)
7373
include(ExternalProject)
7474

7575
set(ITK_REPOSITORY "https://github.com/InsightSoftwareConsortium/ITK.git")
76-
# ITK nightly-master 2018-09-05
77-
set(ITK_GIT_TAG "v5.0b01")
76+
# ITK nightly-master 2018-12-17
77+
set(ITK_GIT_TAG "0cdb1dd5b3")
7878

7979
#-----------------------------------------------------------------------------
8080
# A separate project is used to download ITK, so that it can reused
@@ -153,6 +153,30 @@ if(ITKPythonPackage_SUPERBUILD)
153153
message(STATUS "SuperBuild - Searching for python[OK]")
154154
message(STATUS "SuperBuild - DOXYGEN_EXECUTABLE: ${DOXYGEN_EXECUTABLE}")
155155

156+
# CMake configuration variables to pass to ITK's build
157+
set(ep_itk_cmake_cache_args "")
158+
foreach(var
159+
BUILD_SHARED_LIBS
160+
ITK_BUILD_DEFAULT_MODULES
161+
)
162+
if(DEFINED ${var})
163+
list(APPEND ep_itk_cmake_cache_args "-D${var}=${${var}}")
164+
endif()
165+
endforeach()
166+
function(cached_variables RESULTVAR PATTERN)
167+
get_cmake_property(variables CACHE_VARIABLES)
168+
set(result)
169+
foreach(variable ${variables})
170+
if(${variable} AND variable MATCHES "${PATTERN}")
171+
list(APPEND result "-D${variable}=${${variable}}")
172+
endif()
173+
endforeach()
174+
set(${RESULTVAR} ${result} PARENT_SCOPE)
175+
endfunction()
176+
cached_variables(itk_pattern_cached_vars "^(ITK_WRAP_)|(ITKGroup_)|(Module_)")
177+
list(APPEND ep_itk_cmake_cache_args ${itk_pattern_cached_vars})
178+
# Todo, also pass all Module_* variables
179+
message(STATUS "ITK CMake Cache Args - ${ep_itk_cmake_cache_args}")
156180
#-----------------------------------------------------------------------------
157181
# ITK: This project builds ITK and associated Python modules
158182

@@ -182,7 +206,11 @@ if(ITKPythonPackage_SUPERBUILD)
182206
SOURCE_DIR ${ITK_SOURCE_DIR}
183207
BINARY_DIR ${ITK_BINARY_DIR}
184208
PREFIX "ITKp"
209+
<<<<<<< HEAD
185210
CMAKE_CACHE_ARGS
211+
=======
212+
CMAKE_ARGS
213+
>>>>>>> master
186214
-DBUILD_TESTING:BOOL=OFF
187215
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
188216
-DPY_SITE_PACKAGES_PATH:PATH=${CMAKE_INSTALL_PREFIX}
@@ -198,6 +226,7 @@ if(ITKPythonPackage_SUPERBUILD)
198226
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
199227
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}
200228
${ep_common_cmake_cache_args}
229+
${ep_itk_cmake_cache_args}
201230
USES_TERMINAL_DOWNLOAD 1
202231
USES_TERMINAL_UPDATE 1
203232
USES_TERMINAL_CONFIGURE 1

docs/Build_ITK_Python_packages.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ Here are the steps:
129129
- Build "flavor" of package using::
130130

131131
python setup.py bdist_wheel -- \
132-
-DITK_SOURCE_DIR:PATH=/path/to/ITKPythonPackage-core-build/ITK-source
132+
-DITK_SOURCE_DIR:PATH=/path/to/ITKPythonPackage-core-build/ITKs

itkVersion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = '5.0b1'
1+
VERSION = '5.0b01.dev20181217+563.g0cdb1dd5b3'
22

33
def get_versions():
44
"""Returns versions for the ITK Python package.

scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
# This module should be pulled and run from an ITKModule root directory to generate the Linux python wheels of this module,
44
# it is used by the circle.yml file contained in ITKModuleTemplate: https://github.com/InsightSoftwareConsortium/ITKModuleTemplate
55

6-
wget -L https://data.kitware.com/api/v1/file/592dd8068d777f16d01e1a92/download -O zstd-1.2.0-linux.tar.gz
6+
curl https://data.kitware.com/api/v1/file/592dd8068d777f16d01e1a92/download -o zstd-1.2.0-linux.tar.gz
77
gunzip -d zstd-1.2.0-linux.tar.gz
88
tar xf zstd-1.2.0-linux.tar
99

10-
curl -L https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.0a02}/ITKPythonBuilds-linux.tar.zst -O
10+
curl -L https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.0b01}/ITKPythonBuilds-linux.tar.zst -O
1111
./zstd-1.2.0-linux/bin/unzstd ITKPythonBuilds-linux.tar.zst -o ITKPythonBuilds-linux.tar
1212
tar xf ITKPythonBuilds-linux.tar
1313

1414
mkdir tools
15-
wget -L http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.linux.bin.tar.gz -O doxygen-1.8.11.linux.bin.tar.gz
15+
curl https://data.kitware.com/api/v1/file/5c0aa4b18d777f2179dd0a71/download -o doxygen-1.8.11.linux.bin.tar.gz
1616
tar -xvzf doxygen-1.8.11.linux.bin.tar.gz -C tools
1717

1818
./ITKPythonPackage/scripts/dockcross-manylinux-build-module-wheels.sh

scripts/internal/manylinux-build-wheels.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ source "${script_dir}/manylinux-build-common.sh"
1212
# Install prerequirements
1313
mkdir -p /work/tools
1414
pushd /work/tools > /dev/null 2>&1
15-
wget -L http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.linux.bin.tar.gz -O doxygen-1.8.11.linux.bin.tar.gz
15+
curl https://data.kitware.com/api/v1/file/5c0aa4b18d777f2179dd0a71/download -o doxygen-1.8.11.linux.bin.tar.gz
1616
tar -xvzf doxygen-1.8.11.linux.bin.tar.gz
1717
popd > /dev/null 2>&1
1818
# -----------------------------------------------------------------------

scripts/internal/windows_build_common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ def venv_paths(python_version):
3131

3232
pip = os.path.join(venv_dir, "Scripts", "pip.exe")
3333

34-
ninja_executable = os.path.join(
35-
ROOT_DIR, "venv-35-x64", "Scripts", "ninja.exe")
34+
ninja_executable = os.path.join(venv_dir, "Scripts", "ninja.exe")
3635
print("NINJA_EXECUTABLE:%s" % ninja_executable)
3736

3837
# Update PATH

scripts/macpython-download-cache-and-build-module-wheels.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
brew update
77
brew install zstd aria2 gnu-tar doxygen
88
brew upgrade cmake
9-
aria2c -c --file-allocation=none -o ITKPythonBuilds-macosx.tar.zst -s 10 -x 10 https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.0a02}/ITKPythonBuilds-macosx.tar.zst
9+
aria2c -c --file-allocation=none -o ITKPythonBuilds-macosx.tar.zst -s 10 -x 10 https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${ITK_PACKAGE_VERSION:=v5.0b01}/ITKPythonBuilds-macosx.tar.zst
1010
unzstd ITKPythonBuilds-macosx.tar.zst -o ITKPythonBuilds-macosx.tar
1111
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
1212
tar xf ITKPythonBuilds-macosx.tar --checkpoint=10000 --checkpoint-action=dot
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
trap { Write-Error $_; Exit 1 }
2+
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
3+
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
24

35
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
4-
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
5-
if (-not (Test-Path env:ITK_PACKAGE_VERSION)) { $env:ITK_PACKAGE_VERSION = 'v5.0a02' }
6+
if (-not (Test-Path env:APPVEYOR)) { iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1')) }
7+
if (-not (Test-Path env:ITK_PACKAGE_VERSION)) { $env:ITK_PACKAGE_VERSION = 'v5.0b01' }
68
Invoke-WebRequest -Uri "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/$env:ITK_PACKAGE_VERSION/ITKPythonBuilds-windows.zip" -OutFile "ITKPythonBuilds-windows.zip"
79
sz x ITKPythonBuilds-windows.zip -oC:\P -aoa -r
8-
Invoke-WebRequest -Uri "http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.windows.bin.zip" -OutFile "doxygen-1.8.11.windows.bin.zip"
10+
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -OutFile "doxygen-1.8.11.windows.bin.zip"
911
sz x doxygen-1.8.11.windows.bin.zip -oC:\P\doxygen -aoa -r
10-
Invoke-WebRequest -Uri "https://midas3.kitware.com/midas/download/bitstream/462235/grep-win.zip" -OutFile "grep-win.zip"
12+
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -OutFile "grep-win.zip"
1113
sz x grep-win.zip -oC:\P\grep -aoa -r
1214
$env:Path += ";C:\P\grep"
1315
C:\Python35-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py

scripts/windows_build_wheels.py

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#!/usr/bin/env python
12

3+
import argparse
24
import glob
35
import json
46
import os
@@ -104,7 +106,8 @@ def build_wrapped_itk(
104106

105107

106108
def build_wheel(python_version, single_wheel=False,
107-
cleanup=False, wheel_names=None):
109+
cleanup=False, wheel_names=None,
110+
cmake_options=[]):
108111

109112
python_executable, \
110113
python_include_dir, \
@@ -148,8 +151,9 @@ def build_wheel(python_version, single_wheel=False,
148151
"-DITK_BINARY_DIR:PATH=%s" % build_path,
149152
"-DPYTHON_EXECUTABLE:FILEPATH=%s" % python_executable,
150153
"-DPYTHON_INCLUDE_DIR:PATH=%s" % python_include_dir,
151-
"-DPYTHON_LIBRARY:FILEPATH=%s" % python_library
152-
])
154+
"-DPYTHON_LIBRARY:FILEPATH=%s" % python_library,
155+
"-DDOXYGEN_EXECUTABLE:FILEPATH=C:/P/doxygen/doxygen.exe",
156+
] + cmake_options)
153157
# Cleanup
154158
check_call([python_executable, "setup.py", "clean"])
155159

@@ -189,7 +193,7 @@ def build_wheel(python_version, single_wheel=False,
189193
"-DPYTHON_EXECUTABLE:FILEPATH=%s" % python_executable,
190194
"-DPYTHON_INCLUDE_DIR:PATH=%s" % python_include_dir,
191195
"-DPYTHON_LIBRARY:FILEPATH=%s" % python_library
192-
])
196+
] + cmake_options)
193197

194198
# Cleanup
195199
if cleanup:
@@ -215,24 +219,35 @@ def fixup_wheels():
215219
fixup_wheel(wheel)
216220

217221

218-
def test_wheels(single_wheel=False):
222+
def test_wheels(python_env):
223+
(
224+
python_executable,
225+
python_include_dir,
226+
python_library,
227+
pip,
228+
ninja_executable,
229+
path
230+
) = venv_paths(python_env)
231+
check_call([pip, 'install', 'itk', '--no-cache-dir', '--no-index',
232+
'-f', 'dist'])
233+
print('Wheel successfully installed.')
219234
check_call([
220235
python_executable,
221236
os.path.join(ROOT_DIR, "docs/code/testDriver.py")
222237
])
238+
print('Documentation tests passed.')
223239

224240

225241
def build_wheels(py_envs=DEFAULT_PY_ENVS, single_wheel=False,
226-
cleanup=False, wheel_names=None):
242+
cleanup=False, wheel_names=None, cmake_options=[]):
227243

228-
prepare_build_env("35-x64")
229-
prepare_build_env("36-x64")
230-
prepare_build_env("37-x64")
244+
for py_env in py_envs:
245+
prepare_build_env(py_env)
231246

232247
with push_dir(directory=STANDALONE_DIR, make_directory=True):
233248

234249
cmake_executable = "cmake.exe"
235-
tools_venv = os.path.join(ROOT_DIR, "venv-35-x64")
250+
tools_venv = os.path.join(ROOT_DIR, "venv-" + py_envs[0])
236251
pip_install(tools_venv, "ninja")
237252
ninja_executable = os.path.join(tools_venv, "Scripts", "ninja.exe")
238253

@@ -249,19 +264,26 @@ def build_wheels(py_envs=DEFAULT_PY_ENVS, single_wheel=False,
249264

250265
# Compile wheels re-using standalone project and archive cache
251266
for py_env in py_envs:
252-
build_wheel(
253-
py_env, single_wheel=single_wheel,
254-
cleanup=cleanup, wheel_names=wheel_names)
255-
256-
257-
def main(py_envs=DEFAULT_PY_ENVS, wheel_names=None, cleanup=True):
258-
single_wheel = False
259-
260-
build_wheels(
261-
single_wheel=single_wheel, cleanup=cleanup,
262-
py_envs=py_envs, wheel_names=wheel_names)
267+
build_wheel(py_env, single_wheel=single_wheel,
268+
cleanup=cleanup, wheel_names=wheel_names,
269+
cmake_options=cmake_options)
270+
271+
272+
def main(wheel_names=None):
273+
parser = argparse.ArgumentParser(description='Driver script to build ITK Python wheels.')
274+
parser.add_argument('--single-wheel', action='store_true', help='Build a single wheel as opposed to one wheel per ITK module group.')
275+
parser.add_argument('--py-envs', nargs='+', default=DEFAULT_PY_ENVS,
276+
help='Target Python environment versions, e.g. "37-x64".')
277+
parser.add_argument('--no-cleanup', dest='cleanup', action='store_false', help='Do not clean up temporary build files.')
278+
parser.add_argument('cmake_options', nargs='*', help='Extra options to pass to CMake, e.g. -DBUILD_SHARED_LIBS:BOOL=OFF')
279+
args = parser.parse_args()
280+
281+
build_wheels(single_wheel=args.single_wheel, cleanup=args.cleanup,
282+
py_envs=args.py_envs, wheel_names=wheel_names,
283+
cmake_options=args.cmake_options)
263284
fixup_wheels()
264-
test_wheels(single_wheel=single_wheel)
285+
for py_env in args.py_envs:
286+
test_wheels(py_env)
265287

266288

267289
if __name__ == "__main__":

0 commit comments

Comments
 (0)