Skip to content

Commit a1678f2

Browse files
committed
CI: work around some conda and appveyor issues
Conda prefers the normal VS tools for py27 instead of the python specific ones and appeveyor has no 64bit versions installed there. Same for the py34 version of VS, which lacks the vcvars64.bat "hack": point 4 in http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/#for-python-3-4 Also fix some environtment variable leaks from the test environment to the conda build environment. Also fix the build error on 64bit builds
1 parent 9a04e89 commit a1678f2

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

appveyor.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ platform:
4545
build: false
4646

4747
init:
48-
- "ECHO %PYTHON_VERSION% %CONDA_INSTALL_LOCN%"
48+
- cmd: "ECHO %PYTHON_VERSION% %CONDA_INSTALL_LOCN%"
4949

5050
install:
5151
- appveyor DownloadFile "https://raw.githubusercontent.com/pelson/Obvious-CI/master/bootstrap-obvious-ci-and-miniconda.py"
5252
- cmd: python bootstrap-obvious-ci-and-miniconda.py %CONDA_INSTALL_LOCN% %TARGET_ARCH% %CONDA_PY:~0,1% --without-obvci
53-
- cmd: set PATH=%PATH%;%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts
53+
- cmd: set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
5454
- cmd: set PYTHONUNBUFFERED=1
5555
- cmd: conda install -c http://conda.anaconda.org/pelson/channel/development --yes --quiet obvious-ci
5656
- cmd: obvci_install_conda_build_tools.py
@@ -59,12 +59,21 @@ install:
5959
- cmd: conda config --add channels conda-forge
6060
# this is now the downloaded conda...
6161
- conda info -a
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+
6270
# same things as the requirements in ci/conda_recipe/meta.yaml
6371
- 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
6472
- activate test-environment
6573
- cmd: echo %PYTHON_VERSION% %TARGET_ARCH%
6674
- cmd: IF %PYTHON_VERSION% == 2.7 conda install -y functools32
67-
# This is needed for the installer to find the dlls...
75+
76+
# Let the install prefer the static builds of the libs
6877
- set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib
6978
- cmd: 'mkdir lib || cmd /c "exit /b 0"'
7079
- copy %LIBRARY_LIB%\zlibstatic.lib lib\z.lib
@@ -87,21 +96,28 @@ test_script:
8796
after_test:
8897
# After the tests were a success, build packages (wheels and conda)
8998

90-
# There is a bug in wheels which prevents building wheels when the package uses namespaces
91-
- cmd: '%CMD_IN_ENV% python setup.py bdist_wheel'
92-
# Note also that our setup.py script, which is called by conda-build, writes
93-
# a __conda_version__.txt file, so the version number on the binary package
94-
# is set dynamically. This unfortunately means that conda build --output
95-
# doesn't really work.
96-
- cmd: '%CMD_IN_ENV% conda config --get channels'
99+
# Build the wheel
100+
# Hide the output, the copied files really clutter the build log...
101+
- cmd: '%CMD_IN_ENV% python setup.py bdist_wheel > NUL:'
102+
103+
# And now the conda build after a cleanup...
97104
# cleanup build files so that they don't pollute the conda build but keep the wheel in dist...
98105
- cmd: git clean -d -x -f -e dist/
106+
# cleanup the environment so that the test-environment does not leak into the conda build...
107+
- cmd: set MPLBASEDIRLIST=
108+
- cmd: set LIBRARY_LIB=
109+
- cmd: deactivate
110+
- cmd: path
111+
- cmd: where python
112+
- cmd: '%CMD_IN_ENV% conda config --get channels'
99113
- cmd: '%CMD_IN_ENV% conda build .\ci\conda_recipe'
114+
100115
# Move the conda package into the dist directory, to register it
101116
# as an "artifact" for Appveyor.
102117
- cmd: 'copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-32\*.bz2 dist || cmd /c "exit /b 0"'
103118
- cmd: 'copy /Y %CONDA_INSTALL_LOCN%\conda-bld\win-64\*.bz2 dist || cmd /c "exit /b 0"'
104-
- cmd: dir .\dist\
119+
- cmd: dir dist\
120+
- cmd: echo finished...
105121

106122
artifacts:
107123
- path: dist\*
@@ -112,5 +128,6 @@ artifacts:
112128
type: zip
113129

114130
on_failure:
131+
- echo zipping images after a failure...
115132
- 7z a result_images.zip result_images\ >NUL:
116133
- appveyor PushArtifact result_images.zip

ci/appveyor/vcvars64.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64

ci/conda_recipe/bld.bat

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
set LIB=%LIBRARY_LIB%
21
set LIBPATH=%LIBRARY_LIB%;
3-
set INCLUDE=%LIBRARY_INC%;%PREFIX%\Library\include\freetype2
2+
set INCLUDE=%INCLUDE%;%PREFIX%\Library\include\freetype2
43

54
ECHO [directories] > setup.cfg
65
ECHO basedirlist = %LIBRARY_PREFIX% >> setup.cfg
@@ -9,5 +8,5 @@ ECHO tests = False >> setup.cfg
98
ECHO sample_data = False >> setup.cfg
109
ECHO toolkits_tests = False >> setup.cfg
1110

12-
python setup.py install
11+
%PYTHON% setup.py install
1312
if errorlevel 1 exit 1

0 commit comments

Comments
 (0)