11rem generate_a_winpython_distro.bat: to be launched from a winpython directory, where 'make.py' is
22@ echo on
33
4- REM === Set default values if not already defined ===
4+ REM === Step 01: Set default values if not already defined ===
55if not defined my_release_level set " my_release_level = b1"
66if not defined my_create_installer set " my_create_installer = True"
77if not defined my_constraints set " my_constraints = C:\WinP\constraints.txt"
@@ -19,7 +19,7 @@ set "my_time=%my_time: =0%"
1919REM === Define archive log file path ===
2020set " my_archive_log = %my_archive_dir% \build_%my_pyver% _%my_release%%my_flavor% _%my_release_level% _of_%date:/ =- % at_%my_time% .txt"
2121
22- REM === Set Python version and release ===
22+ REM === Step 02: Set Python version and release ===
2323if " %my_python_target% " == " 311" (
2424 set " my_python_target_release = 3119"
2525 set " my_release = 2"
@@ -34,7 +34,7 @@ if "%my_python_target%"=="311" (
3434 set " my_release = 1"
3535)
3636
37- REM === Define base build and distribution paths ===
37+ REM === Step 03: Define base build and distribution paths ===
3838set " my_basedir = %my_root_dir_for_builds% \bd%my_python_target% "
3939set " my_WINPYDIRBASE = %my_basedir% \bu%my_flavor% \WPy%my_arch% -%my_python_target_release%%my_release%%my_release_level% "
4040
@@ -44,7 +44,7 @@ set my_buildenv=C:\WinPdev\WPy64-310111
4444
4545call :log_section preparing winPython for %my_pyver% (%my_python_target% )release %my_release%%m y_flavor% (%my_release_level% ) *** %my_arch% bit ***
4646
47- REM === Step: Pre-clear previous build infrastructure ===
47+ REM === Step 04 : Pre-clear previous build infrastructure ===
4848if /i " %my_preclear_build_directory% " == " Yes" (
4949 call :log_section Pre-clear previous build infrastructure
5050
@@ -63,7 +63,7 @@ if /i "%my_preclear_build_directory%"=="Yes" (
6363 )
6464)
6565
66- REM === Step: Create new build ===
66+ REM === Step 05 : Create new build ===
6767call :log_section Create a new build
6868
6969REM Activate base build environment
@@ -92,7 +92,7 @@ if not exist "%WINPYDIRBASE%\scripts\env.bat" (
9292 exit /b 1
9393)
9494
95- REM === Step: Add pre-requisite packages ===
95+ REM === Step 06 : Add pre-requisite packages ===
9696call :log_section Add pre-requisite packages
9797
9898set " path = %my_original_path% "
@@ -110,14 +110,14 @@ if defined my_requirements_pre (
110110 echo No pre-requisite packages specified >> " %my_archive_log% "
111111)
112112
113- REM === Step: Install main requirement packages ===
113+ REM === Step 07 : Install main requirement packages ===
114114call :log_section Add main requirement packages
115115python -m pip install -r " %my_requirements% " -c " %my_constraints% " --pre --no-index --trusted-host=None --find-links=" %my_find_links% " >> " %my_archive_log% "
116116
117117REM Patch installed packages to be portable (WinPython style)
118118python -c " from wppm import wppm;dist=wppm.Distribution(r'%WINPYDIR% ');dist.patch_standard_packages('', to_movable=True)"
119119
120- REM === Define lockfile paths for included wheels ===
120+ REM === Step 08: Define lockfile paths for included wheels ===
121121set " WINPYVERLOCK = %WINPYVER2:. =_ % "
122122set " LOCKDIR = %WINPYDIRBASE% \..\"
123123
@@ -126,7 +126,7 @@ set "pip_lock_includedweb=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%
126126set " req_lock_includedlocal = %LOCKDIR% requir.%WINPYARCH% -%WINPYVERLOCK%%my_flavor%%my_release_level% _wheelslocal.txt"
127127set " req_lock_includedweb = %LOCKDIR% requir.%WINPYARCH% -%WINPYVERLOCK%%my_flavor%%my_release_level% _wheels.txt"
128128
129- REM === Step: Add lockfile wheels for the Wheelhouse (optional) ===
129+ REM === Step 09 : Add lockfile wheels for the Wheelhouse (optional) ===
130130if defined wheelhousereq if exist " %wheelhousereq% " (
131131 call :log_section Add wheels for the Wheelhouse
132132
@@ -147,7 +147,7 @@ rem set path=%my_original_path%
147147rem call %my_WINPYDIRBASE%\scripts\env.bat
148148
149149
150- REM === Freeze environment and generate final lockfiles ===
150+ REM === Step 10: Freeze environment and generate final lockfiles ===
151151call :log_section Freeze environment and generate lockfiles
152152
153153set " req = %LOCKDIR% requirement.%my_flavor% -%WINPYARCH% bit-%WINPYVERLOCK% _raw.txt"
@@ -188,12 +188,7 @@ copy /Y "%req_lock_web%" "%my_changelog_reqfile%"
188188
189189call :log_section Archive success
190190
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 ===
197192call :log_section Generate changelog and binaries
198193
199194REM Define markdown changelog filenames
@@ -212,12 +207,24 @@ REM === Step 13b: Compress distribution to .7z or installer ===
212207set " stem = WinPython%my_arch% -%WINPYVER2%%my_flavor%%my_release_level% "
213208%target_python_exe% -c " from wppm import utils; utils.command_installer_7zip(r'%my_WINPYDIRBASE% ', r'%my_WINPYDIRBASE% \..', r'%stem% ', r'%my_create_installer% ')"
214209
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+
215220call :log_section END OF CREATION
216221
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"
219225
220- set path = %my_original_path%
226+ REM Restore path again (in case env.bat changed it)
227+ set " path = %my_original_path% "
221228pause
222229exit
223230
0 commit comments