8000 simplify further · winpython/winpython@73864a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 73864a5

Browse files
committed
simplify further
1 parent f01d177 commit 73864a5

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

make.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
# -*- coding: utf-8 -*-
22
#
3+
# WinPython build script
34
# Copyright © 2012 Pierre Raybaut
45
# Copyright © 2014-2024+  The Winpython development team https://github.com/winpython/
56
# Licensed under the terms of the MIT License
67
# (see winpython/__init__.py for details)
78

8-
"""
9-
WinPython build script
10-
"""
11-
129
import os
1310
import re
1411
import shutil
@@ -66,7 +63,7 @@ def replace_lines_in_file(filepath: Path, replacements: list[tuple[str, str]]):
6663
for index, line in enumerate(lines):
6764
for prefix, new_text in replacements:
6865
start_prefix = prefix
69-
if prefix not in ("Icon", "OutFile") and not prefix.startswith("!"):
66+
if not prefix.startswith("!"):
7067
start_prefix = "set " + prefix
7168
if line.startswith(start_prefix + "="):
7269
updated_lines[index] = f"{start_prefix}={new_text}\n"
@@ -90,13 +87,12 @@ def build_installer_7zip(
9087
output_script_path: Path to save the generated 7-Zip script.
9188
replacements: A list of tuples for text replacements (prefix, new_text).
9289
"""
93-
sevenzip_executable = find_7zip_executable()
9490
shutil.copy(script_template_path, output_script_path)
9591

9692
# Standard replacements for all 7zip scripts
9793
data_to_replace = [
9894
("PORTABLE_DIR", str(PORTABLE_DIRECTORY)),
99-
("SEVENZIP_EXE", sevenzip_executable),
95+
("SEVENZIP_EXE", find_7zip_executable()),
10096
] + replacements
10197

10298
replace_lines_in_file(output_script_path, data_to_replace)
@@ -108,7 +104,7 @@ def build_installer_7zip(
108104
subprocess.run(
109105
command, shell=True, check=True, stderr=sys.stderr, stdout=sys.stderr
110106
# with stdout=sys.stdout, we would not see 7zip compressing
111-
) # Use subprocess.run for better error handling
107+
)
112108
except subprocess.CalledProcessError as e:
113109
print(f"Error executing 7-Zip script: {e}", file=sys.stderr)
114110

@@ -516,19 +512,17 @@ def make_all(
516512
docsdirs: str | list[Path] = None,
517513
python_target_release: str = None, # e.g. "37101" for 3.7.10
518514
):
519-
"""Make WinPython distribution, for a given base directory and
520-
architecture:
515+
"""Make a WinPython distribution for a given set of parameters:
521516
`build_number`: build number [int]
522517
`release_level`: release level (e.g. 'beta1', '') [str]
523518
`pyver`: python version ('3.4' or 3.5')
524519
`architecture`: [int] (32 or 64)
525-
`basedir`: where will be created tmp_wheel and Winpython build
526-
r'D:\Winpython\basedir34'.
527-
`requirements`: the package list for pip r'D:\requirements.txt',
528-
`install_options`: pip options r'--no-index --pre --trusted-host=None',
529-
`find_links`: package directories r'D:\Winpython\packages.srcreq',
530-
`source_dirs`: the python.zip + rebuilt winpython wheel package directory,
531-
`toolsdirs`: r'D:\WinPython\basedir34\t.Slim',
520+
`basedir`: where to create the build (r'D:\Winpython\basedir34')
521+
`requirements`: package lists for pip (r'D:\requirements.txt')
522+
`install_options`: pip options (r'--no-index --pre --trusted-host=None')
523+
`find_links`: package directories (r'D:\Winpython\packages.srcreq')
524+
`source_dirs`: the python.zip + rebuilt winpython wheel package directory
525+
`toolsdirs`: r'D:\WinPython\basedir34\t.Slim'
532526
`docsdirs`: r'D:\WinPython\basedir34\docs.Slim'"""
533527

534528
assert basedir is not None, "The *basedir* directory must be specified"
@@ -587,9 +581,7 @@ def make_all(
587581

588582

589583
if __name__ == "__main__":
590-
# DO create only one version at a time
591-
# You may have to manually delete previous build\winpython-.. directory
592-
584+
# DO create only one Winpython distribution at a time
593585
make_all(
594586
build_number=1,
595587
release_level="build3",

0 commit comments

Comments
 (0)
0