From fdf703667d5a25b6c27d838e26b043d304dfb144 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Tue, 25 Jan 2022 15:47:28 -0700 Subject: [PATCH 1/3] Update Mac version from 10.9 to 10.14. This is needed because of changes in the azure provided Python 3.8 for Mac. --- azure/posix.yml | 2 +- env_vars.sh | 2 +- env_vars_32.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure/posix.yml b/azure/posix.yml index c578ea6..4595c41 100644 --- a/azure/posix.yml +++ b/azure/posix.yml @@ -49,7 +49,7 @@ jobs: # Platform variables used in multibuild scripts if [ `uname` == 'Darwin' ]; then echo "##vso[task.setvariable variable=TRAVIS_OS_NAME]osx" - echo "##vso[task.setvariable variable=MACOSX_DEPLOYMENT_TARGET]10.9" + echo "##vso[task.setvariable variable=MACOSX_DEPLOYMENT_TARGET]10.14" else echo "##vso[task.setvariable variable=TRAVIS_OS_NAME]linux" fi diff --git a/env_vars.sh b/env_vars.sh index b1056ce..1a838b8 100644 --- a/env_vars.sh +++ b/env_vars.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Environment variables for build -MACOSX_DEPLOYMENT_TARGET=10.9 +MACOSX_DEPLOYMENT_TARGET=10.14 CFLAGS="-std=c99 -fno-strict-aliasing" # Macos's linker doesn't support stripping symbols if [ "$(uname)" != "Darwin" ]; then diff --git a/env_vars_32.sh b/env_vars_32.sh index 7136cea..1bba29e 100644 --- a/env_vars_32.sh +++ b/env_vars_32.sh @@ -3,7 +3,7 @@ # The important difference from the 64-bit build is `-msse2` to # compile sse loops for ufuncs. set -x -MACOSX_DEPLOYMENT_TARGET=10.9 +MACOSX_DEPLOYMENT_TARGET=10.14 # Fails test_umath.TestAVXUfuncs with reciprocal on Azure # CFLAGS="-msse2 -std=c99 -fno-strict-aliasing" From c6b496fcef4be1ab2e0e4575971c6c83f1207279 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 26 Jan 2022 16:48:54 +0000 Subject: [PATCH 2/3] Use 141 toolchain for Windows build (#146) * Use defined image windows-2019 latest image seems like a hostage to fortune. * Add, use script to set VS toolchain version * Unset Distutils SDK stuff before tests --- azure-pipelines.yml | 2 +- azure/set_vs_toolchain.cmd | 71 ++++++++++++++++++++++++++++++++++++++ azure/windows.yml | 9 +++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 azure/set_vs_toolchain.cmd diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a3a20d2..c751393 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,7 +17,7 @@ jobs: - template: azure/windows.yml parameters: name: "windows2019" - vmImage: "windows-latest" + vmImage: "windows-2019" timeoutInMinutes: 90 matrix: py_3.8_32: diff --git a/azure/set_vs_toolchain.cmd b/azure/set_vs_toolchain.cmd new file mode 100644 index 0000000..6ffb69f --- /dev/null +++ b/azure/set_vs_toolchain.cmd @@ -0,0 +1,71 @@ +@@echo on +REM set Visual Studio toolchain given bitness, VS year and toolchain number. +IF [%1] == [] GOTO NoArgErr +set VS_BITS=%1 +IF [%2] == [] GOTO NoArgErr +set VS_YEAR=%2 +IF [%3] == [] GOTO NoArgErr +set VS_TOOLCHAIN=%3 + + +REM Tools can come from any of Professional, Community, BuildTools or Enterprise install. +if not exist "%VSINSTALLDIR%" ( +set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Professional\" +) +if not exist "%VSINSTALLDIR%" ( +set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Community\" +) +if not exist "%VSINSTALLDIR%" ( +set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\BuildTools\" +) +if not exist "%VSINSTALLDIR%" ( +set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Enterprise\" +) + +REM Discover the latest Windows SDK available. +call :GetWin10SdkDir +:: dir /ON here is sorting the list of folders, such that we use the latest one that we have +for /F %%i in ('dir /ON /B "%WindowsSdkDir%\include\10.*"') DO ( + SET WindowsSDKVer=%%~i +) +if errorlevel 1 ( + echo "Didn't find any windows 10 SDK. I'm not sure if things will work, but let's try..." +) else ( + echo Windows SDK version found as: "%WindowsSDKVer%" +) + +REM Set bitness, toolchain version and SDK. +call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars%1.bat" -vcvars_ver=%VS_TOOLCHAIN% %WindowsSDKVer% +REM https://docs.python.org/3.9/distutils/apiref.html#module-distutils.msvccompiler +REM or +REM https://setuptools.pypa.io/en/latest/deprecated/distutils/apiref.html#module-distutils.msvccompiler +REM Force our SDK, rather than the Python was built with. +set DISTUTILS_USE_SDK=1 +set MSSdk=1 + +REM All done, finish here. +goto:eof + +REM Various subroutines. + +:GetWin10SdkDir +call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node > nul 2>&1 +if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node > nul 2>&1 +if errorlevel 1 call :GetWin10SdkDirHelper HKLM\SOFTWARE > nul 2>&1 +if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE > nul 2>&1 +if errorlevel 1 exit /B 1 +exit /B 0 + +:GetWin10SdkDirHelper +@@REM `Get Windows 10 SDK installed folder` +for /F "tokens=1,2*" %%i in ('reg query "%1\Microsoft\Microsoft SDKs\Windows\v10.0" /v "InstallationFolder"') DO ( + if "%%i"=="InstallationFolder" ( + SET WindowsSdkDir=%%~k + ) +) +exit /B 0 + +:NoArgErr +echo "Need to specify input bitness, VS year and toolchain number" +echo "e.g 64 2019 14.16" +exit 1 diff --git a/azure/windows.yml b/azure/windows.yml index f77f19f..9e5ab41 100644 --- a/azure/windows.yml +++ b/azure/windows.yml @@ -20,6 +20,13 @@ jobs: - checkout: self submodules: true + - task: BatchScript@1 + inputs: + filename: azure/set_vs_toolchain.cmd + arguments: $(BITS) 2019 14.16 + modifyEnvironment: True + displayName: Set VS toolchain version + - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) @@ -122,6 +129,8 @@ jobs: popd displayName: Build wheel - bash: | + # Undo use specify VS build tools. + unset DISTUTILS_USE_SDK MSSdk set -ex source extra_functions.sh source config.sh From d247757e81aa9991ac7c1cac13bd3548a6d74255 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 26 Jan 2022 20:13:54 +0000 Subject: [PATCH 3/3] Add conda-forge license note (#150) As suggested by @isuruf in https://github.com/MacPython/numpy-wheels/pull/146#discussion_r792910164 --- azure/set_vs_toolchain.cmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/azure/set_vs_toolchain.cmd b/azure/set_vs_toolchain.cmd index 6ffb69f..f6f2930 100644 --- a/azure/set_vs_toolchain.cmd +++ b/azure/set_vs_toolchain.cmd @@ -1,5 +1,12 @@ @@echo on REM set Visual Studio toolchain given bitness, VS year and toolchain number. + +REM Parts of this file copied from: +REM https://github.com/conda-forge/vc-feedstock/blob/7c0aa76218f369227d6a7fc78f981b100d68d50a/recipe/activate.bat +REM licensed as follows: +REM BSD-3-Clause +REM Copyright conda-forge contributors + IF [%1] == [] GOTO NoArgErr set VS_BITS=%1 IF [%2] == [] GOTO NoArgErr @@ -7,7 +14,6 @@ set VS_YEAR=%2 IF [%3] == [] GOTO NoArgErr set VS_TOOLCHAIN=%3 - REM Tools can come from any of Professional, Community, BuildTools or Enterprise install. if not exist "%VSINSTALLDIR%" ( set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Professional\"