1414
1515# Define constant paths for clarity
1616PORTABLE_DIRECTORY = Path (__file__ ).parent / "portable"
17-
18- # Ensure necessary directories exist at the start
1917assert PORTABLE_DIRECTORY .is_dir (), f"Portable directory not found: { PORTABLE_DIRECTORY } "
2018
2119def copy_items (source_directories : list [Path ], target_directory : Path , verbose : bool = False ):
@@ -46,7 +44,7 @@ class WinPythonDistributionBuilder:
4644
4745 def __init__ (self , build_number : int , release_level : str , target_directory : Path , wheels_directory : Path ,
4846 tools_directories : list [Path ] = None , verbose : bool = False ,
49- install_options : list [ str ] = None , flavor : str = "" ):
47+ flavor : str = "" ):
5048 """
5149 Initializes the WinPythonDistributionBuilder.
5250 Args:
@@ -56,7 +54,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
5654 wheels_directory: Directory containing wheel files for packages.
5755 tools_directories: List of directories containing development tools to include.
5856 verbose: Enable verbose output.
59- install_options: Additional pip install options.
6057 flavor: WinPython flavor (e.g., "Barebone").
6158 """
6259 self .build_number = build_number
@@ -67,7 +64,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
6764 self .verbose = verbose
6865 self .winpython_directory : Path | None = None
6966 self .distribution : wppm .Distribution | None = None
70- self .install_options = install_options or []
7167 self .flavor = flavor
7268 self .python_zip_file : Path = self ._get_python_zip_file ()
7369 self .python_name = self .python_zip_file .stem
@@ -141,12 +137,10 @@ def _create_initial_batch_scripts(self):
141137 def build (self , winpy_dir : Path = None ):
142138 """Make or finalise WinPython distribution in the target directory"""
143139 print (f"Building WinPython with Python archive: { self .python_zip_file .name } " )
144- if winpy_dir is None :
145- raise RuntimeError ("WinPython base directory to create is undefined" )
146140 self .winpython_directory = winpy_dir
147141
148142 self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
149- if self .winpython_directory .is_dir ():
143+ if self .winpython_directory .is_dir () and len ( self . winpython_directory . parts ) >= 4 :
150144 shutil .rmtree (self .winpython_directory )
151145 os .makedirs (self .winpython_directory , exist_ok = True )
152146 # preventive re-Creation of settings directory
@@ -157,18 +151,10 @@ def build(self, winpy_dir: Path = None):
157151
158152 self ._copy_essential_files ()
159153 self ._create_initial_batch_scripts ()
160- utils .python_execmodule ("ensurepip" , self .distribution .target )
161- self .distribution .patch_standard_packages ("pip" )
162- essential_packages = ["pip" , "setuptools" , "wheel" , "wppm" ]
163- for package_name in essential_packages :
164- actions = ["install" , "--upgrade" , "--pre" , package_name ] + self .install_options
165- self ._print_action (f"Piping: { ' ' .join (actions )} " )
166- self .distribution .do_pip_action (actions )
167- self .distribution .patch_standard_packages (package_name )
168154
169155def make_all (build_number : int , release_level : str , basedir_wpy : Path = None ,
170- verbose : bool = False , install_options = [ "--no-index" ],
171- flavor : str = "" , find_links : str | list [ Path ] = None ,
156+ verbose : bool = False ,
157+ flavor : str = "" ,
172158 source_dirs : Path = None , toolsdirs : str | list [Path ] = None ,
173159):
174160 """
@@ -178,18 +164,13 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
178164 release_level: release level (e.g. 'beta1', '') [str]
179165 basedir_wpy: top directory of the build (c:\...\Wpy...)
180166 verbose: Enable verbose output (bool).
181- install_options: pip options (r'--no-index --pre --trusted-host=None')
182167 flavor: WinPython flavor (str).
183- find_links: package directories (r'D:\Winpython\packages.srcreq')
184- source_dirs: the python.zip + rebuilt winpython wheel package directory
168+ source_dirs: the python.zip
185169 toolsdirs: Directory with development tools r'D:\WinPython\b asedir34\t .Slim'
186170 """
187171 assert basedir_wpy is not None , "The *winpython_dirname* directory must be specified"
188172
189173 tools_dirs_list = parse_list_argument (toolsdirs , "," )
190- install_options_list = parse_list_argument (install_options , " " )
191- find_links_dirs_list = parse_list_argument (find_links , "," )
192- find_links_options = [f"--find-links={ link } " for link in find_links_dirs_list + [source_dirs ]]
193174 winpy_dir = Path (basedir_wpy )
194175
195176 utils .print_box (f"Making WinPython at { winpy_dir } " )
@@ -198,7 +179,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
198179 build_number , release_level , winpy_dir .parent , wheels_directory = source_dirs ,
199180 tools_directories = [Path (d ) for d in tools_dirs_list ],
200181 verbose = verbose ,
201- install_options = install_options_list + find_links_options ,
202182 flavor = flavor
203183 )
204184 builder .build (winpy_dir = winpy_dir )
@@ -212,8 +192,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
212192 basedir_wpy = r"D:\WinPython\bd314\budot\WPy64-31401b3" ,
213193 verbose = True ,
214194 flavor = "dot" ,
215- install_options = r"--no-index --pre --trusted-host=None" ,
216- find_links = r"D:\Winpython\packages.srcreq" ,
217195 source_dirs = r"D:\WinPython\bd314\packages.win-amd64" ,
218196 toolsdirs = r"D:\WinPython\bd314\t.Slim" ,
219197 )
0 commit comments