8000 Merge pull request #5604 from JanSchulz/master · matplotlib/matplotlib@95b67ff · GitHub
[go: up one dir, main page]

Skip to content

Commit 95b67ff

Browse files
committed
Merge pull request #5604 from JanSchulz/master
WIP: testing on windows and conda packages/ wheels for master
2 parents e640a24 + 3d942f7 commit 95b67ff

25 files changed

+737
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,4 @@ setup.cfg
8080
.coverage
8181
.coverage.*
8282
cover/
83+
__conda_version__.txt

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ matrix:
5050
- python: "nightly"
5151

5252
before_install:
53-
- source tools/travis_tools.sh
53+
- source ci/travis/travis_tools.sh
5454
# Install into our own pristine virtualenv
5555
- virtualenv --python=python venv
5656
- source venv/bin/activate
@@ -90,7 +90,7 @@ install:
9090
fc-cache -f -v
9191
else
9292
# Use the special local version of freetype for testing
93-
cp .travis/setup.cfg .
93+
cp ci/travis/setup.cfg .
9494
fi;
9595
9696
- pip install -e .
@@ -130,10 +130,10 @@ after_success:
130130
if [[ $TRAVIS_PULL_REQUEST == false && $TRAVIS_REPO_SLUG == 'matplotlib/matplotlib' && $BUILD_DOCS == true && $TRAVIS_BRANCH == 'master' ]]; then
131131
cd $TRAVIS_BUILD_DIR
132132
echo "Uploading documentation"
133-
openssl aes-256-cbc -K $encrypted_cc802e084cd0_key -iv $encrypted_cc802e084cd0_iv -in .travis/matplotlibDeployKey.enc -out .travis/matplotlibDeployKey -d
133+
openssl aes-256-cbc -K $encrypted_cc802e084cd0_key -iv $encrypted_cc802e084cd0_iv -in ci/travis/matplotlibDeployKey.enc -out ci/travis/matplotlibDeployKey -d
134134
eval `ssh-agent -s`
135-
chmod 600 .travis/matplotlibDeployKey
136-
ssh-add .travis/matplotlibDeployKey
135+
chmod 600 ci/travis/matplotlibDeployKey
136+
ssh-add ci/travis/matplotlibDeployKey
137137
cd ..
138138
git clone git@github.com:matplotlib/devdocs.git
139139
cd devdocs
@@ -154,12 +154,12 @@ after_success:
154154
[[ $TRAVIS_REPO_SLUG == 'matplotlib/matplotlib' ]] && \
155155
[[ $TRAVIS_BRANCH == 'master' ]]; then
156156
cd $TRAVIS_BUILD_DIR
157-
python .travis/travis_after_all.py
157+
python ci/travis/travis_after_all.py
158158
export $(cat .to_export_back)
159159
if [ "$BUILD_LEADER" = "YES" ]; then
160160
if [ "$BUILD_AGGREGATE_STATUS" = "others_succeeded" ]; then
161161
echo "All Succeeded! Triggering OSX build..."
162-
./.travis/build_children.sh
162+
./ci/travis/build_children.sh
163163
else
164164
echo "Some Failed; no OSX build"
165165
fi

appveyor.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# With infos from
2+
# http://tjelvarolsson.com/blog/how-to-continuously-test-your-python-code-on-windows-using-appveyor/
3+
# https://packaging.python.org/en/latest/appveyor/
4+
# https://github.com/rmcgibbo/python-appveyor-conda-example
5+
6+
# Backslashes in quotes need to be escaped: \ -> "\\"
7+
8+
environment:
9+
10+
global:
11+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
12+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
13+
# See: http://stackoverflow.com/a/13751649/163740
14+
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci\\appveyor\\run_with_env.cmd"
15+
16+
matrix:
17+
- PYTHON: "C:\\Python34_64"
18+
PYTHON_VERSION: "3.4"
19+
PYTHON_ARCH: "64"
20+
CONDA_PY: "34"
21+
CONDA_NPY: "110"
22+
23+
- PYTHON: "C:\\Python35_64"
24+
PYTHON_VERSION: "3.5"
25+
PYTHON_ARCH: "64"
26+
CONDA_PY: "35"
27+
CONDA_NPY: "110"
28+
29+
- PYTHON: "C:\\Python27_64"
30+
PYTHON_VERSION: "2.7"
31+
PYTHON_ARCH: "64"
32+
CONDA_PY: "27"
33+
CONDA_NPY: "18"
34+
35+
- PYTHON: "C:\\Python27_32"
36+
PYTHON_VERSION: "2.7"
37+
PYTHON_ARCH: "32"
38+
CONDA_PY: "27"
39+
CONDA_NPY: "18"
40+
41+
# We always use a 64-bit machine, but can build x86 distributions
42+
# with the PYTHON_ARCH variable (which is used by CMD_IN_ENV).
43+
platform:
44+
- x64
45+
46+
# all our python builds have to happen in tests_script...
47+
build: false
48+
49+
init:
50+
- "ECHO %PYTHON_VERSION% %PYTHON%"
51+
52+
install:
53+
- powershell .\ci\appveyor\install.ps1
54+
- SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
55+
- cmd: conda config --set show_channel_urls yes
56+
# for msinttypes
57+
- cmd: conda config --add channels conda-forge
58+
# this is now the downloaded conda...
59+
- conda info -a
60+
# same things as in tools/conda_recipe
61+
- 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
62+
- activate test-environment
63+
# This is needed for the installer to find the dlls...
64+
- set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
65+
- cmd: 'mkdir lib || cmd /c "exit /b 0"'
66+
- copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
67+
- copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
68+
- set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
69+
# Show the installed packages + versions
70+
- conda list
71+
72+
test_script:
73+
# Now build the thing..
74+
- '%CMD_IN_ENV% python setup.py develop'
75+
# tests
76+
# for now, just let them pass to get the after_test parts...
77+
- python tests.py || cmd /c "exit /b 0"
78+
79+
after_test:
80+
# After the tests were a success, build packages (wheels and conda)
81+
82+
# There is a bug in wheels which prevents building wheels when the package uses namespaces
83+
- cmd: '%CMD_IN_ENV% python setup.py bdist_wheel'
84+
# Note also that our setup.py script, which is called by conda-build, writes
85+
# a __conda_version__.txt file, so the version number on the binary package
86+
# is set dynamically. This unfortunately mean that conda build --output
87+
# doesn't really work.
88+
- cmd: '%CMD_IN_ENV% conda config --get channels'
89+
# we can't build conda packages on 27 due to missing functools32, which is a recent
90+
# additional dependency for matplotlib
91+
- cmd: if [%CONDA_PY%] NEQ [27] %CMD_IN_ENV% conda build .\ci\conda_recipe
92+
# Move the conda package into the dist directory, to register it
93+
# as an "artifact" for Appveyor.
94+
- cmd: 'copy /Y %PYTHON%\conda-bld\win-32\*.bz2 dist || cmd /c "exit /b 0"'
95+
- cmd: 'copy /Y %PYTHON%\conda-bld\win-64\*.bz2 dist || cmd /c "exit /b 0"'
96+
- cmd: dir .\dist\
97+
98+
artifacts:
99+
- path: dist\*
100+
name: packages
101+
102+
- path: result_images\*
103+
name: test result images
104+
type: zip

ci/appveyor/install.ps1

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Sample script to install Miniconda under Windows
2+
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner, Robert McGibbon
3+
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
4+
5+
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
6+
7+
8+
function DownloadMiniconda ($python_version, $platform_suffix) {
9+
$webclient = New-Object System.Net.WebClient
10+
if ($python_version -match "3.4") {
11+
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
12+
} else {
13+
$filename = "Miniconda-latest-Windows-" + $platform_suffix + ".exe"
14+
}
15+
$url = $MINICONDA_URL + $filename
16+
17+
$basedir = $pwd.Path + "\"
18+
$filepath = $basedir + $filename
19+
if (Test-Path $filename) {
20+
Write-Host "Reusing" $filepath
21+
return $filepath
22+
}
23+
24+
# Download and retry up to 3 times in case of network transient errors.
25+
Write-Host "Downloading" $filename "from" $url
26+
$retry_attempts = 2
27+
for($i=0; $i -lt $retry_attempts; $i++){
28+
try {
29+
$webclient.DownloadFile($url, $filepath)
30+
break
31+
}
32+
Catch [Exception]{
33+
Start-Sleep 1
34+
}
35+
}
36+
if (Test-Path $filepath) {
37+
Write-Host "File saved at" $filepath
38+
} else {
39+
# Retry once to get the error message if any at the last try
40+
$webclient.DownloadFile($url, $filepath)
41+
}
42+
return $filepath
43+
}
44+
45+
46+
function InstallMiniconda ($python_version, $architecture, $python_home) {
47+
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
48+
if (Test-Path $python_home) {
49+
Write-Host $python_home "already exists, skipping."
50+
return $false
51+
}
52+
if ($architecture -match "32") {
53+
$platform_suffix = "x86"
54+
} else {
55+
$platform_suffix = "x86_64"
56+
}
57+
58+
$filepath = DownloadMiniconda $python_version $platform_suffix
59+
Write-Host "Installing" $filepath "to" $python_home
60+
$install_log = $python_home + ".log"
61+
$args = "/S /D=$python_home"
62+
Write-Host $filepath $args
63+
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
64+
if (Test-Path $python_home) {
65+
Write-Host "Python $python_version ($architecture) installation complete"
66+
} else {
67+
Write-Host "Failed to install Python in $python_home"
68+
Get-Content -Path $install_log
69+
Exit 1
70+
}
71+
}
72+
73+
74+
function InstallCondaPackages ($python_home, $spec) {
75+
$conda_path = $python_home + "\Scripts\conda.exe"
76+
$args = "install --yes " + $spec
77+
Write-Host ("conda " + $args)
78+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
79+
}
80+
81+
function UpdateConda ($python_home) {
82+
$conda_path = $python_home + "\Scripts\conda.exe"
83+
Write-Host "Updating conda..."
84+
$args = "update --yes conda"
85+
Write-Host $conda_path $args
86+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
87+
}
88+
89+
90+
function main () {
91+
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
92+
UpdateConda $env:PYTHON
93+
InstallCondaPackages $env:PYTHON "conda-build jinja2 anaconda-client"
94+
}
95+
96+
main

ci/appveyor/run_with_env.cmd

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+< 10000 /span>
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+
)

ci/conda_recipe/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# conda package
2+
3+
Up to now, this is mainly used to build a test conda package on windows on appveyor.

ci/conda_recipe/bld.bat

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
mkdir lib
2+
copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
3+
if errorlevel 1 exit 1
4+
copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
5+
if errorlevel 1 exit 1
6+
7+
set MPLBASEDIRLIST=%LIBRARY_PREFIX%;.
8+
9+
:: debug...
10+
set
11+
12+
copy setup.cfg.template setup.cfg
13+
if errorlevel 1 exit 1
14+
15+
python setup.py install
16+
if errorlevel 1 exit 1
17+
18+
rd /s /q %SP_DIR%\dateutil
19+
rd /s /q %SP_DIR%\numpy

ci/conda_recipe/build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
if [ `uname` == Linux ]; then
4+
pushd $PREFIX/lib
5+
ln -s libtcl8.5.so libtcl.so
6+
ln -s libtk8.5.so libtk.so
7+
popd
8+
fi
9+
10+
if [ `uname` == Darwin ]; then
11+
sed s:'#ifdef WITH_NEXT_FRAMEWORK':'#if 1':g -i src/_macosx.m
12+
fi
13+
14+
cp setup.cfg.template setup.cfg || exit 1
15+
16+
sed s:/usr/local:$PREFIX:g -i setupext.py
17+
18+
$PYTHON setup.py install
19+
20+
rm -rf $SP_DIR/PySide
21+
rm -rf $SP_DIR/__pycache__
22+
rm -rf $PREFIX/bin/nose*
23+

0 commit comments

Comments
 (0)
0