forked from manthey/pyexe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
129 lines (124 loc) · 5.34 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
environment:
matrix:
- PYTHON: "C:\\Python37"
INSTALL_OPTIONS: 3.7 --min=4
OUTPUT: "py37.exe"
ALTPYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37-x64"
INSTALL_OPTIONS: 3.7 --min=4 --64
OUTPUT: "py37-64.exe"
ALTPYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python27"
INSTALL_OPTIONS: 2.7 --min=16
OUTPUT: "py27.exe"
ALTPYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python27-x64"
INSTALL_OPTIONS: 2.7 --min=16 --64
OUTPUT: "py27-64.exe"
ALTPYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python35"
INSTALL_OPTIONS: 3.5 --min=4
OUTPUT: "py35.exe"
ALTPYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python35-x64"
INSTALL_OPTIONS: 3.5 --min=4 --64
OUTPUT: "py35-64.exe"
ALTPYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python36"
INSTALL_OPTIONS: 3.6 --min=8
OUTPUT: "py36.exe"
ALTPYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python36-x64"
INSTALL_OPTIONS: 3.6 --min=8 --64
OUTPUT: "py36-64.exe"
ALTPYTHON: "C:\\Python36"
init:
- SET PROJDIR=%cd%
- SET ORIGPATH=%PATH%
# Disable upx; it doesn't work with Python 3 for some reason
# - mkdir c:\u
# - cd c:\u
# - curl -L -O "https://github.com/upx/upx/releases/download/v3.94/upx394w.zip"
# - unzip upx394w.zip
# - cd %PROJDIR%
# Print the build system version
- ver
build_script:
# Upgrade the appveyor python version
- "SET PATH=%ALTPYTHON%;%ALTPYTHON%\\Scripts;%ORIGPATH%"
- python -m pip install --upgrade requests
- "python install_python.py %INSTALL_OPTIONS% --out=%PYTHON% --force"
- del /S /Q %PYTHON%\*.pyc >NUL
- del /S /Q %PYTHON%\*.pyo >NUL
# Use the specific python version for building
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%ORIGPATH%"
- python -m pip install --upgrade pip
- python -m pip install --upgrade setuptools
- python -m pip install --upgrade pywin32 psutil six setuptools
# Generate the list of modules we need to import
- del /S /Q %PYTHON%\*.pyc >NUL
- del /S /Q %PYTHON%\*.pyo >NUL
- python modules_pyexe.py pyexe.py
# Install PyInstaller. We patch various aspects of PyInstaller, so use a
# fixed version.
- python -m pip install pyinstaller==3.4
# Install a patching program
- python -m pip install patch
# Remove the site module hook from PyInstaller; we need the site module as is
- "del /q %PYTHON%\\Lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.*"
- "del /q /s %PYTHON%\\Lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\__pycache__"
# Copy a build hook to PyInstaller to include the cacerts.pem file for pip.
- "copy hooks\\hook*.* %PYTHON%\\Lib\\site-packages\\PyInstaller\\hooks\\."
# Replace the multiprocessing loader hook
- "copy hooks\\pyi_rth*.* %PYTHON%\\Lib\\site-packages\\PyInstaller\\loader\\rthooks\\."
# Replace the stage 3 importer
- "pushd %PYTHON%\\Lib\\site-packages\\PyInstaller\\loader && python -m patch %PROJDIR%\\hooks\\pyimod03_importers.py.diff && popd"
# Patch the PyInstaller building\utils.py to avoid storing project path
# names.
- "pushd %PYTHON%\\Lib\\site-packages\\PyInstaller\\building && python -m patch %PROJDIR%\\hooks\\utils.py.diff && popd"
- del /S /Q %PYTHON%\*.pyc >NUL
- del /S /Q %PYTHON%\*.pyo >NUL
# Save the artifact immediately
- appveyor PushArtifact pyexe.py
- "python -m PyInstaller --onefile pyexe.py --upx-dir C:\\u\\upx394w --exclude-module FixTk --exclude-module tcl --exclude-module tk --exclude-module _tkinter --exclude-module tkinter --exclude-module Tkinter --runtime-hook hooks\\rth_subprocess.py --runtime-hook hooks\\rth_pip.py --icon %PYTHON%\\pythonw.exe --add-binary %PYTHON%\\Lib\\site-packages\\setuptools\\cli-32.exe;setuptools --add-binary %PYTHON%\\Lib\\site-packages\\setuptools\\cli-64.exe;setuptools --add-binary %PYTHON%\\Lib\\site-packages\\setuptools\\cli.exe;setuptools --add-binary \"%PYTHON%\\Lib\\site-packages\\setuptools\\command\\launcher manifest.xml;setuptools\\command\""
- cp dist\pyexe.exe %OUTPUT%
# Save the artifact immediately
- appveyor PushArtifact %OUTPUT%
test_script:
# Report version
- "%OUTPUT% -VV"
# Sometimes we send test data to this directory
- mkdir c:\temp
- SET PATH=%ORIGPATH%
- pip install pytest
- cd tests
# Build a zipapp for our tests; it doesn't exist before 3.5, we could use
# our own executable to do it.
- C:\Python36-x64\python -m zipapp --output ..\sample_zipapp.pyz -p "/usr/bin/env python" sample_zipapp
# Make sure we only have original files here.
- git clean -fxd .
- "python -m pytest -l --cache-clear --exe=..\\%OUTPUT%"
# We can test the tests against the master python. We have to exclude a few
# tests that only work on the stand-alone build.
# Make sure we only have original files here.
- git clean -fxd .
- 'python -m pytest -l --cache-clear --exe=%PYTHON%\python -m "not pyexe"'
deploy:
- provider: GitHub
tag: 'pyexe-latest'
release: 'Release pyexe-latest'
auth_token:
secure: PGsGUDU6oqIy7zCyTMwIWlzf4TbJtuIgqmWb9ZLqNlM13AAaxWfDlzDlG+0CyHFx
artifact: "%OUTPUT%"
force_update: true
on:
branch: master
- provider: GitHub
tag: $(appveyor_repo_tag_name)
release: Release $(appveyor_repo_tag_name)
auth_token:
secure: PGsGUDU6oqIy7zCyTMwIWlzf4TbJtuIgqmWb9ZLqNlM13AAaxWfDlzDlG+0CyHFx
artifact: "%OUTPUT%"
force_update: true
on:
appveyor_repo_tag: true