8000 [pull] master from winpython:master by pull[bot] · Pull Request #86 · blog2i2j/winpython.._..winpython · GitHub
[go: up one dir, main page]

Skip to content

[pull] master from winpython:master #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions generate_a_winpython_distro.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rem generate_a_winpython_distro.bat: to be launched from a winpython directory,
@echo on

REM Initialize variables
if "%my_release_level%"=="" set my_release_level=b4
if "%my_release_level%"=="" set my_release_level=
if "%my_create_installer%"=="" set my_create_installer=True

rem Set archive directory and log file
Expand All @@ -25,10 +25,10 @@ rem 2021-04-22 : path PyPy3 (as we don't try to copy PyPy3.exe to Python.exe)
if "%target_python_exe%"=="" set target_python_exe=python.exe

rem Set Python target release based on my_python_target
if %my_python_target%==311 set my_python_target_release=3119& set my_release=1
if %my_python_target%==312 set my_python_target_release=31210& set my_release=1
if %my_python_target%==313 set my_python_target_release=3133& set my_release=1
if %my_python_target%==314 set my_python_target_release=3140& set my_release=0
if %my_python_target%==311 set my_python_target_release=3119& set my_release=2
if %my_python_target%==312 set my_python_target_release=31210& set my_release=2
if %my_python_target%==313 set my_python_target_release=3135& set my_release=1
if %my_python_target%==314 set my_python_target_release=3140& set my_release=1

echo -------------------------------------- >>%my_archive_log%
echo (%date% %time%) preparing winPython for %my_pyver% (%my_python_target%)release %my_release%%my_flavor% (%my_release_level%) *** %my_arch% bit ***>>%my_archive_log%
Expand Down Expand Up @@ -59,7 +59,7 @@ call %my_buildenv%\scripts\env.bat

REM Create basic build infrastructure
echo "(%date% %time%) Create basic build infrastructure">>%my_archive_log%
python.exe -c "from make import *;make_all(%my_release%, '%my_release_level%', pyver='%my_pyver%', basedir=r'%my_basedir%', verbose=True, architecture=%my_arch%, flavor='%my_flavor%', install_options=r'%my_install_options%', find_links=r'%my_find_links%', source_dirs=r'%my_source_dirs%', toolsdirs=r'%my_toolsdirs%', docsdirs=r'%my_docsdirs%', create_installer='False', python_target_release='%my_python_target_release%')">>%my_archive_log%
python.exe -c "from make import *;make_all(%my_release%, '%my_release_level%', pyver='%my_pyver%', basedir=r'%my_basedir%', verbose=True, architecture=%my_arch%, flavor='%my_flavor%', install_options=r'%my_install_options%', find_links=r'%my_find_links%', source_dirs=r'%my_source_dirs%', toolsdirs=r'%my_toolsdirs%', create_installer='False', python_target_release='%my_python_target_release%')">>%my_archive_log%

REM Check infrastructure is in place
echo "(%date% %time%) Check infrastructure">>%my_archive_log%
Expand Down Expand Up @@ -99,7 +99,7 @@ echo -------------------------------------- >>%my_archive_log%
echo "(%date% %time%) Add requirement packages">>%my_archive_log%
echo -------------------------------------- >>%my_archive_log%
python -m pip install -r %my_requirements% -c %my_constraints% --pre --no-index --trusted-host=None --find-links=%my_find_links% >>%my_archive_log%
python -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('spyder', to_movable=True)"
python -c "from wppm import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('spyder', to_movable=True)"

REM Add Wheelhouse (to replace per pip lock direct ? would allow paralellism)
echo -------------------------------------- >>%my_archive_log%
Expand All @@ -125,13 +125,19 @@ set pip_lock_includedweb=%LOCKDIR%pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOC
set req_lock_includedlocal=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_includedwheelslocal.txt
set req_lock_includedweb=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_includedwheels.txt

set pip_lock_includedlocal=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheelslocal.toml
set pip_lock_includedweb=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheels.toml
set req_lock_includedlocal=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheelslocal.txt
set req_lock_includedweb=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_wheels.txt


if not "Z%wheelhousereq%Z"=="ZZ" if exist "%wheelhousereq%" (
echo JOYYYwheelhousereq=%wheelhousereq%
echo z%pip_lock_includedlocal%z=%pip_lock_includedlocal%
rem no winpython in it naturally, with deps
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%
rem generating also classic requirement with hash-256, from obtained pylock.toml
python.exe -c "from winpython import wheelhouse as wh;wh.pylock_to_req(r'%pip_lock_includedlocal%', r'%req_lock_includedlocal%')"
python.exe -c "from wppm import wheelhouse as wh;wh.pylock_to_req(r'%pip_lock_includedlocal%', r'%req_lock_includedlocal%')"

rem same with frozen web from local
python.exe -m pip lock --no-deps --require-hashes -c C:\WinP\constraints.txt -r "%req_lock_includedlocal%" -o %pip_lock_includedweb%
Expand All @@ -154,20 +160,17 @@ set LOCKDIR=%WINPYDIRBASE%\..\
set WINPYVERLOCK=%WINPYVER2:.=_%
set req=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_raw.txt
set wanted_req=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%.txt
set pip_lock_web=%LOCKDIR%pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%.toml
set pip_lock_local=%LOCKDIR%pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_local.toml
set req_lock_web=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%.txt
set req_lock_local=%LOCKDIR%requirement.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_local.txt

set pip_lock_web=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%.toml
set pip_lock_local=%LOCKDIR%pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_local.toml
set req_lock_web=%LOCKDIR%requirement.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%.txt
set req_lock_local=%LOCKDIR%requirement.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_local.txt
set req_lock_web=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%.txt
set req_lock_local=%LOCKDIR%requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%_local.txt


set my_archive_lockfile=%my_archive_dir%\pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_%date:/=-%at_%my_time%.toml
set my_archive_lockfile_local=%my_archive_dir%\pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%_%date:/=-%at_%my_time%.local.toml
set my_changelog_lockfile=%~dp0changelogs\pylock.%my_flavor%-%WINPYARCH%bit-%WINPYVERLOCK%.toml
set my_changelog_lockfile=%~dp0changelogs\pylock.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%.toml
set my_changelog_reqfile=%~dp0changelogs\requir.%WINPYARCH%-%WINPYVERLOCK%%my_flavor%%my_release_level%.txt

python.exe -m pip freeze>%req%
findstr /v "winpython" %req% > %wanted_req%
Expand All @@ -180,14 +183,15 @@ rem pip lock from local WheelHouse, from the frozen req
python.exe -m pip lock --no-deps --no-index --trusted-host=None --find-links=C:\WinP\packages.srcreq -c C:\WinP\constraints.txt -r "%wanted_req%" -o %pip_lock_local%

rem generating also classic requirement with hash-256, from obtained pylock.toml
python.exe -c "from winpython import wheelhouse as wh;wh.pylock_to_req(r'%pip_lock_web%', r'%req_lock_web%')"
python.exe -c "from winpython import wheelhouse as wh;wh.pylock_to_req(r'%pip_lock_local%', r'%req_lock_local%')"
python.exe -c "from wppm import wheelhouse as wh;wh.pylock_to_req(r'%pip_lock_web%', r'%req_lock_web%')"
python.exe -c "from wppm import wheelhouse as wh;wh.pylock_to_req(r'%pip_lock_local%', r'%req_lock_local%')"

rem compare the two (result from pypi and local Wheelhouse must be equal)
fc "%req_lock_web%" "%req_lock_local%"

copy/Y %pip_lock_web% %my_archive_lockfile%
copy/Y %pip_lock_web% %my_changelog_lockfile%
copy/Y %req_lock_web% %my_changelog_reqfile%


REM Archive success
Expand Down
3 changes: 1 addition & 2 deletions generate_winpython_distros313_dot.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set my_release_level=

rem list of installers to create separated per dot: False=none, .zip=zip, .7z=.7z, 7zip=auto-extractible 7z
set my_create_installer=7zip.7z.zip
set my_create_installer=7zip.zip

set my_preclear_build_directory=Yes

Expand All @@ -25,11 +26,9 @@ set my_source_dirs=C:\Winp\bd313\packages.win-amd64

set my_find_links=C:\Winp\packages.srcreq
set my_toolsdirs=C:\Winp\bdTools\Tools.dot
set my_docsdirs=C:\WinP\bdDocs\docs.dot

set my_install_options=--no-index --pre --trusted-host=None

call %~dp0\generate_a_winpython_distro.bat


pause
3 changes: 0 additions & 3 deletions generate_winpython_distros313_slim.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ set my_toolsdirs=C:\Winp\bdTools\Tools.dot
REM 2024-07-13:put back pandoc (so from 598Mo to 518Mo?)
set my_toolsdirs=C:\WinP\bdTools\tools64_pandoc_alone

set my_docsdirs=C:\WinP\bdDocs\docs.dot

set my_install_options=--no-index --pre --trusted-host=None

call %~dp0\generate_a_winpython_distro.bat


pause
5 changes: 2 additions & 3 deletions generate_winpython_distros313_wheel.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ set my_release_level=

rem list of installers to create separated per dot: False=none, .zip=zip, .7z=.7z, 7zip=auto-extractible 7z
set my_create_installer=7zip-mx5.7z-mx7.zip
set my_create_installer=.7z-mx7

set my_create_installer=.7z-mx9
set my_preclear_build_directory=Yes

set tmp_reqdir=%my_root_dir_for_builds%\bd%my_python_target%
Expand All @@ -26,12 +25,12 @@ set my_source_dirs=C:\Winp\bd313\packages.win-amd64

set my_find_links=C:\Winp\packages.srcreq
set my_toolsdirs=C:\Winp\bdTools\Tools.dot
set my_docsdirs=C:\WinP\bdDocs\docs.dot

set my_install_options=--no-index --pre --trusted-host=None

rem set addlockfile=dot

set wheelhousereq=C:\Winp\bd313\dot_requirements.txt
set wheelhousereq=C:\Winp\bd313\requirements64_whl.txt


Expand Down
36 changes: 5 additions & 31 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class WinPythonDistributionBuilder:
"""Builds a WinPython distribution."""

def __init__(self, build_number: int, release_level: str, target_directory: Path, wheels_directory: Path,
tools_directories: list[Path] = None, documentation_directories: list[Path] = None, verbose: bool = False,
tools_directories: list[Path] = None, verbose: bool = False,
base_directory: Path = None, install_options: list[str] = None, flavor: str = ""):
"""
Initializes the WinPythonDistributionBuilder.
Expand All @@ -68,7 +68,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
target_directory: The base directory where WinPython will be created.
wheels_directory: Directory containing wheel files for packages.
tools_directories: List of directories containing development tools to include.
documentation_directories: List of directories containing documentation to include.
verbose: Enable verbose output.
base_directory: Base directory for building (optional, for relative paths).
install_options: Additional pip install options.
Expand All @@ -79,7 +78,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
self.target_directory = Path(target_directory)
self.wheels_directory = Path(wheels_directory)
self.tools_directories = tools_directories or []
self.documentation_directories = documentation_directories or []
self.verbose = verbose
self.winpython_directory: Path | None = None
self.distribution: wppm.Distribution | None = None
Expand Down Expand Up @@ -184,7 +182,7 @@ def _create_initial_batch_scripts(self):
with open(self.winpython_directory / "scripts" / "env.ini", "w") as f:
f.writelines([f'{a}={b}\n' for a, b in init_variables])

def build(self, rebuild: bool = True, requirements_files_list=None, winpy_dirname: str = None):
def build(self, rebuild: bool = True, winpy_dirname: str = None):
"""Make or finalise WinPython distribution in the target directory"""
print(f"Building WinPython with Python archive: {self.python_zip_file.name}")
if winpy_dirname is None:
Expand All @@ -207,21 +205,13 @@ def build(self, rebuild: bool = True, requirements_files_list=None, winpy_dirnam
self._create_initial_batch_scripts()
utils.python_execmodule("ensurepip", self.distribution.target)
self.distribution.patch_standard_packages("pip")

essential_packages = ["pip", "setuptools", "wheel", "wppm"]
for package_name in essential_packages:
actions = ["install", "--upgrade", "--pre", package_name] + self.install_options
self._print_action(f"Piping: {' '.join(actions)}")
self.distribution.do_pip_action(actions)
self.distribution.patch_standard_packages(package_name)

if requirements_files_list:
for req in requirements_files_list:
actions = ["install", "-r", req] + (self.install_options or [])
self._print_action(f"Piping: {' '.join(actions)}")
self.distribution.do_pip_action(actions)
self.distribution.patch_standard_packages()

self._print_action("Writing package index")
self.winpyver2 = f"{self.python_full_version}.{self.build_number}"
output_markdown_filename = str(self.winpython_directory.parent / f"WinPython{self.flavor}-{self.distribution.architecture}bit-{self.winpyver2}.md")
Expand All @@ -232,17 +222,10 @@ def build(self, rebuild: bool = True, requirements_files_list=None, winpy_dirnam
shutil.copyfile(output_markdown_filename, str(Path(CHANGELOGS_DIRECTORY) / Path(output_markdown_filename).name))
diff.write_changelog(self.winpyver2, None, CHANGELOGS_DIRECTORY, self.flavor, self.distribution.architecture, basedir=self.winpython_directory.parent)

def rebuild_winpython_package(source_directory: Path, target_directory: Path, architecture: int = 64, verbose: bool = False):
"""Rebuilds the winpython or wppm package from source using flit."""
for file in target_directory.glob("w*p*-*.*"):
if file.suffix in (".exe", ".whl", ".gz"):
file.unlink()
utils.buildflit_wininst(source_directory, copy_to=target_directory, verbose=True)

def make_all(build_number: int, release_level: str, pyver: str, architecture: int, basedir: Path,
verbose: bool = False, rebuild: bool = True, create_installer: str = "True", install_options=["--no-index"],
flavor: str = "", requirements: str | list[Path] = None, find_links: str | list[Path] = None,
source_dirs: Path = None, toolsdirs: str | list[Path] = None, docsdirs: str | list[Path] = None,
flavor: str = "", find_links: str | list[Path] = None,
source_dirs: Path = None, toolsdirs: str | list[Path] = None,
python_target_release: str = None, # e.g. "37101" for 3.7.10
):
"""
Expand All @@ -258,34 +241,27 @@ def make_all(build_number: int, release_level: str, pyver: str, architecture: in
create_installer: Type of installer to create (str).
install_options: pip options (r'--no-index --pre --trusted-host=None')
flavor: WinPython flavor (str).
requirements: package lists for pip (r'D:\requirements.txt')
find_links: package directories (r'D:\Winpython\packages.srcreq')
source_dirs: the python.zip + rebuilt winpython wheel package directory
toolsdirs: Directory with development tools r'D:\WinPython\basedir34\t.Slim'
docsdirs: Directory with documentation r'D:\WinPython\basedir34\docs.Slim'
python_target_release: Target Python release (str).
"""
assert basedir is not None, "The *basedir* directory must be specified"
assert architecture in (32, 64)

tools_dirs_list = parse_list_argument(toolsdirs, ",")
docs_dirs_list = parse_list_argument(docsdirs, ",")
install_options_list = parse_list_argument(install_options, " ")
find_links_dirs_list = parse_list_argument(find_links, ",")
requirements_files_list = [Path(f) for f in parse_list_argument(requirements, ",") if f]
find_links_options = [f"--find-links={link}" for link in find_links_dirs_list + [source_dirs]]
build_directory = Path(basedir) / ("bu" + flavor)

if rebuild:
utils.print_box(f"Making WinPython {architecture}bits at {Path(basedir) / ('bu' + flavor)}")
os.makedirs(build_directory, exist_ok=True)
# use source_dirs as the directory to re-build Winpython wheel
winpython_source_dir = Path(__file__).resolve().parent

builder = WinPythonDistributionBuilder(
build_number, release_level, build_directory, wheels_directory=source_dirs,
tools_directories=[Path(d) for d in tools_dirs_list],
documentation_directories=[Path(d) for d in docs_dirs_list],
verbose=verbose, base_directory=basedir,
install_options=install_options_list + find_links_options,
flavor=flavor
Expand All @@ -300,7 +276,7 @@ def make_all(build_number: int, release_level: str, pyver: str, architecture: in
else:
winpython_dirname = f"WPy{architecture}-{pyver.replace('.', '')}{python_minor_version_str}{build_number}{release_level}"

builder.build(rebuild=rebuild, requirements_files_list=requirements_files_list, winpy_dirname=winpython_dirname)
builder.build(rebuild=rebuild, winpy_dirname=winpython_dirname)

for commmand in create_installer.lower().replace("7zip",".exe").split('.'):
installer_type, compression = (commmand + "-").split("-")[:2]
5496 Expand All @@ -316,10 +292,8 @@ def make_all(build_number: int, release_level: str, pyver: str, architecture: in
verbose=True,
architecture=64,
flavor="Barebone",
requirements=r"D:\Winpython\basedir34\barebone_requirements.txt",
install_options=r"--no-index --pre --trusted-host=None",
find_links=r"D:\Winpython\packages.srcreq",
source_dirs=r"D:\WinPython\basedir34\packages.win-amd64",
toolsdirs=r"D:\WinPython\basedir34\t.Slim",
docsdirs=r"D:\WinPython\basedir34\docs.Slim",
)
0