Skip to content

Commit bdab635

Browse files
authored
Merge pull request #1694 from stonebig/master
DOS build clean-up: final clean-up
2 parents 21b9697 + 3375635 commit bdab635

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

generate_a_winpython_distro.bat

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rem 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 ===
55
if not defined my_release_level set "my_release_level=b1"
66
if not defined my_create_installer set "my_create_installer=True"
77
if not defined my_constraints set "my_constraints=C:\WinP\constraints.txt"
@@ -19,7 +19,7 @@ set "my_time=%my_time: =0%"
1919
REM === Define archive log file path ===
2020
set "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 ===
2323
if "%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 ===
3838
set "my_basedir=%my_root_dir_for_builds%\bd%my_python_target%"
3939
set "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

4545
call :log_section preparing winPython for %my_pyver% (%my_python_target%)release %my_release%%my_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 ===
4848
if /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 ===
6767
call :log_section Create a new build
6868

6969
REM 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 ===
9696
call :log_section Add pre-requisite packages
9797

9898
set "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 ===
114114
call :log_section Add main requirement packages
115115
python -m pip install -r "%my_requirements%" -c "%my_constraints%" --pre --no-index --trusted-host=None --find-links="%my_find_links%" >>"%my_archive_log%"
116116

117117
REM Patch installed packages to be portable (WinPython style)
118118
python -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 ===
121121
set "WINPYVERLOCK=%WINPYVER2:.=_%"
122122
set "LOCKDIR=%WINPYDIRBASE%\..\"
123123

@@ -126,7 +126,7 @@ set "pip_lock_includedweb=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%
126126
set "req_lock_includedlocal=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheelslocal.txt"
127127
set "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) ===
130130
if 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%
147147
rem 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 ===
151151
call :log_section Freeze environment and generate lockfiles
152152

153153
set "req=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_raw.txt"
@@ -188,12 +188,7 @@ copy /Y "%req_lock_web%" "%my_changelog_reqfile%"
188188

189189
call :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 ===
197192
call :log_section Generate changelog and binaries
198193

199194
REM Define markdown changelog filenames
@@ -212,12 +207,24 @@ REM === Step 13b: Compress distribution to .7z or installer ===
212207
set "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+
215220
call :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%"
221228
pause
222229
exit
223230

0 commit comments

Comments
 (0)