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

Commit 2a4863c

Browse filesBrowse files
committed
Merge pull request #5629 from JanSchulz/appveyor2
WIP: more windows build and CI changes
2 parents f913aa4 + 78a029d commit 2a4863c
Copy full SHA for 2a4863c
Expand file treeCollapse file tree

17 files changed

+392
-329
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ cover/
8181
# Conda files #
8282
###############
8383
__conda_version__.txt
84+
lib/png.lib
85+
lib/z.lib

‎README.win.md

Copy file name to clipboard
+64Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Building on Windows
2+
3+
There are a few possibilities to build matplotlib on Windows:
4+
5+
* Wheels via [matplotlib-winbuild](https://github.com/jbmohler/matplotlib-winbuild)
6+
* Wheels by using conda packages
7+
* Conda packages
8+
9+
## Wheel builds using conda packages
10+
11+
This is a wheel build, but we use conda packages to get all the requirements. The binary
12+
requirements (png, freetype,...) are statically linked and therefore not needed during the wheel
13+
install.
14+
15+
The commands below assume that you can compile a native python lib for the python version of your
16+
choice. See [this howto](http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/)
17+
how to install and setup such environments. If in doubt: use python 3.5 as it mostly works
18+
without fiddling with environment variables.
19+
20+
``` sh
21+
# create a new environment with the required packages
22+
conda create -n "matplotlib_build" python=3.4 numpy python-dateutil pyparsing pytz tornado pyqt cycler tk libpng zlib freetype
23+
activate matplotlib_build
24+
# this package is only available in the conda-forge channel
25+
conda install -c conda-forge msinttypes
26+
# for python 2.7
27+
conda install -c conda-forge functools32
28+
29+
# copy the libs which have "wrong" names
30+
set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
31+
mkdir lib || cmd /c "exit /b 0"
32+
copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
33+
copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
34+
35+
# Make the header files and the rest of the static libs available during the build
36+
# CONDA_DEFAULT_ENV is a env variable which is set to the currently active environment path
37+
set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
38+
39+
# build the wheel
40+
python setup.py bdist_wheel
41+
```
42+
43+
The `build_alllocal.cmd` script automates these steps if you already created and activated the conda environment.
44+
45+
46+
## Conda packages
47+
48+
This needs a [working installed C compiler](http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/)
49+
for the version of python you are compiling the package for but you don't need to setup the
50+
environment variables.
51+
52+
```sh
53+
# only the first time...
54+
conda install conda-build
55+
56+
# the python version you want a package for...
57+
set CONDA_PY=3.5
58+
59+
# builds the package, using a clean build environment
60+
conda build ci\conda_recipe
61+
62+
# install the new package
63+
conda install --use-local matplotlib
64+
```

‎appveyor.yml

Copy file name to clipboard
+71-44Lines changed: 71 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# With infos from
1+
# With infos from
22
# http://tjelvarolsson.com/blog/how-to-continuously-test-your-python-code-on-windows-using-appveyor/
33
# https://packaging.python.org/en/latest/appveyor/
44
# https://github.com/rmcgibbo/python-appveyor-conda-example
@@ -11,33 +11,31 @@ environment:
1111
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
1212
# /E:ON and /V:ON options are not enabled in the batch script intepreter
1313
# See: http://stackoverflow.com/a/13751649/163740
14-
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci\\appveyor\\run_with_env.cmd"
14+
CMD_IN_ENV: "cmd /E:ON /V:ON /C obvci_appveyor_python_build_env.cmd"
15+
CONDA_INSTALL_LOCN: "C:\\conda"
16+
# Workaround for https://github.com/conda/conda-build/issues/636
17+
PYTHONIOENCODING: "UTF-8"
1518

1619
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"
20+
# for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest
21+
- TARGET_ARCH: "x86"
3222
CONDA_PY: "27"
3323
CONDA_NPY: "18"
34-
35-
- PYTHON: "C:\\Python27_32"
3624
PYTHON_VERSION: "2.7"
37-
PYTHON_ARCH: "32"
25+
- TARGET_ARCH: "x64"
3826
CONDA_PY: "27"
3927
CONDA_NPY: "18"
40-
28+
PYTHON_VERSION: "2.7"
29+
- TARGET_ARCH: "x64"
30+
CONDA_PY: "34"
31+
CONDA_NPY: "110"
32+
PYTHON_VERSION: "3.4"
33+
- TARGET_ARCH: "x64"
34+
CONDA_PY: "35"
35+
CONDA_NPY: "110"
36+
PYTHON_VERSION: "3.5"
37+
38+
4139
# We always use a 64-bit machine, but can build x86 distributions
4240
# with the PYTHON_ARCH variable (which is used by CMD_IN_ENV).
4341
platform:
@@ -47,25 +45,42 @@ platform:
4745
build: false
4846

4947
init:
50-
- "ECHO %PYTHON_VERSION% %PYTHON%"
48+
- cmd: "ECHO %PYTHON_VERSION% %CONDA_INSTALL_LOCN%"
5149

5250
install:
53-
- powershell .\ci\appveyor\install.ps1
54-
- SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
51+
- appveyor DownloadFile "https://raw.githubusercontent.com/pelson/Obvious-CI/master/bootstrap-obvious-ci-and-miniconda.py"
52+
- cmd: python bootstrap-obvious-ci-and-miniconda.py %CONDA_INSTALL_LOCN% %TARGET_ARCH% %CONDA_PY:~0,1% --without-obvci
53+
- cmd: set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
54+
- cmd: set PYTHONUNBUFFERED=1
55+
- cmd: conda install -c http://conda.anaconda.org/pelson/channel/development --yes --quiet obvious-ci
56+
- cmd: obvci_install_conda_build_tools.py
5557
- cmd: conda config --set show_channel_urls yes
5658
# for msinttypes
5759
- cmd: conda config --add channels conda-forge
5860
# this is now the downloaded conda...
5961
- 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+
63+
# Fix the appveyor build environment to work with conda build
64+
# workaround for missing vcvars64.bat in py34 64bit
65+
- cmd: copy ci\appveyor\vcvars64.bat "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64"
66+
# workaround for conda build on py27 prefering the normal installed
67+
# VS tools instead of the also installed Py27 VS compiler (which wouldn't need this workarounds...)
68+
- cmd: copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"
69+
70+
# same things as the requirements in ci/conda_recipe/meta.yaml
71+
- cmd: conda create -y -q -n test-environment python=%PYTHON_VERSION% pip setuptools numpy python-dateutil freetype msinttypes tk pyparsing pytz tornado libpng zlib pyqt cycler nose mock
6272
- activate test-environment
63-
# This is needed for the installer to find the dlls...
73+
- cmd: echo %PYTHON_VERSION% %TARGET_ARCH%
74+
- cmd: IF %PYTHON_VERSION% == 2.7 conda install -y functools32
75+
76+
# Let the install prefer the static builds of the libs
6477
- set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
6578
- cmd: 'mkdir lib || cmd /c "exit /b 0"'
66-
- copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
79+
- copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
6780
- copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
6881
- set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
82+
# enables the local freetype build
83+
- copy ci\travis\setup.cfg .
6984
# Show the installed packages + versions
7085
- conda list
7186

@@ -78,27 +93,39 @@ test_script:
7893

7994
after_test:
8095
# 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.
96+
97+
# Build the wheel
98+
# Hide the output, the copied files really clutter the build log...
99+
- cmd: '%CMD_IN_ENV% python setup.py bdist_wheel > NUL:'
100+
101+
# And now the conda build after a cleanup...
102+
# cleanup build files so that they don't pollute the conda build but keep the wheel in dist...
103+
- cmd: git clean -d -x -f -e dist/
104+
# cleanup the environment so that the test-environment does not leak into the conda build...
105+
- cmd: set MPLBASEDIRLIST=
106+
- cmd: set LIBRARY_LIB=
107+
- cmd: deactivate
108+
- cmd: path
109+
- cmd: where python
88110
- 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
111+
- cmd: '%CMD_IN_ENV% conda build .\ci\conda_recipe'
112+
92113
# 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\
114+
# as an "artifact" for Appveyor.
115+
- cmd: 'copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-32\*.bz2 dist || cmd /c "exit /b 0"'
116+
- cmd: 'copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-64\*.bz2 dist || cmd /c "exit /b 0"'
117+
- cmd: dir dist\
118+
- cmd: echo finished...
97119

98120
artifacts:
99121
- path: dist\*
100122
name: packages
101-
123+
102124
- path: result_images\*
103-
name: test result images
125+
name: result_images
104126
type: zip
127+
128+
on_failure:
129+
- echo zipping images after a failure...
130+
- 7z a result_images.zip result_images\ >NUL:
131+
- appveyor PushArtifact result_images.zip

‎build_alllocal.cmd

Copy file name to clipboard
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
:: This assumes you have installed all the dependencies via conda packages:
2+
:: # create a new environment with the required packages
3+
:: conda create -n "matplotlib_build" python=3.4 numpy python-dateutil pyparsing pytz tornado pyqt cycler tk libpng zlib freetype
4+
:: activate matplotlib_build
5+
:: # this package is only available in the conda-forge channel
6+
:: conda install -c conda-forge msinttypes
7+
:: if you build on py2.7:
8+
:: conda install -c conda-forge functools32
9+
10+
set TARGET=bdist_wheel
11+
IF [%1]==[] (
12+
echo Using default target: %TARGET%
13+
) else (
14+
set TARGET=%1
15+
echo Using user supplied target: %TARGET%
16+
)
17+
18+
IF NOT DEFINED CONDA_DEFAULT_ENV (
19+
echo No Conda env activated: you need to create a conda env with the right packages and activate it!
20+
GOTO:eof
21+
)
22+
23+
:: copy the libs which have "wrong" names
24+
set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
25+
mkdir lib || cmd /c "exit /b 0"
26+
copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
27+
copy %LIBRARY_LIB%\libpng_static.lib lib\png.lib
28+
29+
:: Make the header files and the rest of the static libs available during the build
30+
:: CONDA_DEFAULT_ENV is a env variable which is set to the currently active environment path
31+
set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
32+
33+
:: build the target
34+
python setup.py %TARGET%

‎ci/appveyor/install.ps1

Copy file name to clipboardExpand all lines: ci/appveyor/install.ps1
-96Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.