From 0f33da4a1b8a5773afe28be5caa55f3988390feb Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Wed, 28 Oct 2015 22:32:19 -0500 Subject: [PATCH] Possible fix for Python 3.5 x64 builds (#126) See https://github.com/ogrisel/python-appveyor-demo/commit/09a1c8672e --- appveyor.yml | 1 + scripts/win_wrapper.cmd | 51 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index aa9aa9e..6b8fb30 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -54,6 +54,7 @@ environment: PYTHON_ARCH: "64" install: + - "%PIP% install --disable-pip-version-check --upgrade pip" - "%PIP% install wheel twine" build_script: diff --git a/scripts/win_wrapper.cmd b/scripts/win_wrapper.cmd index 13a4b1f..b469edd 100644 --- a/scripts/win_wrapper.cmd +++ b/scripts/win_wrapper.cmd @@ -21,23 +21,46 @@ SET COMMAND_TO_RUN=%* SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows +SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf -SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" -IF %MAJOR_PYTHON_VERSION% == "2" ( - SET WINDOWS_SDK_VERSION="v7.0" -) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( - SET WINDOWS_SDK_VERSION="v7.1" +:: Extract the major and minor versions, and allow for the minor version to be +:: more than 9. This requires the version number to have two dots in it. +SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1% +IF "%PYTHON_VERSION:~3,1%" == "." ( + SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1% ) ELSE ( - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" - EXIT 1 + SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2% ) -IF "%PYTHON_ARCH%"=="64" ( - SET DISTUTILS_USE_SDK=1 - SET MSSdk=1 - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release - call %COMMAND_TO_RUN% || EXIT 1 +:: Based on the Python version, determine what SDK version to use, and whether +:: to set the SDK for 64-bit. +IF %MAJOR_PYTHON_VERSION% == 2 ( + SET WINDOWS_SDK_VERSION="v7.0" + SET SET_SDK_64=Y ) ELSE ( - call %COMMAND_TO_RUN% || EXIT 1 + IF %MAJOR_PYTHON_VERSION% == 3 ( + SET WINDOWS_SDK_VERSION="v7.1" + IF %MINOR_PYTHON_VERSION% LEQ 4 ( + SET SET_SDK_64=Y + ) ELSE ( + SET SET_SDK_64=N + IF EXIST "%WIN_WDK%" ( + :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ + REN "%WIN_WDK%" 0wdf + ) + ) + ) ELSE ( + ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" + EXIT 1 + ) +) + +IF %PYTHON_ARCH% == 64 ( + IF %SET_SDK_64% == Y ( + SET DISTUTILS_USE_SDK=1 + SET MSSdk=1 + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release + ) ) +call %COMMAND_TO_RUN% || EXIT 1