@@ -263,50 +263,54 @@ def _extract_version_from_url(self, version_string: str) -> str:
263
263
264
264
def _install_tl_install (self , version : str ) -> bool :
265
265
"""
266
- Install tool-esp_install ONLY when necessary.
267
-
266
+ Install tool-esp_install ONLY when necessary
267
+ and handles backwards compability for tl-install.
268
+
268
269
Args:
269
270
version: Version string or URL to install
270
-
271
+
271
272
Returns:
272
273
bool: True if installation successful, False otherwise
273
274
"""
274
275
tl_install_path = os .path .join (self .packages_dir , tl_install_name )
275
-
276
+ old_tl_install_path = os .path .join (self .packages_dir , "tl-install" )
277
+
276
278
try :
277
- # Remove old installation completely
279
+ old_tl_install_exists = os .path .exists (old_tl_install_path )
280
+ if old_tl_install_exists :
281
+ # remove outdated tl-install
282
+ safe_remove_directory (old_tl_install_path )
283
+
278
284
if os .path .exists (tl_install_path ):
279
285
logger .info (f"Removing old { tl_install_name } installation" )
280
286
safe_remove_directory (tl_install_path )
281
287
282
- # Remove maybe old existing version of tl-install too
283
- old_tl_install_path = os .path .join (self .packages_dir , "tl-install" )
284
- if os .path .exists (old_tl_install_path ):
285
- safe_remove_directory (old_tl_install_path )
286
-
287
- # Install new version
288
288
logger .info (f"Installing { tl_install_name } version { version } " )
289
-
290
- # Set package configuration
291
289
self .packages [tl_install_name ]["optional" ] = False
292
290
self .packages [tl_install_name ]["version" ] = version
293
-
294
- # Install via package manager
295
291
pm .install (version )
296
292
297
- # Verify installation
298
293
if os .path .exists (os .path .join (tl_install_path , "package.json" )):
299
294
logger .info (f"{ tl_install_name } successfully installed and verified" )
300
295
self .packages [tl_install_name ]["optional" ] = True
296
+
297
+ # Handle old tl-install to keep backwards compability
298
+ if old_tl_install_exists :
299
+ # Copy tool-esp_install content to tl-install location
300
+ if safe_copy_directory (tl_install_path , old_tl_install_path ):
301
+ logger .info (f"Content copied from { tl_install_name } to old tl-install location" )
302
+ else :
303
+ logger .warning (f"Failed to copy content to old tl-install location" )
301
304
return True
302
305
else :
303
306
logger .error (f"{ tl_install_name } installation failed - package.json not found" )
304
307
return False
305
-
308
+
306
309
except Exception as e :
307
310
logger .error (f"Error installing { tl_install_name } : { e } " )
308
311
return False
309
312
313
+
310
314
def _get_tool_paths (self , tool_name : str ) -> Dict [str , str ]:
311
315
"""Get centralized path calculation for tools with caching."""
312
316
if tool_name not in self ._tools_cache :
0 commit comments