This repository has been archived by the owner on Dec 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
.appveyor.yml
105 lines (78 loc) · 3.79 KB
/
.appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
clone_folder: C:\projects\backports.lzma
shallow_clone: true
environment:
matrix:
# We don't have a vs2008 build of xz on Windows, so we skip that for py27
- PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
DISTUTILS_COMPILER: "mingw32"
- PYTHON_VERSION: "2.7"
PYTHON_ARCH: "32"
DISTUTILS_COMPILER: "mingw32"
# We have a vs2015 build of xz on Windows, so we test against that for py>27
- PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
DISTUTILS_COMPILER: "msvc"
- PYTHON_VERSION: "3.6"
PYTHON_ARCH: "32"
DISTUTILS_COMPILER: "msvc"
- PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
DISTUTILS_COMPILER: "mingw32"
- PYTHON_VERSION: "3.6"
PYTHON_ARCH: "32"
DISTUTILS_COMPILER: "mingw32"
- PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
DISTUTILS_COMPILER: "msvc"
- PYTHON_VERSION: "3.7"
PYTHON_ARCH: "32"
DISTUTILS_COMPILER: "msvc"
- PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
DISTUTILS_COMPILER: "mingw32"
- PYTHON_VERSION: "3.7"
PYTHON_ARCH: "32"
DISTUTILS_COMPILER: "mingw32"
init:
- ECHO %PYTHON_VERSION% %PYTHON_ARCH% %HOME%
build_script:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Need this for correct path to Miniconda setup
- if "%PYTHON_VERSION%" == "3.6" set BASE_PYTHON_VERSION=36
- if "%PYTHON_VERSION%" == "3.7" set BASE_PYTHON_VERSION=37
- if "%PYTHON_ARCH%" == "64" set ARCH_LABEL=-x64
- C:\Miniconda%BASE_PYTHON_VERSION%%ARCH_LABEL%\Scripts\activate
# Now that we have conda in path, let's go to the project directory
- cd /d C:\projects\backports.lzma
# In case I forget -y to any conda commands
- conda config --system --set always_yes true
# This is where the Visual Studio build of liblzma.lib will go
- set LIBRARY_PREFIX=%CONDA_PREFIX%\Library
# This is where the mingw-64 build of liblzma.lib will go
- if "%DISTUTILS_COMPILER%" == "mingw32" set LIBRARY_PREFIX=%LIBRARY_PREFIX%\mingw-w64
# Let's install the packages required to build the wheel
- conda install -y pip setuptools wheel m2w64-ntldd-git
# Let's install the toolchain and the package that will provide liblzma
- if "%DISTUTILS_COMPILER%" == "mingw32" conda install -y libpython m2w64-toolchain m2w64-xz
- if "%DISTUTILS_COMPILER%" == "msvc" conda install -y xz
# Nasty hack to enforce static linking of liblzma
- if "%DISTUTILS_COMPILER%" == "mingw32" move /Y %LIBRARY_PREFIX%\lib\liblzma.a %LIBRARY_PREFIX%\lib\liblzma.dll.a
- if "%DISTUTILS_COMPILER%" == "msvc" move /Y %LIBRARY_PREFIX%\lib\liblzma_static.lib %LIBRARY_PREFIX%\lib\liblzma.lib
# Time to build the wheel!
- pip wheel . --global-option=build_ext --global-option="-I%LIBRARY_PREFIX%\include" --global-option="-L%LIBRARY_PREFIX%\lib" --global-option --compiler=%DISTUTILS_COMPILER% --global-option --define="LZMA_API_STATIC"
# Install the wheel!
- for %%x in (dir *.whl) do pip install %%x
# Let's put this to test
- if "%PYTHON_VERSION%" == "2.7" conda install future
- python test\test_lzma.py
# Confirm that there is no liblzma.dll in the output
- ntldd %CONDA_PREFIX%\Lib\site-packages\backports\lzma\_lzma*.pyd