1
1
rem generate_a_winpython_distro.bat: to be launched from a winpython directory, where 'make.py' is
2
2
@ echo on
3
3
4
- REM === Set default values if not already defined ===
4
+ REM === Step 01: Set default values if not already defined ===
5
5
if not defined my_release_level set " my_release_level = b1"
6
6
if not defined my_create_installer set " my_create_installer = True"
7
7
if not defined my_constraints set " my_constraints = C:\WinP\constraints.txt"
@@ -19,7 +19,7 @@ set "my_time=%my_time: =0%"
19
19
REM === Define archive log file path ===
20
20
set " my_archive_log = %my_archive_dir% \build_%my_pyver% _%my_release%%my_flavor% _%my_release_level% _of_%date:/ =- % at_%my_time% .txt"
21
21
22
- REM === Set Python version and release ===
22
+ REM === Step 02: Set Python version and release ===
23
23
if " %my_python_target% " == " 311" (
24
24
set " my_python_target_release = 3119"
25
25
set " my_release = 2"
@@ -34,7 +34,7 @@ if "%my_python_target%"=="311" (
34
34
set " my_release = 1"
35
35
)
36
36
37
- REM === Define base build and distribution paths ===
37
+ REM === Step 03: Define base build and distribution paths ===
38
38
set " my_basedir = %my_root_dir_for_builds% \bd%my_python_target% "
39
39
set " my_WINPYDIRBASE = %my_basedir% \bu%my_flavor% \WPy%my_arch% -%my_python_target_release%%my_release%%my_release_level% "
40
40
@@ -44,7 +44,7 @@ set my_buildenv=C:\WinPdev\WPy64-310111
44
44
45
45
call :log_section preparing winPython for %my_pyver% (%my_python_target% )release %my_release%%m y_flavor% (%my_release_level% ) *** %my_arch% bit ***
46
46
47
- REM === Step: Pre-clear previous build infrastructure ===
47
+ REM === Step 04 : Pre-clear previous build infrastructure ===
48
48
if /i " %my_preclear_build_directory% " == " Yes" (
49
49
call :log_section Pre-clear previous build infrastructure
50
50
@@ -63,7 +63,7 @@ if /i "%my_preclear_build_directory%"=="Yes" (
63
63
)
64
64
)
65
65
66
- REM === Step: Create new build ===
66
+ REM === Step 05 : Create new build ===
67
67
call :log_section Create a new build
68
68
69
69
REM Activate base build environment
@@ -92,7 +92,7 @@ if not exist "%WINPYDIRBASE%\scripts\env.bat" (
92
92
exit /b 1
93
93
)
94
94
95
- REM === Step: Add pre-requisite packages ===
95
+ REM === Step 06 : Add pre-requisite packages ===
96
96
call :log_section Add pre-requisite packages
97
97
98
98
set " path = %my_original_path% "
@@ -110,14 +110,14 @@ if defined my_requirements_pre (
110
110
echo No pre-requisite packages specified >> " %my_archive_log% "
111
111
)
112
112
113
- REM === Step: Install main requirement packages ===
113
+ REM === Step 07 : Install main requirement packages ===
114
114
call :log_section Add main requirement packages
115
115
python -m pip install -r " %my_requirements% " -c " %my_constraints% " --pre --no-index --trusted-host=None --find-links=" %my_find_links% " >> " %my_archive_log% "
116
116
117
117
REM Patch installed packages to be portable (WinPython style)
118
118
python -c " from wppm import wppm;dist=wppm.Distribution(r'%WINPYDIR% ');dist.patch_standard_packages('', to_movable=True)"
119
119
120
- REM === Define lockfile paths for included wheels ===
120
+ REM === Step 08: Define lockfile paths for included wheels ===
121
121
set " WINPYVERLOCK = %WINPYVER2:. =_ % "
122
122
set " LOCKDIR = %WINPYDIRBASE% \..\"
123
123
@@ -126,7 +126,7 @@ set "pip_lock_includedweb=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%
126
126
set " req_lock_includedlocal = %LOCKDIR% requir.%WINPYARCH% -%WINPYVERLOCK%%my_flavor%%my_release_level% _wheelslocal.txt"
127
127
set " req_lock_includedweb = %LOCKDIR% requir.%WINPYARCH% -%WINPYVERLOCK%%my_flavor%%my_release_level% _wheels.txt"
128
128
129
- REM === Step: Add lockfile wheels for the Wheelhouse (optional) ===
129
+ REM === Step 09 : Add lockfile wheels for the Wheelhouse (optional) ===
130
130
if defined wheelhousereq if exist " %wheelhousereq% " (
131
131
call :log_section Add wheels for the Wheelhouse
132
132
@@ -147,7 +147,7 @@ rem set path=%my_original_path%
147
147
rem call %my_WINPYDIRBASE%\scripts\env.bat
148
148
149
149
150
- REM === Freeze environment and generate final lockfiles ===
150
+ REM === Step 10: Freeze environment and generate final lockfiles ===
151
151
call :log_section Freeze environment and generate lockfiles
152
152
153
153
set " req = %LOCKDIR% requirement.%my_flavor% -%WINPYARCH% bit-%WINPYVERLOCK% _raw.txt"
@@ -188,12 +188,7 @@ copy /Y "%req_lock_web%" "%my_changelog_reqfile%"
188
188
189
189
call :log_section Archive success
190
190
191
- rem set path=%my_original_path%
192
- rem call %my_WINPYDIRBASE%\scripts\env.bat
193
-
194
- %target_python_exe% -m pip freeze > %my_archive_log% .packages_versions.txt
195
-
196
- REM === Step 13: Generate changelog and binaries ===
191
+ REM === Step 11: Generate changelog and binaries ===
197
192
call :log_section Generate changelog and binaries
198
193
199
194
REM Define markdown changelog filenames
@@ -212,12 +207,24 @@ REM === Step 13b: Compress distribution to .7z or installer ===
212
207
set " stem = WinPython%my_arch% -%WINPYVER2%%my_flavor%%my_release_level% "
213
208
%target_python_exe% -c " from wppm import utils; utils.command_installer_7zip(r'%my_WINPYDIRBASE% ', r'%my_WINPYDIRBASE% \..', r'%stem% ', r'%my_create_installer% ')"
214
209
210
+ REM === Step 12: Final logs and cleanup ===
211
+ call :log_section Final logs and cleanup
212
+
213
+ REM Restore environment
214
+ set " path = %my_original_path% "
215
+ call " %my_WINPYDIRBASE% \scripts\env.bat"
216
+
217
+ REM Freeze final package versions to archive
218
+ %target_python_exe% -m pip freeze > " %my_archive_log% .packages_versions.txt"
219
+
215
220
call :log_section END OF CREATION
216
221
217
- start notepad.exe %my_archive_log%
218
- start notepad.exe %my_archive_log% .packages_versions.txt
222
+ REM Open log files in Notepad for review
223
+ start notepad.exe " %my_archive_log% "
224
+ start notepad.exe " %my_archive_log% .packages_versions.txt"
219
225
220
- set path = %my_original_path%
226
+ REM Restore path again (in case env.bat changed it)
227
+ set " path = %my_original_path% "
221
228
pause
222
229
exit
223
230
0 commit comments