|
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: |
2 | 16 | # |
3 | | -# Variables to set before calling the script: |
4 | 17 | # - $env:ITK_PACKAGE_VERSION: Tag for ITKPythonBuilds build archive to use |
5 | 18 | # - $env:ITKPYTHONPACKAGE_TAG: Tag for ITKPythonPackage build scripts to use. |
6 | 19 | # If ITKPYTHONPACKAGE_TAG is empty then the default scripts distributed |
7 | 20 | # with the ITKPythonBuilds archive will be used. |
8 | 21 | # - $env:ITKPYTHONPACKAGE_ORG: Github organization or user to use for ITKPythonPackage |
9 | 22 | # build script source. Default is InsightSoftwareConsortium. |
10 | 23 | # Ignored if ITKPYTHONPACKAGE_TAG is empty. |
| 24 | +# |
11 | 25 |
|
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')) |
15 | 30 |
|
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" |
23 | 33 | 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 |
25 | 35 |
|
26 | 36 | # Optional: Update ITKPythonPackage build scripts |
27 | 37 | if ($env:ITKPYTHONPACKAGE_TAG) { |
28 | | - if(!$env:ITKPYTHONPACKAGE_ORG) { |
| 38 | + if(-not $env:ITKPYTHONPACKAGE_ORG) { |
29 | 39 | $env:ITKPYTHONPACKAGE_ORG="InsightSoftwareConsortium" |
30 | 40 | } |
31 | 41 |
|
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" |
33 | 43 |
|
34 | 44 | 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" |
36 | 46 | pushd "IPP-tmp" |
37 | | - git checkout "($env:ITKPYTHONPACKAGE_TAG)" |
| 47 | + git checkout "$env:ITKPYTHONPACKAGE_TAG" |
38 | 48 | git status |
39 | 49 | popd |
40 | 50 |
|
41 | 51 | Remove-Item -Recurse -Force IPP/scripts/ |
42 | 52 | Copy-Item -Recurse IPP-tmp/scripts IPP/ |
| 53 | + Copy-Item IPP-tmp/requirements-dev.txt IPP/ |
43 | 54 | Remove-Item -Recurse -Force IPP-tmp/ |
44 | 55 | popd |
45 | 56 | } |
46 | 57 |
|
47 | 58 | # Get other build dependencies |
48 | 59 | 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 |
50 | 61 | 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 |
52 | 63 | $env:Path += ";C:\P\grep" |
53 | 64 |
|
54 | 65 | # 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