@@ -47,9 +47,9 @@ def replace_lines_in_file(filepath: Path, replacements: list[tuple[str, str]]):
4747
4848 for index , line in enumerate (lines ):
4949 for prefix , new_text in replacements :
50- start_prefix = "set " + prefix if not prefix .startswith ("!" ) else prefix
51- if line .startswith (start_prefix + "=" ):
52- updated_lines [index ] = f"{ start_prefix } = { new_text } \n "
50+ start_prefix = f "set { prefix } =" if not prefix .startswith ("!" ) else prefix
51+ if line .startswith (start_prefix ):
52+ updated_lines [index ] = f"{ start_prefix } { new_text } \n "
5353
5454 with open (filepath , "w" ) as f :
5555 f .writelines (updated_lines )
@@ -148,9 +148,9 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
148148
149149 def _get_python_zip_file (self ) -> Path :
150150 """Finds the Python .zip file in the wheels directory."""
151- for source_item in self .wheels_directory .iterdir ():
151+ for source_item in self .wheels_directory .iterdir ():
152152 if re .match ("(pypy3|python-)([0-9]|[a-zA-Z]|.)*.zip" , source_item .name ):
153- return source_item
153+ return source_item
154154 raise RuntimeError (f"Could not find Python zip package in { self .wheels_directory } " )
155155
156156 @property
@@ -190,15 +190,15 @@ def get_tool_path(relative_path):
190190 path = self .winpython_directory / relative_path if self .winpython_directory else None
191191 return path if path and (path .is_file () or path .is_dir ()) else None
192192
193- if nodejs_path := get_tool_path (self .NODEJS_RELATIVE_PATH ):
193+ if nodejs_path := get_tool_path (self .NODEJS_RELATIVE_PATH ):
194194 node_version = utils .get_nodejs_version (nodejs_path )
195195 npm_version = utils .get_npmjs_version (nodejs_path )
196196 installed_tools += [("Nodejs" , node_version ), ("npmjs" , npm_version )]
197-
197+
198198 if pandoc_executable := get_tool_path ("t/pandoc.exe" ):
199199 pandoc_version = utils .get_pandoc_version (str (pandoc_executable .parent ))
200200 installed_tools .append (("Pandoc" , pandoc_version ))
201-
201+
202202 if vscode_executable := get_tool_path ("t/VSCode/Code.exe" ):
203203 vscode_version = utils .getFileProperties (str (vscode_executable ))["FileVersion" ]
204204 installed_tools .append (("VSCode" , vscode_version ))
@@ -239,9 +239,8 @@ def python_executable_directory(self) -> str:
239239 python_path_directory = self .winpython_directory / self .python_directory_name if self .winpython_directory else None
240240 if python_path_directory and python_path_directory .is_dir ():
241241 return str (python_path_directory )
242- else :
243- python_path_executable = self .winpython_directory / self .python_name if self .winpython_directory else None
244- return str (python_path_executable ) if python_path_executable else ""
242+ python_path_executable = self .winpython_directory / self .python_name if self .winpython_directory else None
243+ return str (python_path_executable ) if python_path_executable else ""
245244
246245 @property
247246 def architecture_bits (self ) -> int :
@@ -259,7 +258,7 @@ def pre_path_entries(self) -> list[str]:
259258 "DLLs" ,
260259 "Scripts" ,
261260 r"..\t" ,
262- "..\\ " + self .NODEJS_RELATIVE_PATH ,
261+ rf "..\{ self .NODEJS_RELATIVE_PATH } " ,
263262 ]
264263
265264 def create_installer_7zip (self , installer_type : str = ".exe" ):
@@ -349,8 +348,7 @@ def build(self, rebuild: bool = True, requirements_files_list=None, winpy_dirnam
349348 print (f"Building WinPython with Python archive: { self .python_zip_file .name } " )
350349 if winpy_dirname is None :
351350 raise RuntimeError ("WinPython base directory to create is undefined" )
352- else :
353- self .winpython_directory = self .target_directory / winpy_dirname # Create/re-create the WinPython base directory
351+ self .winpython_directory = self .target_directory / winpy_dirname
354352
355353 if rebuild :
356354 self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
0 commit comments