@@ -381,8 +381,7 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
381
381
"""
382
382
Creates a WinPython installer using 7-Zip.
383
383
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").
386
385
"""
387
386
self ._print_action (f"Creating WinPython installer ({ installer_type } )" )
388
387
template_name = "installer_7zip.bat"
@@ -408,7 +407,6 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
408
407
PORTABLE_DIR / output_name ,
409
408
replacements
410
409
)
411
- self ._print_action_done ()
412
410
413
411
414
412
def _print_action (self , text : str ):
@@ -418,19 +416,13 @@ def _print_action(self, text: str):
418
416
else :
419
417
print (f"{ text } ... " , end = "" , flush = True )
420
418
421
- def _print_action_done (self ):
422
- """Prints "OK" to indicate action completion."""
423
- if not self .verbose :
424
- print ("OK" )
425
-
426
419
def _extract_python_archive (self ):
427
420
"""Extracts the Python zip archive to create the base Python environment."""
428
421
self ._print_action ("Extracting Python archive" )
429
422
utils .extract_archive (
430
423
str (self .python_zip_file ),
431
424
targetdir = str (self .winpy_dir ), # Extract directly to winpy_dir
432
425
)
433
- self ._print_action_done ()
434
426
# Relocate to /python subfolder if needed (for newer structure) #2024-12-22 to /python
435
427
python_target_dir = self .winpy_dir / self .python_dir_name
436
428
if self .python_dir_name != self .python_name and not python_target_dir .is_dir ():
@@ -450,29 +442,22 @@ def _copy_tools(self):
450
442
shutil .move (nodejs_current_dir , nodejs_target_dir )
451
443
except Exception as e :
452
444
print (f"Error moving Node.js directory: { e } " )
453
- self ._print_action_done ()
454
445
455
446
def _copy_documentation (self ):
456
447
"""Copies documentation files to the WinPython 'docs' directory."""
457
448
docs_target_dir = self .winpy_dir / "notebooks" / "docs"
458
449
self ._print_action (f"Copying documentation to { docs_target_dir } " )
459
450
_copy_items (self .docs_directories , docs_target_dir , self .verbose )
460
- self ._print_action_done ()
461
-
451
+
462
452
def _copy_launchers (self ):
463
453
"""Copies pre-made launchers to the WinPython directory."""
464
454
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 )
468
456
469
457
def _copy_default_scripts (self ):
470
458
"""Copies launchers and defeult scripts."""
471
459
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 )
476
461
477
462
def _create_initial_batch_scripts (self ):
478
463
"""Creates initial batch scripts, including environment setup."""
@@ -486,12 +471,6 @@ def _create_initial_batch_scripts(self):
486
471
487
472
# Replacements for batch scripts (PyPy compatibility)
488
473
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
474
496
475
destination = self .winpy_dir / "scripts"
497
476
for specials in ('env.bat' , 'WinPython_PS_Prompt.ps1' ):
@@ -501,22 +480,13 @@ def _create_initial_batch_scripts(self):
501
480
utils .patch_sourcefile (destspe ,'{self.winpython_version_name}' , self .winpython_version_name )
502
481
utils .patch_sourcefile (destspe ,'{full_path_env_var}' , full_path_env_var )
503
482
utils .patch_sourcefile (destspe ,'{full_path_ps_env_var}' , full_path_ps_env_var )
504
- self ._print_action_done ()
505
483
506
484
507
485
def _create_standard_batch_scripts (self ):
508
486
"""Creates standard WinPython batch scripts for various actions."""
509
487
self ._print_action ("Creating standard batch scripts" )
510
488
511
489
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
490
521
491
522
492
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:
546
516
(self .winpy_dir / "settings" / "AppData" / "Roaming" ).mkdir (parents = True , exist_ok = True ) # Ensure settings dir exists
547
517
self ._extract_python_archive ()
548
518
549
- self ._print_action_done ()
550
519
self .distribution = wppm .Distribution (
551
520
self .python_executable_dir ,
552
521
verbose = self .verbose ,
@@ -589,7 +558,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
589
558
590
559
self ._print_action ("Cleaning up distribution" )
591
560
self .distribution .clean_up ()
592
- self ._print_action_done ()
593
561
# Writing package index
594
562
self ._print_action ("Writing package index" )
595
563
# 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:
609
577
fname ,
610
578
str (Path (CHANGELOGS_DIR ) / Path (fname ).name ),
611
579
)
612
- self ._print_action_done ()
613
580
614
581
# Writing changelog
615
582
self ._print_action ("Writing changelog" )
@@ -620,7 +587,6 @@ def build(self, remove_existing: bool = True, requirements=None, winpy_dirname:
620
587
release_level = self .release_level ,
621
588
architecture = self .distribution .architecture ,
622
589
)
623
- self ._print_action_done ()
624
590
625
591
626
592
def rebuild_winpython_package (source_dir : Path , target_dir : Path , architecture : int = 64 , verbose : bool = False ):
0 commit comments