Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

move essential packages installation out of make.py#1677

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
stonebig merged 2 commits intowinpython:masterfromstonebig:master
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
10 changes: 7 additions & 3 deletionsgenerate_a_winpython_distro.bat
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,7 +61,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%', basedir_wpy=r'%my_WINPYDIRBASE%', verbose=True, 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%')">>%my_archive_log%
python.exe -c "from make import *;make_all(%my_release%, '%my_release_level%', basedir_wpy=r'%my_WINPYDIRBASE%', verbose=True, flavor='%my_flavor%', source_dirs=r'%my_source_dirs%', toolsdirs=r'%my_toolsdirs%')">>%my_archive_log%

REM Check infrastructure is in place
echo "(%date% %time%) Check infrastructure">>%my_archive_log%
Expand All@@ -87,7 +87,11 @@ echo -------------------------------------- >>%my_archive_log%
set path=%my_original_path%
call %my_WINPYDIRBASE%\scripts\env.bat

rem Install pre-requirements if any
rem python -m ensurepip
rem insta essential packages
python -m pip install --upgrade pip setuptools wheel wppm -c %my_constraints% --pre --no-index --trusted-host=None --find-links=%my_find_links% >>%my_archive_log%

rem Install complementary pre-requirements if any
if not "Z%my_requirements_pre%Z"=="ZZ" (
if "%my_find_links_pre%"=="" set my_find_links_pre=%my_find_links%
python -m pip install -r %my_requirements_pre% -c %my_constraints% --pre --no-index --trusted-host=None --find-links=%my_find_links_pre% >> %my_archive_log%
Expand All@@ -100,7 +104,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 wppm 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('', to_movable=True)"

REM Add Wheelhouse (to replace per pip lock direct ? would allow paralellism)
echo -------------------------------------- >>%my_archive_log%
Expand Down
32 changes: 5 additions & 27 deletionsmake.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,8 +14,6 @@

# Define constant paths for clarity
PORTABLE_DIRECTORY = Path(__file__).parent / "portable"

# Ensure necessary directories exist at the start
assert PORTABLE_DIRECTORY.is_dir(), f"Portable directory not found: {PORTABLE_DIRECTORY}"

def copy_items(source_directories: list[Path], target_directory: Path, verbose: bool = False):
Expand DownExpand Up@@ -46,7 +44,7 @@ class WinPythonDistributionBuilder:

def __init__(self, build_number: int, release_level: str, target_directory: Path, wheels_directory: Path,
tools_directories: list[Path] = None, verbose: bool = False,
install_options: list[str] = None,flavor: str = ""):
flavor: str = ""):
"""
Initializes the WinPythonDistributionBuilder.
Args:
Expand All@@ -56,7 +54,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
wheels_directory: Directory containing wheel files for packages.
tools_directories: List of directories containing development tools to include.
verbose: Enable verbose output.
install_options: Additional pip install options.
flavor: WinPython flavor (e.g., "Barebone").
"""
self.build_number = build_number
Expand All@@ -67,7 +64,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
self.verbose = verbose
self.winpython_directory: Path | None = None
self.distribution: wppm.Distribution | None = None
self.install_options = install_options or []
self.flavor = flavor
self.python_zip_file: Path = self._get_python_zip_file()
self.python_name = self.python_zip_file.stem
Expand DownExpand Up@@ -141,12 +137,10 @@ def _create_initial_batch_scripts(self):
def build(self, winpy_dir: Path = None):
"""Make or finalise WinPython distribution in the target directory"""
print(f"Building WinPython with Python archive: {self.python_zip_file.name}")
if winpy_dir is None:
raise RuntimeError("WinPython base directory to create is undefined")
self.winpython_directory = winpy_dir

self._print_action(f"Creating WinPython {self.winpython_directory} base directory")
if self.winpython_directory.is_dir():
if self.winpython_directory.is_dir() and len(self.winpython_directory.parts)>=4:
shutil.rmtree(self.winpython_directory)
os.makedirs(self.winpython_directory, exist_ok=True)
# preventive re-Creation of settings directory
Expand All@@ -157,18 +151,10 @@ def build(self, winpy_dir: Path = None):

self._copy_essential_files()
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)

def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
verbose: bool = False, install_options=["--no-index"],
flavor: str = "", find_links: str | list[Path] = None,
verbose: bool = False,
flavor: str = "",
source_dirs: Path = None, toolsdirs: str | list[Path] = None,
):
"""
Expand All@@ -178,18 +164,13 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
release_level: release level (e.g. 'beta1', '') [str]
basedir_wpy: top directory of the build (c:\...\Wpy...)
verbose: Enable verbose output (bool).
install_options: pip options (r'--no-index --pre --trusted-host=None')
flavor: WinPython flavor (str).
find_links: package directories (r'D:\Winpython\packages.srcreq')
source_dirs: the python.zip + rebuilt winpython wheel package directory
source_dirs: the python.zip
toolsdirs: Directory with development tools r'D:\WinPython\basedir34\t.Slim'
"""
assert basedir_wpy is not None, "The *winpython_dirname* directory must be specified"

tools_dirs_list = parse_list_argument(toolsdirs, ",")
install_options_list = parse_list_argument(install_options, " ")
find_links_dirs_list = parse_list_argument(find_links, ",")
find_links_options = [f"--find-links={link}" for link in find_links_dirs_list + [source_dirs]]
winpy_dir = Path(basedir_wpy)

utils.print_box(f"Making WinPython at {winpy_dir}")
Expand All@@ -198,7 +179,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
build_number, release_level, winpy_dir.parent, wheels_directory=source_dirs,
tools_directories=[Path(d) for d in tools_dirs_list],
verbose=verbose,
install_options=install_options_list + find_links_options,
flavor=flavor
)
builder.build(winpy_dir=winpy_dir)
Expand All@@ -212,8 +192,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
basedir_wpy=r"D:\WinPython\bd314\budot\WPy64-31401b3",
verbose=True,
flavor="dot",
install_options=r"--no-index --pre --trusted-host=None",
find_links=r"D:\Winpython\packages.srcreq",
source_dirs=r"D:\WinPython\bd314\packages.win-amd64",
toolsdirs=r"D:\WinPython\bd314\t.Slim",
)
6 changes: 3 additions & 3 deletionswppm/wppm.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
# Copyright © 2012 Pierre Raybaut
# Copyright © 2014-2025+ The Winpython development team https://github.com/winpython/
# Licensed under the terms of the MIT License
# (seewinpython/__init__.py for details)
# (seewppm/__init__.py for details)

import os
import re
Expand DownExpand Up@@ -358,8 +358,8 @@ def main(test=False):
sys.exit()
if utils.is_python_distribution(args.target):
dist = Distribution(args.target, verbose=True)
cmd_fix = rf"fromwinpython import wppm;dist=wppm.Distribution(r'{dist.target}');dist.patch_standard_packages('pip', to_movable=False)"
cmd_mov = rf"fromwinpython import wppm;dist=wppm.Distribution(r'{dist.target}');dist.patch_standard_packages('pip', to_movable=True)"
cmd_fix = rf"fromwppm import wppm;dist=wppm.Distribution(r'{dist.target}');dist.patch_standard_packages('pip', to_movable=False)"
cmd_mov = rf"fromwppm import wppm;dist=wppm.Distribution(r'{dist.target}');dist.patch_standard_packages('pip', to_movable=True)"
if args.fix:
# dist.patch_standard_packages('pip', to_movable=False) # would fail on wppm.exe
p = subprocess.Popen(["start", "cmd", "/k",dist.python_exe, "-c" , cmd_fix], shell = True, cwd=dist.target)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp