Skip to content

Commit f212117

Browse files
authored
Merge pull request #1506 from stonebig/master
more clean-up
2 parents d45aed0 + 40d0c77 commit f212117

File tree

1 file changed

+6
-45
lines changed

1 file changed

+6
-45
lines changed

make.py

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,6 @@ def pre_path_entries(self) -> list[str]:
308308
r".." + self.NODEJS_PATH_REL,
309309
]
310310

311-
@property
312-
def post_path_entries(self) -> list[str]:
313-
"""Returns a list of PATH entries to append to the environment."""
314-
return []
315-
316311
@property
317312
def tools_directories(self) -> list[Path]:
318313
"""Returns the list of tools directories to include."""
@@ -381,8 +376,7 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
381376
"""
382377
Creates a WinPython installer using 7-Zip.
383378
384-
Args:
385-
installer_type: Type of installer to create (".exe", ".7z", ".zip").
379+
Args: installer_type: Type of installer to create (".exe", ".7z", ".zip").
386380
"""
387381
self._print_action(f"Creating WinPython installer ({installer_type})")
388382
template_name = "installer_7zip.bat"
@@ -408,7 +402,6 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
408402
PORTABLE_DIR / output_name,
409403
replacements
410404
)
411-
self._print_action_done()
412405

413406

414407
def _print_action(self, text: str):
@@ -418,19 +411,13 @@ def _print_action(self, text: str):
418411
else:
419412
print(f"{text}... ", end="", flush=True)
420413

421-
def _print_action_done(self):
422-
"""Prints "OK" to indicate action completion."""
423-
if not self.verbose:
424-
print("OK")
425-
426414
def _extract_python_archive(self):
427415
"""Extracts the Python zip archive to create the base Python environment."""
428416
self._print_action("Extracting Python archive")
429417
utils.extract_archive(
430418
str(self.python_zip_file),
431419
targetdir=str(self.winpy_dir), # Extract directly to winpy_dir
432420
)
433-
self._print_action_done()
434421
# Relocate to /python subfolder if needed (for newer structure) #2024-12-22 to /python
435422
python_target_dir = self.winpy_dir / self.python_dir_name
436423
if self.python_dir_name != self.python_name and not python_target_dir.is_dir():
@@ -450,48 +437,35 @@ def _copy_tools(self):
450437
shutil.move(nodejs_current_dir, nodejs_target_dir)
451438
except Exception as e:
452439
print(f"Error moving Node.js directory: {e}")
453-
self._print_action_done()
454440

455441
def _copy_documentation(self):
456442
"""Copies documentation files to the WinPython 'docs' directory."""
457443
docs_target_dir = self.winpy_dir / "notebooks" / "docs"
458444
self._print_action(f"Copying documentation to {docs_target_dir}")
459445
_copy_items(self.docs_directories, docs_target_dir, self.verbose)
460-
self._print_action_done()
461-
446+
462447
def _copy_launchers(self):
463448
"""Copies pre-made launchers to the WinPython directory."""
464449
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()
450+
_copy_items([PORTABLE_DIR / "launchers_final"], self.winpy_dir, self.verbose)
468451

469452
def _copy_default_scripts(self):
470453
"""Copies launchers and defeult scripts."""
471454
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()
455+
_copy_items([PORTABLE_DIR / "scripts"], self.winpy_dir / "scripts", self.verbose)
476456

477457
def _create_initial_batch_scripts(self):
478458
"""Creates initial batch scripts, including environment setup."""
479459
self._print_action("Creating initial batch scripts")
480460

481461
path_entries_str = ";".join([rf"%WINPYDIR%\{pth}" for pth in self.pre_path_entries])
482-
full_path_env_var = f"{path_entries_str};%PATH%;" + ";".join([rf"%WINPYDIR%\{pth}" for pth in self.post_path_entries])
462+
full_path_env_var = f"{path_entries_str};%PATH%"
483463

484464
path_entries_ps_str = ";".join([rf"$env:WINPYDIR\\{pth}" for pth in self.pre_path_entries])
485-
full_path_ps_env_var = f"{path_entries_ps_str};$env:path;" + ";".join([rf"$env:WINPYDIR\\{pth}" for pth in self.post_path_entries])
465+
full_path_ps_env_var = f"{path_entries_ps_str};$env:path"
486466

487467
# Replacements for batch scripts (PyPy compatibility)
488468
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"))
495469

496470
destination = self.winpy_dir / "scripts"
497471
for specials in ('env.bat', 'WinPython_PS_Prompt.ps1'):
@@ -501,22 +475,13 @@ def _create_initial_batch_scripts(self):
501475
utils.patch_sourcefile(destspe,'{self.winpython_version_name}', self.winpython_version_name)
502476
utils.patch_sourcefile(destspe,'{full_path_env_var}', full_path_env_var)
503477
utils.patch_sourcefile(destspe,'{full_path_ps_env_var}', full_path_ps_env_var)
504-
self._print_action_done()
505478

506479

507480
def _create_standard_batch_scripts(self):
508481
"""Creates standard WinPython batch scripts for various actions."""
509482
self._print_action("Creating standard batch scripts")
510483

511484
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()
520485

521486

522487
def build(self, remove_existing: bool = True, requirements=None, winpy_dirname: str = None):
@@ -546,7 +511,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
546511
(self.winpy_dir / "settings" / "AppData" / "Roaming").mkdir(parents=True, exist_ok=True) # Ensure settings dir exists
547512
self._extract_python_archive()
548513

549-
self._print_action_done()
550514
self.distribution = wppm.Distribution(
551515
self.python_executable_dir,
552516
verbose=self.verbose,
@@ -589,7 +553,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
589553

590554
self._print_action("Cleaning up distribution")
591555
self.distribution.clean_up()
592-
self._print_action_done()
593556
# Writing package index
594557
self._print_action("Writing package index")
595558
# winpyver2 = the version without build part but with self.distribution.architecture
@@ -609,7 +572,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
609572
fname,
610573
str(Path(CHANGELOGS_DIR) / Path(fname).name),
611574
)
612-
self._print_action_done()
613575

614576
# Writing changelog
615577
self._print_action("Writing changelog")
@@ -620,7 +582,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
620582
release_level=self.release_level,
621583
architecture=self.distribution.architecture,
622584
)
623-
self._print_action_done()
624585

625586

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

0 commit comments

Comments
 (0)