Skip to content

Commit df0ca57

Browse files
author
Simon Rit
committed
ENH: Name and type command line options of Windows module PowerShell script
1 parent f91e868 commit df0ca57

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

scripts/windows-download-cache-and-build-module-wheels.ps1

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@
66
#
77
# -----------------------------------------------------------------------
88
# Positional parameters:
9-
# - 0th parameter: Python minor version.
9+
# - 0th parameter or -python_version_minor option: Python minor version.
1010
# For instance, for Python 3.11:
11-
#
1211
# > windows-download-cache-and-build-module-wheels.ps1 11
12+
# or equivalently:
13+
# > windows-download-cache-and-build-module-wheels.ps1 -python_version_minor 11
14+
#
15+
# - 1st parameter or -setup_options: setup.py options.
16+
# For instance, for Python 3.11, excluding nvcuda.dll during packaging:
17+
# > windows-download-cache-and-build-module-wheels.ps1 11 "--exclude-libs nvcuda.dll"
18+
# or equivalently:
19+
# > windows-download-cache-and-build-module-wheels.ps1 -python_version_minor 11 -setup_options "--exclude-libs nvcuda.dll"
1320
#
14-
# - other parameters are passed to setup.py. If one of the parameters is "--",
15-
# the following parameters will be passed to cmake.
21+
# - 2nd parameter or -cmake_options: CMake options passed to setup.py for project configuration.
1622
# For instance, for Python 3.11, excluding nvcuda.dll during packaging
1723
# and setting RTK_USE_CUDA ON during configuration:
18-
#
19-
# > windows-download-cache-and-build-module-wheels.ps1 11 --exclude-libs nvcuda.dll "--" -DRTK_USE_CUDA:BOOL=ON
24+
# > windows-download-cache-and-build-module-wheels.ps1 11 "--exclude-libs nvcuda.dll" "-DRTK_USE_CUDA:BOOL=ON"
25+
# or equivalently:
26+
# > windows-download-cache-and-build-module-wheels.ps1 -python_version_minor 11 -setup_options "--exclude-libs nvcuda.dll" -cmake-options "-DRTK_USE_CUDA:BOOL=ON"
2027
#
2128
#
2229
# -----------------------------------------------------------------------
@@ -37,9 +44,14 @@
3744
# For instance, `export ITK_MODULE_PREQ=InsightSoftwareConsortium/[email protected]`
3845
#
3946
########################################################################
47+
param (
48+
[int]$python_version_minor,
49+
[string]$setup_options,
50+
[string]$cmake_options
51+
)
4052

4153
$pythonArch = "64"
42-
$pythonVersion = "3.$($args[0])"
54+
$pythonVersion = "3.$python_version_minor"
4355
echo "Pulling Python $pythonVersion-x$pythonArch"
4456
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
4557

@@ -87,15 +99,14 @@ if (-not (Test-Path grep-win.zip)) {
8799
$env:Path += ";C:\P\grep"
88100

89101
# Build ITK module dependencies, if any
90-
$build_command = "& `"C:\Python$pythonVersion-x$pythonArch\python.exe`" `"C:\P\IPP\scripts\windows_build_module_wheels.py`" --no-cleanup --py-envs `"3$($args[0])-x64`""
91-
foreach ($arg in $args[1..$args.length]) {
92-
if ($arg.substring(0,2) -eq "--") {
93-
$build_command = "$build_command $($arg)"
94-
}
95-
else {
96-
$build_command = "$build_command `"$($arg)`""
97-
}
102+
$build_command = "& `"C:\Python$pythonVersion-x$pythonArch\python.exe`" `"C:\P\IPP\scripts\windows_build_module_wheels.py`" --no-cleanup --py-envs `"3$python_version_minor-x64`""
103+
if ("$setup_options".length -gt 0) {
104+
$build_command = "$build_command $setup_options"
105+
}
106+
if("$cmake_options".length -gt 0) {
107+
$build_command = "$build_command -- ""$cmake_options"""
98108
}
109+
echo $build_command
99110

100111
echo "ITK_MODULE_PREQ: $env:ITK_MODULE_PREQ $ITK_MODULE_PREQ"
101112
if ($env:ITK_MODULE_PREQ) {

0 commit comments

Comments
 (0)