@@ -47,9 +47,9 @@ def replace_lines_in_file(filepath: Path, replacements: list[tuple[str, str]]):
47
47
48
48
for index , line in enumerate (lines ):
49
49
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 "
53
53
54
54
with open (filepath , "w" ) as f :
55
55
f .writelines (updated_lines )
@@ -148,9 +148,9 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
148
148
149
149
def _get_python_zip_file (self ) -> Path :
150
150
"""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 ():
152
152
if re .match ("(pypy3|python-)([0-9]|[a-zA-Z]|.)*.zip" , source_item .name ):
153
- return source_item
153
+ return source_item
154
154
raise RuntimeError (f"Could not find Python zip package in { self .wheels_directory } " )
155
155
156
156
@property
@@ -190,15 +190,15 @@ def get_tool_path(relative_path):
190
190
path = self .winpython_directory / relative_path if self .winpython_directory else None
191
191
return path if path and (path .is_file () or path .is_dir ()) else None
192
192
193
- if nodejs_path := get_tool_path (self .NODEJS_RELATIVE_PATH ):
193
+ if nodejs_path := get_tool_path (self .NODEJS_RELATIVE_PATH ):
194
194
node_version = utils .get_nodejs_version (nodejs_path )
195
195
npm_version = utils .get_npmjs_version (nodejs_path )
196
196
installed_tools += [("Nodejs" , node_version ), ("npmjs" , npm_version )]
197
-
197
+
198
198
if pandoc_executable := get_tool_path ("t/pandoc.exe" ):
199
199
pandoc_version = utils .get_pandoc_version (str (pandoc_executable .parent ))
200
200
installed_tools .append (("Pandoc" , pandoc_version ))
201
-
201
+
202
202
if vscode_executable := get_tool_path ("t/VSCode/Code.exe" ):
203
203
vscode_version = utils .getFileProperties (str (vscode_executable ))["FileVersion" ]
204
204
installed_tools .append (("VSCode" , vscode_version ))
@@ -239,9 +239,8 @@ def python_executable_directory(self) -> str:
239
239
python_path_directory = self .winpython_directory / self .python_directory_name if self .winpython_directory else None
240
240
if python_path_directory and python_path_directory .is_dir ():
241
241
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 ""
245
244
246
245
@property
247
246
def architecture_bits (self ) -> int :
@@ -259,7 +258,7 @@ def pre_path_entries(self) -> list[str]:
259
258
"DLLs" ,
260
259
"Scripts" ,
261
260
r"..\t" ,
262
- "..\\ " + self .NODEJS_RELATIVE_PATH ,
261
+ rf "..\{ self .NODEJS_RELATIVE_PATH } " ,
263
262
]
264
263
265
264
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
349
348
print (f"Building WinPython with Python archive: { self .python_zip_file .name } " )
350
349
if winpy_dirname is None :
351
350
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
354
352
355
353
if rebuild :
356
354
self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
0 commit comments