Skip to content

Commit 618c983

Browse files
committed
remove useless "._print_action_done()" and "batch_replacements"
1 parent 6c93890 commit 618c983

File tree

1 file changed

+4
-38
lines changed

1 file changed

+4
-38
lines changed

make.py

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
381381
"""
382382
Creates a WinPython installer using 7-Zip.
383383
384-
Args:
385-
installer_type: Type of installer to create (".exe", ".7z", ".zip").
384+
Args: installer_type: Type of installer to create (".exe", ".7z", ".zip").
386385
"""
387386
self._print_action(f"Creating WinPython installer ({installer_type})")
388387
template_name = "installer_7zip.bat"
@@ -408,7 +407,6 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
408407
PORTABLE_DIR / output_name,
409408
replacements
410409
)
411-
self._print_action_done()
412410

413411

414412
def _print_action(self, text: str):
@@ -418,19 +416,13 @@ def _print_action(self, text: str):
418416
else:
419417
print(f"{text}... ", end="", flush=True)
420418

421-
def _print_action_done(self):
422-
"""Prints "OK" to indicate action completion."""
423-
if not self.verbose:
424-
print("OK")
425-
426419
def _extract_python_archive(self):
427420
"""Extracts the Python zip archive to create the base Python environment."""
428421
self._print_action("Extracting Python archive")
429422
utils.extract_archive(
430423
str(self.python_zip_file),
431424
targetdir=str(self.winpy_dir), # Extract directly to winpy_dir
432425
)
433-
self._print_action_done()
434426
# Relocate to /python subfolder if needed (for newer structure) #2024-12-22 to /python
435427
python_target_dir = self.winpy_dir / self.python_dir_name
436428
if self.python_dir_name != self.python_name and not python_target_dir.is_dir():
@@ -450,29 +442,22 @@ def _copy_tools(self):
450442
shutil.move(nodejs_current_dir, nodejs_target_dir)
451443
except Exception as e:
452444
print(f"Error moving Node.js directory: {e}")
453-
self._print_action_done()
454445

455446
def _copy_documentation(self):
456447
"""Copies documentation files to the WinPython 'docs' directory."""
457448
docs_target_dir = self.winpy_dir / "notebooks" / "docs"
458449
self._print_action(f"Copying documentation to {docs_target_dir}")
459450
_copy_items(self.docs_directories, docs_target_dir, self.verbose)
460-
self._print_action_done()
461-
451+
462452
def _copy_launchers(self):
463453
"""Copies pre-made launchers to the WinPython directory."""
464454
self._print_action("Creating launchers")
465-
launchers_source_dir = PORTABLE_DIR / "launchers_final"
466-
_copy_items([launchers_source_dir], self.winpy_dir, self.verbose)
467-
self._print_action_done()
455+
_copy_items([PORTABLE_DIR / "launchers_final"], self.winpy_dir, self.verbose)
468456

469457
def _copy_default_scripts(self):
470458
"""Copies launchers and defeult scripts."""
471459
self._print_action("copying pre-made scripts")
472-
origin = PORTABLE_DIR / "scripts"
473-
destination = self.winpy_dir / "scripts"
474-
_copy_items([origin], destination, self.verbose)
475-
self._print_action_done()
460+
_copy_items([PORTABLE_DIR / "scripts"], self.winpy_dir / "scripts", self.verbose)
476461

477462
def _create_initial_batch_scripts(self):
478463
"""Creates initial batch scripts, including environment setup."""
@@ -486,12 +471,6 @@ def _create_initial_batch_scripts(self):
486471

487472
# Replacements for batch scripts (PyPy compatibility)
488473
exe_name = self.distribution.short_exe if self.distribution else "python.exe" # default to python.exe if distribution is not yet set
489-
batch_replacements = [
490-
(r"DIR%\\python.exe", rf"DIR%\\{exe_name}"),
491-
(r"DIR%\\PYTHON.EXE", rf"DIR%\\{exe_name}"),
492-
]
493-
if self.distribution and (Path(self.distribution.target) / r"lib-python\3\idlelib").is_dir():
494-
batch_replacements.append((r"\Lib\idlelib", r"\lib-python\3\idlelib"))
495474

496475
destination = self.winpy_dir / "scripts"
497476
for specials in ('env.bat', 'WinPython_PS_Prompt.ps1'):
@@ -501,22 +480,13 @@ def _create_initial_batch_scripts(self):
501480
utils.patch_sourcefile(destspe,'{self.winpython_version_name}', self.winpython_version_name)
502481
utils.patch_sourcefile(destspe,'{full_path_env_var}', full_path_env_var)
503482
utils.patch_sourcefile(destspe,'{full_path_ps_env_var}', full_path_ps_env_var)
504-
self._print_action_done()
505483

506484

507485
def _create_standard_batch_scripts(self):
508486
"""Creates standard WinPython batch scripts for various actions."""
509487
self._print_action("Creating standard batch scripts")
510488

511489
exe_name = self.distribution.short_exe if self.distribution else "python.exe"
512-
batch_replacements = [
513-
(r"DIR%\\python.exe", rf"DIR%\\{exe_name}"),
514-
(r"DIR%\\PYTHON.EXE", rf"DIR%\\{exe_name}"),
515-
]
516-
if self.distribution and (Path(self.distribution.target) / r"lib-python\3\idlelib").is_dir():
517-
batch_replacements.append((r"\Lib\idlelib", r"\lib-python\3\idlelib"))
518-
519-
self._print_action_done()
520490

521491

522492
def build(self, remove_existing: bool = True, requirements=None, winpy_dirname: str = None):
@@ -546,7 +516,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
546516
(self.winpy_dir / "settings" / "AppData" / "Roaming").mkdir(parents=True, exist_ok=True) # Ensure settings dir exists
547517
self._extract_python_archive()
548518

549-
self._print_action_done()
550519
self.distribution = wppm.Distribution(
551520
self.python_executable_dir,
552521
verbose=self.verbose,
@@ -589,7 +558,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
589558

590559
self._print_action("Cleaning up distribution")
591560
self.distribution.clean_up()
592-
self._print_action_done()
593561
# Writing package index
594562
self._print_action("Writing package index")
595563
# winpyver2 = the version without build part but with self.distribution.architecture
@@ -609,7 +577,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
609577
fname,
610578
str(Path(CHANGELOGS_DIR) / Path(fname).name),
611579
)
612-
self._print_action_done()
613580

614581
# Writing changelog
615582
self._print_action("Writing changelog")
@@ -620,7 +587,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
620587
release_level=self.release_level,
621588
architecture=self.distribution.architecture,
622589
)
623-
self._print_action_done()
624590

625591

626592
def rebuild_winpython_package(source_dir: Path, target_dir: Path, architecture: int = 64, verbose: bool = False):

0 commit comments

Comments
 (0)