1414
1515# Define constant paths for clarity
1616PORTABLE_DIRECTORY = Path (__file__ ).parent / "portable"
17- NODEJS_RELATIVE_PATH = "n" # Relative path within WinPython dir
1817
1918# Ensure necessary directories exist at the start
2019assert PORTABLE_DIRECTORY .is_dir (), f"Portable directory not found: { PORTABLE_DIRECTORY } "
@@ -81,17 +80,6 @@ def _get_python_zip_file(self) -> Path:
8180 return source_item
8281 raise RuntimeError (f"Could not find Python zip package in { self .wheels_directory } " )
8382
84- @property
85- def package_index_markdown (self ) -> str :
86- """Generates a Markdown formatted package index page."""
87- return self .distribution .generate_package_index_markdown (
88- self .python_executable_directory ,
89- self .winpyver2 ,
90- self .flavor ,
91- self .architecture_bits ,
92- self .release_level
93- )
94-
9583 @property
9684 def winpython_version_name (self ) -> str :
9785 """Returns the full WinPython version string."""
@@ -150,38 +138,36 @@ def _create_initial_batch_scripts(self):
150138 with open (self .winpython_directory / "scripts" / "env.ini" , "w" ) as f :
151139 f .writelines ([f'{ a } ={ b } \n ' for a , b in init_variables ])
152140
153- def build (self , rebuild : bool = True , winpy_dir : Path = None ):
141+ def build (self , winpy_dir : Path = None ):
154142 """Make or finalise WinPython distribution in the target directory"""
155143 print (f"Building WinPython with Python archive: { self .python_zip_file .name } " )
156144 if winpy_dir is None :
157145 raise RuntimeError ("WinPython base directory to create is undefined" )
158146 self .winpython_directory = winpy_dir
159147
160- if rebuild :
161- self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
162- if self .winpython_directory .is_dir ():
163- shutil .rmtree (self .winpython_directory )
164- os .makedirs (self .winpython_directory , exist_ok = True )
165- # preventive re-Creation of settings directory
166- (self .winpython_directory / "settings" / "AppData" / "Roaming" ).mkdir (parents = True , exist_ok = True )
167- self ._extract_python_archive ()
148+ self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
149+ if self .winpython_directory .is_dir ():
150+ shutil .rmtree (self .winpython_directory )
151+ os .makedirs (self .winpython_directory , exist_ok = True )
152+ # preventive re-Creation of settings directory
153+ (self .winpython_directory / "settings" / "AppData" / "Roaming" ).mkdir (parents = True , exist_ok = True )
154+ self ._extract_python_archive ()
168155
169156 self .distribution = wppm .Distribution (self .python_executable_directory , verbose = self .verbose )
170157
171- if rebuild :
172- self ._copy_essential_files ()
173- self ._create_initial_batch_scripts ()
174- utils .python_execmodule ("ensurepip" , self .distribution .target )
175- self .distribution .patch_standard_packages ("pip" )
176- essential_packages = ["pip" , "setuptools" , "wheel" , "wppm" ]
177- for package_name in essential_packages :
178- actions = ["install" , "--upgrade" , "--pre" , package_name ] + self .install_options
179- self ._print_action (f"Piping: { ' ' .join (actions )} " )
180- self .distribution .do_pip_action (actions )
181- self .distribution .patch_standard_packages (package_name )
158+ self ._copy_essential_files ()
159+ 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 )
182168
183169def make_all (build_number : int , release_level : str , basedir_wpy : Path = None ,
184- verbose : bool = False , rebuild : bool = True , install_options = ["--no-index" ],
170+ verbose : bool = False , install_options = ["--no-index" ],
185171 flavor : str = "" , find_links : str | list [Path ] = None ,
186172 source_dirs : Path = None , toolsdirs : str | list [Path ] = None ,
187173):
@@ -192,7 +178,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
192178 release_level: release level (e.g. 'beta1', '') [str]
193179 basedir_wpy: top directory of the build (c:\...\Wpy...)
194180 verbose: Enable verbose output (bool).
195- rebuild: Whether to rebuild the distribution (bool).
196181 install_options: pip options (r'--no-index --pre --trusted-host=None')
197182 flavor: WinPython flavor (str).
198183 find_links: package directories (r'D:\Winpython\packages.srcreq')
@@ -207,18 +192,16 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
207192 find_links_options = [f"--find-links={ link } " for link in find_links_dirs_list + [source_dirs ]]
208193 winpy_dir = Path (basedir_wpy )
209194
210- if rebuild :
211- utils .print_box (f"Making WinPython at { winpy_dir } " )
212- os .makedirs (winpy_dir , exist_ok = True )
213-
195+ utils .print_box (f"Making WinPython at { winpy_dir } " )
196+ os .makedirs (winpy_dir , exist_ok = True )
214197 builder = WinPythonDistributionBuilder (
215198 build_number , release_level , winpy_dir .parent , wheels_directory = source_dirs ,
216199 tools_directories = [Path (d ) for d in tools_dirs_list ],
217200 verbose = verbose ,
218201 install_options = install_options_list + find_links_options ,
219202 flavor = flavor
220203 )
221- builder .build (rebuild = rebuild , winpy_dir = winpy_dir )
204+ builder .build (winpy_dir = winpy_dir )
222205
223206
224207if __name__ == "__main__" :
0 commit comments