-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathrelease_windows.bat
215 lines (193 loc) · 11 KB
/
release_windows.bat
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
echo off
cls
rem ************************************************************************************
rem ********************* ---> New batch file starts here <--- ***********************
rem ** **
rem ** This batch will compile automated via command line an executable **
rem ** Pronterface, Pronsole and Plater file for Windows 10 and 11. **
rem ** **
rem ** Steps that are automated: **
rem ** **
rem ** 1. Clean up previous compilations (directory .\dist) **
rem ** 2. Check for virtual environment called v3 and generate it, if **
rem ** not available (start from scratch) **
rem ** 3. Install all needed additional modules via pip **
rem ** 4. Check for outdated modules that need to be updated and **
rem ** update them **
rem ** 5. Check if virtual environment needs an update and do it **
rem ** 6. Check for existing variants of gcoder_line.cp??-win_amd??.pyd **
rem ** and delete them (to prevent errors and incompatibilities) **
rem ** 7. Compile Pronterface.exe **
rem ** 8. Compile Pronsole.exe **
rem ** 9. Copy localization files to .\dist **
rem ** 10. Go to directory .\dist, list files and ends the activity **
rem ** **
rem ** Steps, you need to do manually before running this batch: **
rem ** **
rem ** 1. Install python 64-bit (3.13.x 64-bit is actually preferred **
rem ** and standard version for Windows 10 and 11) **
rem ** https://www.python.org/downloads/release **
rem ** In case you use an other Python version: Check line 77 to 82 and adjust **
rem ** the parameter accordingly to build your virtual environment. **
rem ** 2. Install C-compiler environment **
rem ** https://wiki.python.org/moin/WindowsCompilers **
rem ** (Microsoft Visual Studio 2022 Community version is proofed to work fine) **
rem ** 3. Check for latest repository updates at: **
rem ** http://github.com/kliment/Printrun.git **
rem ** 4. It is recommended to delete an existing virtual environment (v3) when you **
rem ** switch between -x32/-x64 or different Python versions. There is a second **
rem ** batch script called CleanCacheFiles.bat available for cleaning **
rem ** former compiling- and __pycache__ artifacts . Run it as often you need. **
rem ** **
rem ** Remark: Plater stand alone application is experimental only. GUI code need an **
rem ** update for closing plater window and running processes. For now you **
rem ** need to terminate the process manually via Task manager. **
rem ** **
rem ** Author: DivingDuck, 2025-02-18, Status: working **
rem ** **
rem ************************************************************************************
rem ************************************************************************************
echo **************************************************
echo ****** Delete files and directory of .\dist ******
echo **************************************************
if exist dist (
DEL /F/Q/S dist > NUL
RMDIR /Q/S dist
)
echo ***************************************************
echo ****** Delete files and directory of .\build ******
echo ***************************************************
if exist build (
DEL /F/Q/S build > NUL
RMDIR /Q/S build
)
echo *********************************************
echo ****** Activate virtual environment v3 ******
echo *********************************************
if exist v3 (
call v3\Scripts\activate
) else (
echo **********************************************************************
echo ****** No virtual environment named v3 available ******
echo ****** Will create first a new virtual environment with name v3 ******
echo **********************************************************************
rem Select your Python version below. Remove 'rem' before 'rem py -3.x ...'
rem for your Python version of choice and add 'rem' for all other versions.
rem Attention:
rem Minimum version for wxPython is >= 4.2.1. With this version
rem Python x64 (version 3.8 up to 3.13) and
rem Python x86 (version 3.9 up to 3.13) are supported.
rem py -3.8 -m venv v3
rem py -3.9-32 -m venv v3
rem py -3.9 -m venv v3
rem py -3.10-32 -m venv v3
rem py -3.10 -m venv v3
rem py -3.11-32 -m venv v3
rem py -3.11 -m venv v3
rem py -3.12-32 -m venv v3
rem py -3.12 -m venv v3
rem py -3.13-32 -m venv v3
py -3.13 -m venv v3
rem Attention: py -3.13-32t and py -3.13t (the experimental
rem free-threaded mode) are not supported jet
echo *********************************************
echo ****** Activate virtual environment v3 ******
echo *********************************************
call v3\Scripts\activate
py -m pip install --upgrade pip
pip install --upgrade setuptools
pip install wheel
echo **********************************
echo ****** install requirements ******
echo **********************************
pip install cython
pip install -r requirements.txt
echo ***********************
echo ****** additions ******
echo ***********************
pip install simplejson
pip install pyinstaller
pip install pywin32
pip install polygon3
pip install pytest
)
echo ********************************************
echo ****** upgrade virtual environment v3 ******
echo ********************************************
pip install --upgrade virtualenv
echo ********************************************************
echo ****** check for outdated modules and update them ******
echo ********************************************************
rem --exclude pyglet: workaround, needs to be below 2.0 (isn't compatible)
rem --exclude pefile: workaround, (Windows) Pin pefile != 2024.8.26 due to performance
rem regression in pefile 2024.8.26 that heavily impacts PyInstaller’s
rem binary dependency analysis and binary-vs-data classification. See
rem https://pyinstaller.org/en/stable/CHANGES.html#pyinstaller-core
for /F "skip=2 delims= " %%i in ('pip list --outdated --exclude pyglet --exclude pefile') do py -m pip install --upgrade %%i
rem echo *************************************************************************
rem echo ****** pyglet workaround, needs to be below 2.0 (isn't compatible) ******
rem echo *************************************************************************
rem # 2022-11-01, 2024-11-24 moved to check for outdated section above --exclude pyglet
rem pip uninstall pyglet -y
rem pip install pyglet==1.5.29
rem echo **************************************************************************
rem echo ****** pillow workaround, needs to be below 10.0 (isn't compatible) ******
rem echo **************************************************************************
rem # 2023-12-15
rem building wxPython 4.2.1 for x86 needs pillow <10.0
rem *** pip uninstall pillow -y
rem *** pip install pillow==9.5.0
echo ******************************************************************
echo ****** Compile G-Code parser gcoder_line.cp??-win_amd??.pyd ******
echo ******************************************************************
rem Delete existing versions first to prevent errors and incompatibilities
if exist printrun\gcoder_line.cp??-win_amd??.pyd (
del printrun\gcoder_line.cp??-win_amd??.pyd
echo ********************************************************************************
echo ****** found versions of printrun\gcoder_line.cp??-win_amd??.pyd, deleted ******
echo ********************************************************************************
)
rem In addition check for 3 digit Python versions
if exist printrun\gcoder_line.cp???-win_amd??.pyd (
del printrun\gcoder_line.cp???-win_amd??.pyd
echo ***********************************************************************++*********
echo ****** found versions of printrun\gcoder_line.cp???-win_amd??.pyd, deleted ******
echo **********************************************************************************
)
python setup.py build_ext --inplace
echo ****************************************
echo ****** Collect all data for build ******
echo ****************************************
pyi-makespec -F --name "Pronterface" --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i pronterface.ico pronterface.py
pyi-makespec -F --name "Pronsole" --add-data images/*;images --add-data *.png;. --add-data *.ico;. -c -i pronsole.ico pronsole.py
rem Plater stand alone application is experimental only (See remark).
pyi-makespec -F --name "Plater" --add-data images/*;images --add-data *.png;. --add-data *.ico;. -w -i plater.ico plater.py
echo ***************************************************************
echo ****** Build Pronterface, Pronsole and Plater executables *****
echo ***************************************************************
echo
echo ** Build Pronterface executable **
pyinstaller --clean Pronterface.spec -y
echo
echo ** Build Pronsole executable **
pyinstaller --clean Pronsole.spec -y
echo
echo ** Build Plater executable **
rem Plater stand alone application is experimental only (See remark).
pyinstaller --clean Plater.spec -y
echo **********************************************
echo ****** Add language files and README.me ******
echo **********************************************
xcopy locale dist\locale\ /Y /E
xcopy README.md dist
echo ***************************************************************
echo ****** Batch finalizes ******
echo ****** ******
echo ****** Happy printing with Pronterface for Windows! ******
echo ****** ******
echo ****** You will find Pronterface and localizations here: ******
echo ***************************************************************
cd dist
dir .
pause
echo on