Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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 all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ setup.cfg
.coverage
.coverage.*
cover/
__conda_version__.txt
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ matrix:
- python: "nightly"

before_install:
- source tools/travis_tools.sh
- source ci/travis/travis_tools.sh
# Install into our own pristine virtualenv
- virtualenv --python=python venv
- source venv/bin/activate
Expand Down Expand Up @@ -90,7 +90,7 @@ install:
fc-cache -f -v
else
# Use the special local version of freetype for testing
cp .travis/setup.cfg .
cp ci/travis/setup.cfg .
fi;

- pip install -e .
Expand Down Expand Up @@ -130,10 +130,10 @@ after_success:
if [[ $TRAVIS_PULL_REQUEST == false && $TRAVIS_REPO_SLUG == 'matplotlib/matplotlib' && $BUILD_DOCS == true && $TRAVIS_BRANCH == 'master' ]]; then
cd $TRAVIS_BUILD_DIR
echo "Uploading documentation"
openssl aes-256-cbc -K $encrypted_cc802e084cd0_key -iv $encrypted_cc802e084cd0_iv -in .travis/matplotlibDeployKey.enc -out .travis/matplotlibDeployKey -d
openssl aes-256-cbc -K $encrypted_cc802e084cd0_key -iv $encrypted_cc802e084cd0_iv -in ci/travis/matplotlibDeployKey.enc -out ci/travis/matplotlibDeployKey -d
eval `ssh-agent -s`
chmod 600 .travis/matplotlibDeployKey
ssh-add .travis/matplotlibDeployKey
chmod 600 ci/travis/matplotlibDeployKey
ssh-add ci/travis/matplotlibDeployKey
cd ..
git clone [email protected]:matplotlib/devdocs.git
cd devdocs
Expand All @@ -154,12 +154,12 @@ after_success:
[[ $TRAVIS_REPO_SLUG == 'matplotlib/matplotlib' ]] && \
[[ $TRAVIS_BRANCH == 'master' ]]; then
cd $TRAVIS_BUILD_DIR
python .travis/travis_after_all.py
python ci/travis/travis_after_all.py
export $(cat .to_export_back)
if [ "$BUILD_LEADER" = "YES" ]; then
if [ "$BUILD_AGGREGATE_STATUS" = "others_succeeded" ]; then
echo "All Succeeded! Triggering OSX build..."
./.travis/build_children.sh
./ci/travis/build_children.sh
else
echo "Some Failed; no OSX build"
fi
Expand Down
104 changes: 104 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# 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: "110"

- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "64"
CONDA_PY: "35"
CONDA_NPY: "110"

- 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 tk 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
- 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 MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
# 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'
# 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

- path: result_images\*
name: test result images
type: zip
96 changes: 96 additions & 0 deletions 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
95 changes: 95 additions & 0 deletions ci/appveyor/run_with_env.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
:: EXPECTED ENV VARS: PYTHON_ARCH (either x86 or x64)
:: CONDA_PY (either 27, 33, 35 etc. - only major version is extracted)
::
::
:: 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, and 64-bit builds for 3.5 and beyond, 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: Phil Elson
:: Original Author: Olivier Grisel (https://github.com/ogrisel/python-appveyor-demo)
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
::
:: Notes about batch files for Python people:
::
:: Quotes in values are literally part of the values:
:: SET FOO="bar"
:: FOO is now five characters long: " b a r "
:: If you don't want quotes, don't include them on the right-hand side.
::
:: The CALL lines at the end of this file look redundant, but if you move them
:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y
:: case, I don't know why.
:: originally from https://github.com/pelson/Obvious-CI/blob/master/scripts/obvci_appveyor_python_build_env.cmd
@ECHO OFF

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

:: 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=%CONDA_PY:~0,1%

IF "%CONDA_PY:~2,1%" == "" (
:: CONDA_PY style, such as 27, 34 etc.
SET MINOR_PYTHON_VERSION=%CONDA_PY:~1,1%
) ELSE (
IF "%CONDA_PY:~3,1%" == "." (
SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,1%
) ELSE (
SET MINOR_PYTHON_VERSION=%CONDA_PY:~2,2%
)
)

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

IF "%PYTHON_ARCH%"=="64" (
IF %SET_SDK_64% == Y (
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 /B 1
) ELSE (
ECHO Using default MSVC build environment for 64 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT /B 1
)
) ELSE (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT /B 1
)
3 changes: 3 additions & 0 deletions 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.
19 changes: 19 additions & 0 deletions ci/conda_recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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 MPLBASEDIRLIST=%LIBRARY_PREFIX%;.

:: 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
23 changes: 23 additions & 0 deletions 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*

Loading