@@ -308,11 +308,6 @@ def pre_path_entries(self) -> list[str]:
308
308
r".." + self .NODEJS_PATH_REL ,
309
309
]
310
310
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
-
316
311
@property
317
312
def tools_directories (self ) -> list [Path ]:
318
313
"""Returns the list of tools directories to include."""
@@ -381,8 +376,7 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
381
376
"""
382
377
Creates a WinPython installer using 7-Zip.
383
378
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").
386
380
"""
387
381
self ._print_action (f"Creating WinPython installer ({ installer_type } )" )
388
382
template_name = "installer_7zip.bat"
@@ -408,7 +402,6 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
408
402
PORTABLE_DIR / output_name ,
409
403
replacements
410
404
)
411
- self ._print_action_done ()
412
405
413
406
414
407
def _print_action (self , text : str ):
@@ -418,19 +411,13 @@ def _print_action(self, text: str):
418
411
else :
419
412
print (f"{ text } ... " , end = "" , flush = True )
420
413
421
- def _print_action_done (self ):
422
- """Prints "OK" to indicate action completion."""
423
- if not self .verbose :
424
- print ("OK" )
425
-
426
414
def _extract_python_archive (self ):
427
415
"""Extracts the Python zip archive to create the base Python environment."""
428
416
self ._print_action ("Extracting Python archive" )
429
417
utils .extract_archive (
430
418
str (self .python_zip_file ),
431
419
targetdir = str (self .winpy_dir ), # Extract directly to winpy_dir
432
420
)
433
- self ._print_action_done ()
434
421
# Relocate to /python subfolder if needed (for newer structure) #2024-12-22 to /python
435
422
python_target_dir = self .winpy_dir / self .python_dir_name
436
423
if self .python_dir_name != self .python_name and not python_target_dir .is_dir ():
@@ -450,48 +437,35 @@ def _copy_tools(self):
450
437
shutil .move (nodejs_current_dir , nodejs_target_dir )
451
438
except Exception as e :
452
439
print (f"Error moving Node.js directory: { e } " )
453
- self ._print_action_done ()
454
440
455
441
def _copy_documentation (self ):
456
442
"""Copies documentation files to the WinPython 'docs' directory."""
457
443
docs_target_dir = self .winpy_dir / "notebooks" / "docs"
458
444
self ._print_action (f"Copying documentation to { docs_target_dir } " )
459
445
_copy_items (self .docs_directories , docs_target_dir , self .verbose )
460
- self ._print_action_done ()
461
-
446
+
462
447
def _copy_launchers (self ):
463
448
"""Copies pre-made launchers to the WinPython directory."""
464
449
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 )
468
451
469
452
def _copy_default_scripts (self ):
470
453
"""Copies launchers and defeult scripts."""
471
454
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 )
476
456
477
457
def _create_initial_batch_scripts (self ):
478
458
"""Creates initial batch scripts, including environment setup."""
479
459
self ._print_action ("Creating initial batch scripts" )
480
460
481
461
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%"
483
463
484
464
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"
486
466
487
467
# Replacements for batch scripts (PyPy compatibility)
488
468
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" ))
495
469
496
470
destination = self .winpy_dir / "scripts"
497
471
for specials in ('env.bat' , 'WinPython_PS_Prompt.ps1' ):
@@ -501,22 +475,13 @@ def _create_initial_batch_scripts(self):
501
475
utils .patch_sourcefile (destspe ,'{self.winpython_version_name}' , self .winpython_version_name )
502
476
utils .patch_sourcefile (destspe ,'{full_path_env_var}' , full_path_env_var )
503
477
utils .patch_sourcefile (destspe ,'{full_path_ps_env_var}' , full_path_ps_env_var )
504
- self ._print_action_done ()
505
478
506
479
507
480
def _create_standard_batch_scripts (self ):
508
481
"""Creates standard WinPython batch scripts for various actions."""
509
482
self ._print_action ("Creating standard batch scripts" )
510
483
511
484
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 ()
520
485
521
486
522
487
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:
546
511
(self .winpy_dir / "settings" / "AppData" / "Roaming" ).mkdir (parents = True , exist_ok = True ) # Ensure settings dir exists
547
512
self ._extract_python_archive ()
548
513
549
- self ._print_action_done ()
550
514
self .distribution = wppm .Distribution (
551
515
self .python_executable_dir ,
552
516
verbose = self .verbose ,
@@ -589,7 +553,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
589
553
590
554
self ._print_action ("Cleaning up distribution" )
591
555
self .distribution .clean_up ()
592
- self ._print_action_done ()
593
556
# Writing package index
594
557
self ._print_action ("Writing package index" )
595
558
# 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:
609
572
fname ,
610
573
str (Path (CHANGELOGS_DIR ) / Path (fname ).name ),
611
574
)
612
- self ._print_action_done ()
613
575
614
576
# Writing changelog
615
577
self ._print_action ("Writing changelog" )
@@ -620,7 +582,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
620
582
release_level = self .release_level ,
621
583
architecture = self .distribution .architecture ,
622
584
)
623
- self ._print_action_done ()
624
585
625
586
626
587
def rebuild_winpython_package (source_dir : Path , target_dir : Path , architecture : int = 64 , verbose : bool = False ):
0 commit comments