| 
 | 1 | +:: EXPECTED ENV VARS: PYTHON_ARCH (either x86 or x64)  | 
 | 2 | +::                    CONDA_PY (either 27, 33, 35 etc. - only major version is extracted)  | 
 | 3 | +::  | 
 | 4 | +::  | 
 | 5 | +:: To build extensions for 64 bit Python 3, we need to configure environment  | 
 | 6 | +:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:  | 
 | 7 | +:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)  | 
 | 8 | +::  | 
 | 9 | +:: To build extensions for 64 bit Python 2, we need to configure environment  | 
 | 10 | +:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:  | 
 | 11 | +:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)  | 
 | 12 | +::  | 
 | 13 | +:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific  | 
 | 14 | +:: environment configurations.  | 
 | 15 | +::  | 
 | 16 | +:: Note: this script needs to be run with the /E:ON and /V:ON flags for the  | 
 | 17 | +:: cmd interpreter, at least for (SDK v7.0)  | 
 | 18 | +::  | 
 | 19 | +:: More details at:  | 
 | 20 | +:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows  | 
 | 21 | +:: http://stackoverflow.com/a/13751649/163740  | 
 | 22 | +::  | 
 | 23 | +:: Author: Phil Elson  | 
 | 24 | +:: Original Author: Olivier Grisel (https://github.com/ogrisel/python-appveyor-demo)  | 
 | 25 | +:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/  | 
 | 26 | +::  | 
 | 27 | +:: Notes about batch files for Python people:  | 
 | 28 | +::  | 
 | 29 | +:: Quotes in values are literally part of the values:  | 
 | 30 | +::      SET FOO="bar"  | 
 | 31 | +:: FOO is now five characters long: " b a r "  | 
 | 32 | +:: If you don't want quotes, don't include them on the right-hand side.  | 
 | 33 | +::  | 
 | 34 | +:: The CALL lines at the end of this file look redundant, but if you move them  | 
 | 35 | +:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y  | 
 | 36 | +:: case, I don't know why.  | 
 | 37 | +:: originally from https://github.com/pelson/Obvious-CI/blob/master/scripts/obvci_appveyor_python_build_env.cmd  | 
 | 38 | +@ECHO OFF  | 
 | 39 | + | 
 | 40 | +SET COMMAND_TO_RUN=%*  | 
 | 41 | +SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows  | 
 | 42 | + | 
 | 43 | +:: Extract the major and minor versions, and allow for the minor version to be  | 
 | 44 | +:: more than 9.  This requires the version number to have two dots in it.  | 
 | 45 | +SET MAJOR_PYTHON_VERSION=%CONDA_PY:~0,1%  | 
 | 46 | + | 
 | 47 | +IF "%CONDA_PY:~2,1%" == "" (  | 
 | 48 | +    :: CONDA_PY style, such as 27, 34 etc.  | 
 | 49 | +    SET MINOR_PYTHON_VERSION=%CONDA_PY:~1,1%  | 
 | 50 | +) ELSE (  | 
 | 51 | +    IF "%CONDA_PY:~3,1%" == "." (  | 
 | 52 | +     SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,1%  | 
 | 53 | +    ) ELSE (  | 
 | 54 | +     SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,2%  | 
 | 55 | +    )  | 
 | 56 | +)  | 
 | 57 | + | 
 | 58 | +:: Based on the Python version, determine what SDK version to use, and whether  | 
 | 59 | +:: to set the SDK for 64-bit.  | 
 | 60 | +IF %MAJOR_PYTHON_VERSION% == 2 (  | 
 | 61 | +    SET WINDOWS_SDK_VERSION="v7.0"  | 
 | 62 | +    SET SET_SDK_64=Y  | 
 | 63 | +) ELSE (  | 
 | 64 | +    IF %MAJOR_PYTHON_VERSION% == 3 (  | 
 | 65 | +        SET WINDOWS_SDK_VERSION="v7.1"  | 
 | 66 | +        IF %MINOR_PYTHON_VERSION% LEQ 4 (  | 
 | 67 | +            SET SET_SDK_64=Y  | 
 | 68 | +        ) ELSE (  | 
 | 69 | +            SET SET_SDK_64=N  | 
 | 70 | +        )  | 
 | 71 | +    ) ELSE (  | 
 | 72 | +        ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"  | 
 | 73 | +        EXIT /B 1  | 
 | 74 | +    )  | 
 | 75 | +)  | 
 | 76 | + | 
 | 77 | +IF "%PYTHON_ARCH%"=="64" (  | 
 | 78 | +    IF %SET_SDK_64% == Y (  | 
 | 79 | +        ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture  | 
 | 80 | +        SET DISTUTILS_USE_SDK=1  | 
 | 81 | +        SET MSSdk=1  | 
 | 82 | +        "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%  | 
 | 83 | +        "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release  | 
 | 84 | +        ECHO Executing: %COMMAND_TO_RUN%  | 
 | 85 | +        call %COMMAND_TO_RUN% || EXIT /B 1  | 
 | 86 | +    ) ELSE (  | 
 | 87 | +        ECHO Using default MSVC build environment for 64 bit architecture  | 
 | 88 | +        ECHO Executing: %COMMAND_TO_RUN%  | 
 | 89 | +        call %COMMAND_TO_RUN% || EXIT /B 1  | 
 | 90 | +    )  | 
 | 91 | +) ELSE (  | 
 | 92 | +    ECHO Using default MSVC build environment for 32 bit architecture  | 
 | 93 | +    ECHO Executing: %COMMAND_TO_RUN%  | 
 | 94 | +    call %COMMAND_TO_RUN% || EXIT /B 1  | 
 | 95 | +)  | 
0 commit comments