Skip to content

Commit 03e4e22

Browse files
author
Stefan Behnel
committed
add build config for appveyor and travis
1 parent ffe9cc1 commit 03e4e22

File tree

4 files changed

+196
-0
lines changed

4 files changed

+196
-0
lines changed

.travis.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#env:
2+
# global:
3+
# - TWINE_USERNAME=scoder
4+
# # Note: TWINE_PASSWORD is set in Travis settings
5+
6+
language: python
7+
python:
8+
- "2.6"
9+
- "2.7"
10+
- "3.3"
11+
- "3.4"
12+
- "3.5"
13+
- "3.6"
14+
install:
15+
- pip install -r requirements-appveyor.txt tox-travis
16+
- python setup.py build_ext --inplace --with-cython
17+
script:
18+
- tox
19+
- python setup.py sdist bdist_wheel
20+
# the following is stolen from https://github.com/joerick/pyinstrument_cext/blob/master/.travis.yml
21+
# uncomment to push wheels automatically to pypi for tagged releases only (requires TWINE_PASSWORD to be set)
22+
# - |
23+
# if [[ $TRAVIS_TAG ]]; then
24+
# python -m pip install twine
25+
# python -m twine upload wheelhouse/*.whl
26+
# fi

appveyor.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# parts from
2+
# - matrix: https://github.com/pythonnet/pythonnet/blob/master/appveyor.yml
3+
# - Visual Studio 2010 py33 py34 on x64: https://github.com/ogrisel/python-appveyor-demo/blob/master/appveyor/run_with_env.cmd
4+
5+
branches:
6+
only:
7+
- /default/
8+
9+
platform:
10+
- x86
11+
- x64
12+
13+
environment:
14+
global:
15+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
16+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
17+
# See: http://stackoverflow.com/a/13751649/163740
18+
CMD_IN_ENV: 'cmd /E:ON /V:ON /C .\appveyor_env.cmd'
19+
20+
# CIBW_BEFORE_BUILD: python build_ext --with-cython --inplace
21+
# TWINE_USERNAME: scoder
22+
# Note: TWINE_PASSWORD is set in Appveyor settings
23+
24+
matrix:
25+
- PYTHON_VERSION: 2.7
26+
- PYTHON_VERSION: 3.4
27+
- PYTHON_VERSION: 3.5
28+
- PYTHON_VERSION: 3.6
29+
30+
init:
31+
- set PY_VER=%PYTHON_VERSION:.=%
32+
- set TOXENV=py%PY_VER%
33+
- set PYTHON=C:\PYTHON%PY_VER%
34+
- if %PLATFORM%==x64 (set PYTHON=%PYTHON%-x64)
35+
- set TOXPYTHON=%PYTHON%\python.exe
36+
37+
# Put desired Python version in PATH
38+
- set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
39+
40+
- 'ECHO %TOXENV% '
41+
- python --version
42+
43+
install:
44+
- ECHO 'Installed SDKs:'
45+
- ps: 'ls "C:/Program Files/Microsoft SDKs/Windows"'
46+
- pip install --upgrade pip
47+
- pip install -r requirements-appveyor.txt
48+
- python setup.py build_ext --inplace --with-cython
49+
50+
build: false # First tests then build (is python not C)
51+
52+
test_script:
53+
- tox -e %TOXENV%-windows
54+
55+
after_test:
56+
- pip install --upgrade wheel
57+
- python setup.py build_ext --inplace
58+
- rm -rf build # account for: https://bitbucket.org/pypa/wheel/issues/147/bdist_wheel-should-start-by-cleaning-up
59+
- python setup.py sdist bdist_wheel
60+
61+
artifacts:
62+
# bdist_wheel puts your built wheel in the dist directory
63+
- path: "wheelhouse\\*.whl"
64+
name: Wheels
65+
# Where in the appveyor cloud are the wheels pushed to?
66+
# https://www.appveyor.com/docs/packaging-artifacts/#permalink-to-the-last-successful-build-artifact
67+
# borrowed from https://github.com/joerick/pyinstrument_cext/blob/master/appveyor.yml#L11-L15
68+
# - ps: >-
69+
# if ($env:APPVEYOR_REPO_TAG -eq "true") {
70+
# python -m pip install twine
71+
# python -m twine upload (resolve-path wheelhouse\*.whl)
72+
# }
73+
74+
on_failure:
75+
- ps: dir "env:"
76+
- ps: get-content .tox\*\log\*

appveyor_env.cmd

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

requirements-appveyor.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tox
2+
pytest
3+
coverage
4+
cython==0.25.2
5+
codecov
6+
wheel

0 commit comments

Comments
 (0)