Skip to content

Commit d24dc0c

Browse files
authored
Merge pull request #242 from tbirdso/update-windows-download-script
ENH: Update Windows download and build script
2 parents 2df8737 + ac58a65 commit d24dc0c

1 file changed

Lines changed: 31 additions & 20 deletions

File tree

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,66 @@
1-
# Pulls build dependencies and build an ITK remote module.
1+
# -----------------------------------------------------------------------
2+
# Pull build dependencies and build an ITK external module.
3+
#
4+
# This script must be run in an x64 Developer Powershell.
5+
# See https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022#developer-powershell
6+
#
7+
# -----------------------------------------------------------------------
8+
# Positional parameters:
9+
# - 0th parameter: Python minor version.
10+
# For instance, for Python 3.11:
11+
#
12+
# > windows-download-cache-and-build-module-wheels.ps1 11
13+
#
14+
# -----------------------------------------------------------------------
15+
# Environment variables used in this script:
216
#
3-
# Variables to set before calling the script:
417
# - $env:ITK_PACKAGE_VERSION: Tag for ITKPythonBuilds build archive to use
518
# - $env:ITKPYTHONPACKAGE_TAG: Tag for ITKPythonPackage build scripts to use.
619
# If ITKPYTHONPACKAGE_TAG is empty then the default scripts distributed
720
# with the ITKPythonBuilds archive will be used.
821
# - $env:ITKPYTHONPACKAGE_ORG: Github organization or user to use for ITKPythonPackage
922
# build script source. Default is InsightSoftwareConsortium.
1023
# Ignored if ITKPYTHONPACKAGE_TAG is empty.
24+
#
1125

12-
trap { Write-Error $_; Exit 1 }
13-
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
14-
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
26+
$pythonArch = "64"
27+
$pythonVersion = "3.$($args[0])"
28+
echo "Pulling Python $pythonVersion-x$pythonArch"
29+
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
1530

16-
# Get ITKPythonBuilds archive with ITK build artifacts
17-
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
18-
if (-not (Test-Path env:APPVEYOR)) {
19-
$pythonArch = "64"
20-
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
21-
}
22-
if (-not (Test-Path env:ITK_PACKAGE_VERSION)) { $env:ITK_PACKAGE_VERSION = 'v5.3.0' }
31+
if (-not $env:ITK_PACKAGE_VERSION) { $env:ITK_PACKAGE_VERSION = 'v5.3.0' }
32+
echo "Fetching build archive $env:ITK_PACKAGE_VERSION"
2333
Invoke-WebRequest -Uri "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/$env:ITK_PACKAGE_VERSION/ITKPythonBuilds-windows.zip" -OutFile "ITKPythonBuilds-windows.zip"
24-
sz x ITKPythonBuilds-windows.zip -oC:\P -aoa -r
34+
7z x ITKPythonBuilds-windows.zip -oC:\P -aoa -r
2535

2636
# Optional: Update ITKPythonPackage build scripts
2737
if ($env:ITKPYTHONPACKAGE_TAG) {
28-
if(!$env:ITKPYTHONPACKAGE_ORG) {
38+
if(-not $env:ITKPYTHONPACKAGE_ORG) {
2939
$env:ITKPYTHONPACKAGE_ORG="InsightSoftwareConsortium"
3040
}
3141

32-
echo "Updating build scripts to ($env:ITKPYTHONPACKAGE_ORG)/ITKPythonPackage@($env:ITKPYTHONPACKAGE_TAG)"
42+
echo "Updating build scripts to $env:ITKPYTHONPACKAGE_ORG/ITKPythonPackage@$env:ITKPYTHONPACKAGE_TAG"
3343

3444
pushd C:\P
35-
git clone "https://github.com/($env:ITKPYTHONPACKAGE_ORG)/ITKPythonPackage.git" "IPP-tmp"
45+
git clone "https://github.com/$env:ITKPYTHONPACKAGE_ORG/ITKPythonPackage.git" "IPP-tmp"
3646
pushd "IPP-tmp"
37-
git checkout "($env:ITKPYTHONPACKAGE_TAG)"
47+
git checkout "$env:ITKPYTHONPACKAGE_TAG"
3848
git status
3949
popd
4050

4151
Remove-Item -Recurse -Force IPP/scripts/
4252
Copy-Item -Recurse IPP-tmp/scripts IPP/
53+
Copy-Item IPP-tmp/requirements-dev.txt IPP/
4354
Remove-Item -Recurse -Force IPP-tmp/
4455
popd
4556
}
4657

4758
# Get other build dependencies
4859
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -OutFile "doxygen-1.8.11.windows.bin.zip"
49-
sz x doxygen-1.8.11.windows.bin.zip -oC:\P\doxygen -aoa -r
60+
7z x doxygen-1.8.11.windows.bin.zip -oC:\P\doxygen -aoa -r
5061
Invoke-WebRequest -Uri "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -OutFile "grep-win.zip"
51-
sz x grep-win.zip -oC:\P\grep -aoa -r
62+
7z x grep-win.zip -oC:\P\grep -aoa -r
5263
$env:Path += ";C:\P\grep"
5364

5465
# Run build scripts
55-
C:\Python37-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py
66+
& "C:\Python$pythonVersion-x$pythonArch\python.exe" C:\P\IPP\scripts\windows_build_module_wheels.py --no-cleanup --py-envs "3$($args[0])-x64"

0 commit comments

Comments
 (0)