@@ -472,13 +472,6 @@ def _create_initial_batch_scripts(self):
472
472
utils .patch_sourcefile (destspe ,'{full_path_ps_env_var}' , full_path_ps_env_var )
473
473
474
474
475
- def _create_standard_batch_scripts (self ):
476
- """Creates standard WinPython batch scripts for various actions."""
477
- self ._print_action ("Creating standard batch scripts" )
478
-
479
- exe_name = self .distribution .short_exe if self .distribution else "python.exe"
480
-
481
-
482
475
def build (self , rebuild : bool = True , requirements = None , winpy_dirname : str = None ):
483
476
"""Make WinPython distribution in target directory from the installers
484
477
located in wheels_dir
@@ -515,8 +508,9 @@ def build(self, rebuild: bool = True, requirements=None, winpy_dirname: str = No
515
508
if rebuild :
516
509
self ._copy_default_scripts ()
517
510
self ._create_initial_batch_scripts ()
518
- self ._create_standard_batch_scripts ()
519
511
self ._copy_launchers ()
512
+ self ._copy_tools ()
513
+ self ._copy_documentation ()
520
514
521
515
utils .python_execmodule ("ensurepip" , self .distribution .target ) # Ensure pip is installed for PyPy
522
516
self .distribution .patch_standard_packages ("pip" )
@@ -530,9 +524,6 @@ def build(self, rebuild: bool = True, requirements=None, winpy_dirname: str = No
530
524
self .distribution .do_pip_action (actions )
531
525
self .distribution .patch_standard_packages (package_name )
532
526
533
- self ._copy_tools ()
534
- self ._copy_documentation ()
535
-
536
527
if requirements :
537
528
if not list (requirements ) == requirements :
538
529
requirements = requirements .split ("," )
@@ -574,20 +565,15 @@ def rebuild_winpython_package(source_dir: Path, target_dir: Path, architecture:
574
565
for filename in os .listdir (target_dir ):
575
566
if filename .startswith ("winpython-" ) and filename .endswith ((".exe" , ".whl" , ".gz" )):
576
567
os .remove (Path (target_dir ) / filename )
577
-
578
- utils .buildflit_wininst (
579
- str (source_dir ),
580
- copy_to = str (target_dir ),
581
- verbose = verbose ,
582
- )
568
+ utils .buildflit_wininst (source_dir , copy_to = target_dir , verbose = verbose )
583
569
584
570
585
- def _parse_list_argument (arg_value : str | list [str ]) -> list [str ]:
586
- """Parses a string or comma separated list argument into a list of strings."""
571
+ def _parse_list_argument (arg_value : str | list [str ], separator = " " ) -> list [str ]:
572
+ """Parse a separated list argument into a list of strings."""
587
573
if arg_value is None :
588
574
return []
589
575
if isinstance (arg_value , str ):
590
- return arg_value .split ("," )
576
+ return arg_value .split (separator )
591
577
return list (arg_value )
592
578
593
579
@@ -626,49 +612,37 @@ def make_all(
626
612
627
613
assert basedir is not None , "The *basedir* directory must be specified"
628
614
assert architecture in (32 , 64 )
629
- utils .print_box (
630
- f"Making WinPython { architecture } bits"
631
- + f" at { Path (basedir ) / ('bu' + flavor )} "
632
- )
633
615
634
- # Create Build director, where Winpython will be constructed
616
+ # Parse list arguments
617
+ tools_dirs_list = _parse_list_argument (toolsdirs , "," )
618
+ docs_dirs_list = _parse_list_argument (docsdirs , "," )
619
+ install_options_list = _parse_list_argument (install_options , " " )
620
+ find_links_dirs_list = _parse_list_argument (find_links , "," )
621
+ requirements_files_list = [Path (f ) for f in _parse_list_argument (requirements , "," ) if f ] # ensure Path objects
622
+ find_links_options = [f"--find-links={ link } " for link in find_links_dirs_list + [source_dirs ]]
635
623
builddir = str (Path (basedir ) / ("bu" + flavor ))
636
- os .makedirs (Path (builddir ), exist_ok = True )
637
- # use source_dirs as the directory to re-build Winpython wheel
638
- wheels_dir = source_dirs
639
-
640
- # Rebuild WinPython package
641
- winpython_source_dir = Path (__file__ ).resolve ().parent
642
- rebuild_winpython_package (
643
- source_dir = winpython_source_dir ,
644
- target_dir = wheels_dir ,
645
- architecture = architecture ,
646
- verbose = verbose ,
647
- )
648
624
649
- # Parse list arguments
650
- tools_dirs_list = _parse_list_argument (toolsdirs )
651
- docs_dirs_list = _parse_list_argument (docsdirs )
652
- install_options_list = _parse_list_argument (install_options )
653
- find_links_dirs_list = _parse_list_argument (find_links )
654
- requirements_files_list = [Path (f ) for f in _parse_list_argument (requirements ) if f ] # ensure Path objects
625
+ if rebuild :
626
+ # Rebuild Winpython Wheel Package
627
+ utils .print_box (f"Making WinPython { architecture } bits at { Path (basedir ) / ('bu' + flavor )} " )
628
+ os .makedirs (Path (builddir ), exist_ok = True )
629
+ # use source_dirs as the directory to re-build Winpython wheel
630
+ winpython_source_dir = Path (__file__ ).resolve ().parent
631
+ rebuild_winpython_package (winpython_source_dir , source_dirs , architecture , verbose )
655
632
656
- find_links_options = [f"--find-links={ link } " for link in find_links_dirs_list + [wheels_dir ]]
657
633
builder = WinPythonDistributionBuilder (
658
634
build_number ,
659
635
release_level ,
660
636
builddir ,
661
- wheels_dir = wheels_dir ,
637
+ wheels_dir = source_dirs ,
662
638
tools_dirs = [Path (d ) for d in tools_dirs_list ],
663
639
docs_dirs = [Path (d ) for d in docs_dirs_list ],
664
640
verbose = verbose ,
665
641
base_dir = basedir ,
666
642
install_options = install_options_list + find_links_options ,
667
643
flavor = flavor ,
668
644
)
669
- # define a pre-defined winpydir, instead of having to guess
670
-
671
- # extract the python subversion to get WPy64-3671b1
645
+ # define the directory where to create the distro
672
646
my_x = "" .join (builder .python_name .replace (".amd64" , "" ).split ("." )[- 2 :- 1 ])
673
647
while not my_x .isdigit () and len (my_x ) > 0 :
674
648
my_x = my_x [:- 1 ]
0 commit comments