appveyor: add script to set SDK vars for 64-bit py34 before running tox

Update appveyor.yml to follow the most recent recommendation from PyPA Packaging User Guide:
http://python-packaging-user-guide.readthedocs.org/en/latest/appveyor/

- set DISTUTILS_USE_SDK=1 only for Python34-x64. It seems like we no longer need to do that for Python2.7-x64;
  For more info check this: https://github.com/ogrisel/python-appveyor-demo/issues/39

- run tox using 'with-compiler.cmd' batch script so that Brotli extension can be built from git source with the correct MSVC and Windows SDK versions (btw, I wish brotli was on PyPI already so we could just `pip install brotli` and done!);

- define TOXPYTHON variable to make sure tox uses the correct python interpreter. Previously, in fact, the 'py34' toxenv was always picking up the 32-bit interpreter, even when we were testing the 64-bit Python 3.4 :(...

- add PowerShell command to enable 'rollout builds' feature, as done on 'python-appveyor-demo':
f54ec3593b/appveyor.yml (L81-L89)

- call pip via `python -m pip` to make sure we are running the just updated pip version, instead of Appveyor's pre-installed pip

- Remove unused stuff
This commit is contained in:
Cosimo Lupo 2016-04-10 15:34:57 +01:00
parent c6facc99df
commit 8bf3fd18c0
2 changed files with 58 additions and 22 deletions

View File

@ -1,53 +1,68 @@
environment: environment:
global:
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\.appveyor\\with-compiler.cmd"
matrix: matrix:
- PYTHON: "C:\\Python27" - JOB: "2.7.11 32-bit"
PYTHON_VERSION: "2.7.x" PYTHON_HOME: "C:\\Python27"
PYTHON_ARCH: "32"
TOXENV: "py27" TOXENV: "py27"
TOXPYTHON: "C:\\Python27\\python.exe"
- PYTHON: "C:\\Python34" - JOB: "3.4.3 32-bit"
PYTHON_VERSION: "3.4.x" PYTHON_HOME: "C:\\Python34"
PYTHON_ARCH: "32"
TOXENV: "py34" TOXENV: "py34"
TOXPYTHON: "C:\\Python34\\python.exe"
- PYTHON: "C:\\Python35" - JOB: "3.5.1 32-bit"
PYTHON_VERSION: "3.5.x" PYTHON_HOME: "C:\\Python35"
PYTHON_ARCH: "32"
TOXENV: "py35" TOXENV: "py35"
TOXPYTHON: "C:\\Python35\\python.exe"
- PYTHON: "C:\\Python27-x64" - JOB: "2.7.11 64-bit"
PYTHON_VERSION: "2.7.x" PYTHON_HOME: "C:\\Python27-x64"
PYTHON_ARCH: "64"
TOXENV: "py27" TOXENV: "py27"
TOXPYTHON: "C:\\Python27-x64\\python.exe"
- PYTHON: "C:\\Python34-x64" - JOB: "3.4.3 64-bit"
PYTHON_VERSION: "3.4.x" PYTHON_HOME: "C:\\Python34-x64"
PYTHON_ARCH: "64"
TOXENV: "py34" TOXENV: "py34"
TOXPYTHON: "C:\\Python34-x64\\python.exe"
DISTUTILS_USE_SDK: "1"
- PYTHON: "C:\\Python35-x64" - JOB: "3.5.1 64-bit"
PYTHON_VERSION: "3.5.x" PYTHON_HOME: "C:\\Python35-x64"
PYTHON_ARCH: "64"
TOXENV: "py35" TOXENV: "py35"
TOXPYTHON: "C:\\Python35-x64\\python.exe"
install: install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Prepend Python to the PATH of this build # Prepend Python to the PATH of this build
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%"
# check that we have the expected version and architecture for Python # check that we have the expected version and architecture for Python
- "python --version" - "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
# upgrade pip to avoid out-of-date warnings # upgrade pip to avoid out-of-date warnings
- "pip install --disable-pip-version-check --user --upgrade pip" - "python -m pip install --disable-pip-version-check --user --upgrade pip"
- "python -m pip --version"
# install the dependencies to run the tests # install the dependencies to run the tests
- "pip install -r dev-requirements.txt" - "%WITH_COMPILER% python -m pip install -r dev-requirements.txt"
build: false build: false
test_script: test_script:
- "tox" - "%WITH_COMPILER% tox"
notifications: notifications:
- provider: Email - provider: Email

View File

@ -0,0 +1,21 @@
@echo off
:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
IF "%DISTUTILS_USE_SDK%"=="1" (
ECHO Configuring environment to build with MSVC on a 64bit architecture
ECHO Using Windows SDK 7.1
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\WindowsSdkVer.exe" -q -version:v7.1
CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
SET MSSdk=1
REM Need the following to allow tox to see the SDK compiler
SET TOX_TESTENV_PASSENV=DISTUTILS_USE_SDK MSSdk INCLUDE LIB
) ELSE (
ECHO Using default MSVC build environment
)
CALL %*