Skip to content

Commit 02d649e

Browse files
committed
DOS clean-up with openai: Add Lockfile Wheels
1 parent a6d6cfd commit 02d649e

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

generate_a_winpython_distro.bat

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,39 @@ if defined my_requirements_pre (
110110
echo No pre-requisite packages specified >>"%my_archive_log%"
111111
)
112112

113-
call :log_section Add requirement packages
113+
REM === Step: Install main requirement packages ===
114+
call :log_section Add main requirement packages
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%"
114116

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%
117+
REM Patch installed packages to be portable (WinPython style)
116118
python -c "from wppm import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('', to_movable=True)"
117119

118-
call :log_section Add lockfile wheels
120+
REM === Define lockfile paths for included wheels ===
121+
set "WINPYVERLOCK=%WINPYVER2:.=_%"
122+
set "LOCKDIR=%WINPYDIRBASE%\..\"
123+
124+
set "pip_lock_includedlocal=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheelslocal.toml"
125+
set "pip_lock_includedweb=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheels.toml"
126+
set "req_lock_includedlocal=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheelslocal.txt"
127+
set "req_lock_includedweb=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheels.txt"
128+
129+
@echo on
130+
REM === Step: Add lockfile wheels for the Wheelhouse (optional) ===
131+
if defined wheelhousereq if exist "%wheelhousereq%" (
132+
call :log_section Add wheels for the Wheelhouse
133+
134+
REM Generate pylock from wheelhousereq
135+
python -m pip lock --no-index --trusted-host=None --find-links="%my_find_links%" -c "%my_constraints%" -r "%wheelhousereq%" -o "%pip_lock_includedlocal%"
136+
137+
REM Convert pylock to requirement file with hashes
138+
python -c "from wppm import wheelhouse as wh; wh.pylock_to_req(r'%pip_lock_includedlocal%', r'%req_lock_includedlocal%')"
139+
140+
REM Freeze lock again from local hashes
141+
python -m pip lock --no-deps --require-hashes -c "%my_constraints%" -r "%req_lock_includedlocal%" -o "%pip_lock_includedweb%"
142+
143+
REM Use wppm to install from lock
144+
"%my_WINPYDIRBASE%\python\scripts\wppm.exe" "%pip_lock_includedweb%" -ws "%my_find_links%" -wd "%my_WINPYDIRBASE%\wheelhouse\included.wheels"
145+
)
119146

120147
set path=%my_original_path%
121148
@echo on
@@ -130,33 +157,8 @@ echo %my_WINPYDIRBASE%\python\scripts\wppm.exe "%pylockinclude%" -ws "%my_find_
130157
)
131158

132159
@echo on
133-
echo wheelhousereq=%wheelhousereq%
134-
set LOCKDIR=%WINPYDIRBASE%\..\
135-
set pip_lock_includedlocal=%LOCKDIR%pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_includedwheelslocal.toml
136-
set pip_lock_includedweb=%LOCKDIR%pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_includedwheels.toml
137-
set req_lock_includedlocal=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_includedwheelslocal.txt
138-
set req_lock_includedweb=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_includedwheels.txt
139-
140-
set pip_lock_includedlocal=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheelslocal.toml
141-
set pip_lock_includedweb=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheels.toml
142-
set req_lock_includedlocal=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheelslocal.txt
143-
set req_lock_includedweb=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheels.txt
144-
145-
146-
if not "Z%wheelhousereq%Z"=="ZZ" if exist "%wheelhousereq%" (
147-
echo JOYYYwheelhousereq=%wheelhousereq%
148-
echo z%pip_lock_includedlocal%z=%pip_lock_includedlocal%
149-
rem no winpython in it naturally, with deps
150-
python.exe -m pip lock --no-index --trusted-host=None --find-links=%my_find_links% -c C:\WinP\constraints.txt -r "%wheelhousereq%" -o %pip_lock_includedlocal%
151-
rem generating also classic requirement with hash-256, from obtained pylock.toml
152-
python.exe -c "from wppm import wheelhouse as wh;wh.pylock_to_req(r'%pip_lock_includedlocal%', r'%req_lock_includedlocal%')"
153160

154-
rem same with frozen web from local
155-
python.exe -m pip lock --no-deps --require-hashes -c C:\WinP\constraints.txt -r "%req_lock_includedlocal%" -o %pip_lock_includedweb%
156161

157-
echo %my_WINPYDIRBASE%\python\scripts\wppm.exe "%pip_lock_includedweb%" -ws "%my_find_links%" -wd "%my_WINPYDIRBASE%\wheelhouse\included.wheels">>%my_archive_log%
158-
%my_WINPYDIRBASE%\python\scripts\wppm.exe "%pip_lock_includedweb%" -ws "%my_find_links%" -wd "%my_WINPYDIRBASE%\wheelhouse\included.wheels"
159-
)
160162

161163
call :log_section generate pylock.toml files and requirement.txt with hash files
162164

0 commit comments

Comments
 (0)