Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

WIP: testing on windows and conda packages/ wheels for master #5604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Dec 4, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CI: test in windows and build packages
This builds windows conda packages and wheels for some python versions and
runs the tests on these python versions on windows. It uses the AppVeyor CI
servive and the packages are available as artefacts to download.

Appveyor based on
http://tjelvarolsson.com/blog/how-to-continuously-test-your-python-code-on-windows-using-appveyor/
https://packaging.python.org/en/latest/appveyor/
https://github.com/rmcgibbo/python-appveyor-conda-example

Conda stuff based on
https://github.com/conda/conda-recipes/tree/master/matplotlib

...and a lot of trial and error...
  • Loading branch information
jankatins committed Dec 3, 2015
commit 5a7e3b47816ee1abccc3cca6bb9a25bce8448cd6
107 changes: 107 additions & 0 deletions 107 appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# With infos from
# http://tjelvarolsson.com/blog/how-to-continuously-test-your-python-code-on-windows-using-appveyor/
# https://packaging.python.org/en/latest/appveyor/
# https://github.com/rmcgibbo/python-appveyor-conda-example

# Backslashes in quotes need to be escaped: \ -> "\\"

environment:

global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci\\appveyor\\run_with_env.cmd"

matrix:
- PYTHON: "C:\\Python34_64"
PYTHON_VERSION: "3.4"
PYTHON_ARCH: "64"
CONDA_PY: "34"
CONDA_NPY: "18"

- PYTHON: "C:\\Python27_64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
CONDA_PY: "27"
CONDA_NPY: "18"

- PYTHON: "C:\\Python27_32"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "32"
CONDA_PY: "27"
CONDA_NPY: "18"

# We always use a 64-bit machine, but can build x86 distributions
# with the PYTHON_ARCH variable (which is used by CMD_IN_ENV).
platform:
- x64

# all our python builds have to happen in tests_script...
build: false

init:
- "ECHO %PYTHON_VERSION% %PYTHON%"

install:
- powershell .\ci\appveyor\install.ps1
- SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
- cmd: conda config --set show_channel_urls yes
# for msinttypes
- cmd: conda config --add channels conda-forge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given you're already adding this, it would make some sense to rationalise the install and run_with_env code by using the ObviousCI version provided.

# this is now the downloaded conda...
- conda info -a
# same things as in tools/conda_recipe
- cmd: conda create -y -q -n test-environment python=%PYTHON_VERSION% pip setuptools numpy python-dateutil freetype=2.5 msinttypes pyparsing pytz tornado libpng zlib pyqt cycler nose mock
- activate test-environment
# This is needed for the installer to find the dlls...
- set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
- dir %LIBRARY_LIB%
- cmd: 'mkdir lib || cmd /c "exit /b 0"'
- copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
- copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
- set LIB=%LIBRARY_LIB%;.\lib
- set LIBPATH=%LIBRARY_LIB%;.\lib
- set LIB_INC=%CONDA_DEFAULT_ENV%\Library\include
- set INCLUDE=%LIB_INC%;%LIB_INC%\freetype2;WhateverInclude
- set CPLUS_INCLUDE_PATH=%LIB_INC%\freetype2;%LIB_INC%;WhateverCPLUS
- dir %LIB_INC%
- dir %LIB_INC%\freetype2
# Show the installed packages + versions
- conda list

test_script:
# Now build the thing..
- '%CMD_IN_ENV% python setup.py develop'
# tests
# for now, just let them pass to get the after_test parts...
- python tests.py || cmd /c "exit /b 0"

after_test:
# After the tests were a success, build packages (wheels and conda)

# There is a bug in wheels which prevents building wheels when the package uses namespaces
- cmd: '%CMD_IN_ENV% python setup.py bdist_wheel'
# Note also that our setup.py script, which is called by conda-build, writes
# a __conda_version__.txt file, so the version number on the binary package
# is set dynamically. This unfortunately mean that conda build --output
# doesn't really work.
- cmd: '%CMD_IN_ENV% conda config --get channels'
# These vars get included in the conda env, so cleanup out current conda env
- set LIB=
- set LIBPATH=
- set INCLUDE=
- set LIB_INC=
- set
# we can't build conda packages on 27 due to missing functools32, which is a recent
# additional dependency for matplotlib
- cmd: if [%CONDA_PY%] NEQ [27] %CMD_IN_ENV% conda build .\ci\conda_recipe
# Move the conda package into the dist directory, to register it
# as an "artifact" for Appveyor.
- cmd: 'copy /Y %PYTHON%\conda-bld\win-32\*.bz2 dist || cmd /c "exit /b 0"'
- cmd: 'copy /Y %PYTHON%\conda-bld\win-64\*.bz2 dist || cmd /c "exit /b 0"'
- cmd: dir .\dist\

artifacts:
- path: dist\*
name: packages
96 changes: 96 additions & 0 deletions 96 ci/appveyor/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Sample script to install Miniconda under Windows
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner, Robert McGibbon
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/

$MINICONDA_URL = "http://repo.continuum.io/miniconda/"


function DownloadMiniconda ($python_version, $platform_suffix) {
$webclient = New-Object System.Net.WebClient
if ($python_version -match "3.4") {
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
} else {
$filename = "Miniconda-latest-Windows-" + $platform_suffix + ".exe"
}
$url = $MINICONDA_URL + $filename

$basedir = $pwd.Path + "\"
$filepath = $basedir + $filename
if (Test-Path $filename) {
Write-Host "Reusing" $filepath
return $filepath
}

# Download and retry up to 3 times in case of network transient errors.
Write-Host "Downloading" $filename "from" $url
$retry_attempts = 2
for($i=0; $i -lt $retry_attempts; $i++){
try {
$webclient.DownloadFile($url, $filepath)
break
}
Catch [Exception]{
Start-Sleep 1
}
}
if (Test-Path $filepath) {
Write-Host "File saved at" $filepath
} else {
# Retry once to get the error message if any at the last try
$webclient.DownloadFile($url, $filepath)
}
return $filepath
}


function InstallMiniconda ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -match "32") {
$platform_suffix = "x86"
} else {
$platform_suffix = "x86_64"
}

$filepath = DownloadMiniconda $python_version $platform_suffix
Write-Host "Installing" $filepath "to" $python_home
$install_log = $python_home + ".log"
$args = "/S /D=$python_home"
Write-Host $filepath $args
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
if (Test-Path $python_home) {
Write-Host "Python $python_version ($architecture) installation complete"
} else {
Write-Host "Failed to install Python in $python_home"
Get-Content -Path $install_log
Exit 1
}
}


function InstallCondaPackages ($python_home, $spec) {
$conda_path = $python_home + "\Scripts\conda.exe"
$args = "install --yes " + $spec
Write-Host ("conda " + $args)
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
}

function UpdateConda ($python_home) {
$conda_path = $python_home + "\Scripts\conda.exe"
Write-Host "Updating conda..."
$args = "update --yes conda"
Write-Host $conda_path $args
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
}


function main () {
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
UpdateConda $env:PYTHON
InstallCondaPackages $env:PYTHON "conda-build jinja2 anaconda-client"
}

main
47 changes: 47 additions & 0 deletions 47 ci/appveyor/run_with_env.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
:: 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 (SDK v7.1)
::
:: To build extensions for 64 bit Python 2, we need to configure environment
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
::
:: 32 bit builds do not require specific environment configurations.
::
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
:: cmd interpreter, at least for (SDK v7.0)
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: http://stackoverflow.com/a/13751649/163740
::
:: Author: Olivier Grisel
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
@ECHO OFF

SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows

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"
) ELSE (
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
EXIT 1
)

IF "%PYTHON_ARCH%"=="64" (
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
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
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
) ELSE (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
3 changes: 3 additions & 0 deletions 3 ci/conda_recipe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# conda package

Up to now, this is mainly used to build a test conda package on windows on appveyor.
29 changes: 29 additions & 0 deletions 29 ci/conda_recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
mkdir lib
copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
if errorlevel 1 exit 1
copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
if errorlevel 1 exit 1

set LIB=%LIB%;.\lib
set LIBPATH=%LIBPATH%;.\lib
set INCLUDE=%LIBRARY_INC%;%LIBRARY_INC%\freetype2;%INCLUDE%

:: debug...
set

copy setup.cfg.template setup.cfg
if errorlevel 1 exit 1

python setup.py install
if errorlevel 1 exit 1

rd /s /q %SP_DIR%\dateutil
rd /s /q %SP_DIR%\numpy

if "%ARCH%"=="64" (
set PLAT=win-amd64
) else (
set PLAT=win32
)

::copy C:\Tcl%ARCH%\bin\t*.dll %SP_DIR%\matplotlib-%PKG_VERSION%-py%PY_VER%-%PLAT%.egg\matplotlib\backends
23 changes: 23 additions & 0 deletions 23 ci/conda_recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ `uname` == Linux ]; then
pushd $PREFIX/lib
ln -s libtcl8.5.so libtcl.so
ln -s libtk8.5.so libtk.so
popd
fi

if [ `uname` == Darwin ]; then
sed s:'#ifdef WITH_NEXT_FRAMEWORK':'#if 1':g -i src/_macosx.m
fi

cp setup.cfg.template setup.cfg || exit 1

sed s:/usr/local:$PREFIX:g -i setupext.py

$PYTHON setup.py install

rm -rf $SP_DIR/PySide
rm -rf $SP_DIR/__pycache__
rm -rf $PREFIX/bin/nose*

13 changes: 13 additions & 0 deletions 13 ci/conda_recipe/cfg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git setup.cfg.template setup.cfg.template
index ba4cde3..8d8b7c5 100644
--- setup.cfg.template
+++ setup.cfg.template
@@ -63,7 +63,7 @@
#macosx = auto
#pyside = auto
#qt4agg = auto
-#tkagg = auto
+tkagg = True
#windowing = auto
#wxagg = auto

13 changes: 13 additions & 0 deletions 13 ci/conda_recipe/cfg_notests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git setup.cfg.template setup.cfg.template
index 09fd92f..2085832 100644
--- setup.cfg.template
+++ setup.cfg.template
@@ -18,7 +18,7 @@
# optional. They are all installed by default, but they may be turned
# off here.
#
-#tests = True
+tests = False
#sample_data = True
#toolkits = True
# Tests for the toolkits are only automatically installed
11 changes: 11 additions & 0 deletions 11 ci/conda_recipe/cfg_qt4agg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git setup.cfg.template setup.cfg.template
index 8af8b6d..4e4f9d2 100644
--- setup.cfg.template
+++ setup.cfg.template
@@ -78,5 +78,5 @@
# if you have disabled the relevent extension modules. Agg will be used
# by default.
#
-#backend = Agg
+backend = Qt4Agg
#
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.