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

simplify make.py given parameters#1661

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 1 commit intowinpython:masterfromstonebig:master
Jul 5, 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
6 changes: 4 additions & 2 deletionsgenerate_a_winpython_distro.bat
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,8 @@ 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

set my_basedir_wpy=%my_basedir%\bu%my_flavor%\WPy%my_arch%-%my_python_target_release%%my_release%

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%
echo -------------------------------------- >>%my_archive_log%
Expand DownExpand Up@@ -59,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%',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%
python.exe -c "from make import *;make_all(%my_release%, '%my_release_level%',basedir_wpy=r'%my_basedir_wpy%', 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%', 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 DownExpand Up@@ -209,7 +211,7 @@ set path=%my_original_path%
cd /D %~dp0
call %my_buildenv%\scripts\env.bat

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%', create_installer='%my_create_installer%', rebuild=False, python_target_release='%my_python_target_release%')" >> %my_archive_log%
python.exe -c "from make import *;make_all(%my_release%, '%my_release_level%',basedir_wpy=r'%my_basedir_wpy%', verbose=True, flavor='%my_flavor%', install_options=r'%my_install_options%', find_links=r'%my_find_links%', source_dirs=r'%my_source_dirs%', create_installer='%my_create_installer%', rebuild=False, python_target_release='%my_python_target_release%')" >> %my_archive_log%


echo -------------------------------------- >>%my_archive_log%
Expand Down
54 changes: 21 additions & 33 deletionsmake.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,17 +59,16 @@ 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,
base_directory: Path = None,install_options: list[str] = None, flavor: str = ""):
install_options: list[str] = None, flavor: str = ""):
"""
Initializes the WinPythonDistributionBuilder.
Args:
build_number: The build number (integer).
release_level: The release level (e.g., "beta", "").
target_directory: The base directorywhere WinPython will be created.
target_directory: The base directorybelow which WinPython will be created.
wheels_directory: Directory containing wheel files for packages.
tools_directories: List of directories containing development tools to include.
verbose: Enable verbose output.
base_directory: Base directory for building (optional, for relative paths).
install_options: Additional pip install options.
flavor: WinPython flavor (e.g., "Barebone").
"""
Expand All@@ -81,7 +80,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.base_directory = base_directory
self.install_options = install_options or []
self.flavor = flavor
self.python_zip_file: Path = self._get_python_zip_file()
Expand DownExpand Up@@ -132,11 +130,11 @@ def architecture_bits(self) -> int:
def create_installer_7zip(self, installer_type: str = "exe", compression= "mx5"):
"""Creates a WinPython installer using 7-Zip: "exe", "7z", "zip")"""
self._print_action(f"Creating WinPython installer ({installer_type})")
if installer_type not in ["exe", "7z", "zip"]:
return
DISTDIR = self.winpython_directory
filename_stem = f"Winpython{self.architecture_bits}-{self.python_full_version}.{self.build_number}{self.flavor}{self.release_level}"
fullfilename = DISTDIR.parent / (filename_stem + "." + installer_type)
if installer_type not in ["exe", "7z", "zip"]:
return
sfx_option = "-sfx7z.sfx" if installer_type == "exe" else ""
zip_option = "-tzip" if installer_type == "zip" else ""
compress_level = "mx5" if compression == "" else compression
Expand DownExpand Up@@ -182,12 +180,12 @@ 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,winpy_dirname: str = None):
def build(self, rebuild: bool = True,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}")
ifwinpy_dirname is None:
ifwinpy_dir is None:
raise RuntimeError("WinPython base directory to create is undefined")
self.winpython_directory =self.target_directory / winpy_dirname
self.winpython_directory =winpy_dir

if rebuild:
self._print_action(f"Creating WinPython {self.winpython_directory} base directory")
Expand DownExpand Up@@ -222,7 +220,7 @@ def build(self, rebuild: bool = True, winpy_dirname: str = None):
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 make_all(build_number: int, release_level: str,pyver: str, architecture: int, basedir: Path,
def make_all(build_number: int, release_level: str,basedir_wpy: Path = None,
verbose: bool = False, rebuild: bool = True, create_installer: str = "True", install_options=["--no-index"],
flavor: str = "", find_links: str | list[Path] = None,
source_dirs: Path = None, toolsdirs: str | list[Path] = None,
Expand All@@ -233,9 +231,7 @@ def make_all(build_number: int, release_level: str, pyver: str, architecture: in
Args:
build_number: build number [int]
release_level: release level (e.g. 'beta1', '') [str]
pyver: python version ('3.4' or 3.5')
architecture: [int] (32 or 64)
basedir: where to create the build (r'D:\Winpython\basedir34')
basedir_wpy: top directory of the build (c:\...\Wpy...)
verbose: Enable verbose output (bool).
rebuild: Whether to rebuild the distribution (bool).
create_installer: Type of installer to create (str).
Expand All@@ -246,37 +242,31 @@ def make_all(build_number: int, release_level: str, pyver: str, architecture: in
toolsdirs: Directory with development tools r'D:\WinPython\basedir34\t.Slim'
python_target_release: Target Python release (str).
"""
assert basedir is not None, "The *basedir* directory must be specified"
assert architecture in (32, 64)
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]]
build_directory = Path(basedir) / ("bu" + flavor)
winpy_dir = Path(basedir_wpy)

if rebuild:
utils.print_box(f"Making WinPython{architecture}bitsat {Path(basedir) / ('bu' + flavor)}")
os.makedirs(build_directory, exist_ok=True)
utils.print_box(f"Making WinPython at {winpy_dir}")
os.makedirs(winpy_dir, exist_ok=True)

builder = WinPythonDistributionBuilder(
build_number, release_level,build_directory, wheels_directory=source_dirs,
build_number, release_level,winpy_dir.parent, wheels_directory=source_dirs,
tools_directories=[Path(d) for d in tools_dirs_list],
verbose=verbose, base_directory=basedir,
verbose=verbose,
install_options=install_options_list + find_links_options,
flavor=flavor
)
# define the directory where to create the distro
python_minor_version_str = "".join(builder.python_name.replace(".amd64", "").split(".")[-2:-1])
while not python_minor_version_str.isdigit() and len(python_minor_version_str) > 0:
python_minor_version_str = python_minor_version_str[:-1]
# simplify for PyPy
if python_target_release is not None:
winpython_dirname = f"WPy{architecture}-{python_target_release}{build_number}{release_level}"
else:
winpython_dirname = f"WPy{architecture}-{pyver.replace('.', '')}{python_minor_version_str}{build_number}{release_level}"

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

for commmand in create_installer.lower().replace("7zip",".exe").split('.'):
installer_type, compression = (commmand + "-").split("-")[:2]
Expand All@@ -286,14 +276,12 @@ def make_all(build_number: int, release_level: str, pyver: str, architecture: in
# DO create only one Winpython distribution at a time
make_all(
build_number=1,
release_level="build3",
pyver="3.4",
basedir=r"D:\Winpython\basedir34",
release_level="b3",
basedir_wpy=r"D:\WinPython\bd314\budot\WPy64-31401b3",
verbose=True,
architecture=64,
flavor="Barebone",
flavor="dot",
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",
source_dirs=r"D:\WinPython\bd314\packages.win-amd64",
toolsdirs=r"D:\WinPython\bd314\t.Slim",
)

[8]ページ先頭

©2009-2025 Movatter.jp