2121 validate_directory ,
2222 configure_logging ,
2323 logger ,
24+ INDENT ,
2425)
2526
2627# Define a custom log level that always prints
@@ -237,7 +238,7 @@ def replace_one_file_with_symlink(inputdata_root, target_dir, file_path, dry_run
237238 file_path (str): The path of the file to be replaced.
238239 dry_run (bool): If True, only show what would be done without making changes.
239240 """
240- logger .info ("Found owned file: %s " , file_path )
241+ logger .info ("'%s': " , file_path )
241242
242243 # Determine the relative path and the new link's destination
243244 relative_path = os .path .relpath (file_path , inputdata_root )
@@ -246,9 +247,9 @@ def replace_one_file_with_symlink(inputdata_root, target_dir, file_path, dry_run
246247 # Check if the target file actually exists
247248 if not os .path .exists (link_target ):
248249 logger .warning (
249- "Warning: Corresponding file '%s' not found for '%s'. Skipping." ,
250+ "%sWarning: Corresponding file '%s' not found. Skipping." ,
251+ INDENT ,
250252 link_target ,
251- file_path ,
252253 )
253254 return
254255
@@ -257,7 +258,8 @@ def replace_one_file_with_symlink(inputdata_root, target_dir, file_path, dry_run
257258
258259 if dry_run :
259260 logger .info (
260- "[DRY RUN] Would create symbolic link: %s -> %s" ,
261+ "%s[DRY RUN] Would create symbolic link: %s -> %s" ,
262+ INDENT ,
261263 link_name ,
262264 link_target ,
263265 )
@@ -266,9 +268,9 @@ def replace_one_file_with_symlink(inputdata_root, target_dir, file_path, dry_run
266268 # Remove the original file
267269 try :
268270 os .rename (link_name , link_name + ".tmp" )
269- logger .info ("Deleted original file: %s" , link_name )
271+ logger .info ("%sDeleted original file: %s" , INDENT , link_name )
270272 except OSError as e :
271- logger .error ("Error deleting file %s: %s. Skipping." , link_name , e )
273+ logger .error ("%sError deleting file %s: %s. Skipping." , INDENT , link_name , e )
272274 return
273275
274276 # Create the symbolic link, handling necessary parent directories
@@ -277,10 +279,10 @@ def replace_one_file_with_symlink(inputdata_root, target_dir, file_path, dry_run
277279 os .makedirs (os .path .dirname (link_name ), exist_ok = True )
278280 os .symlink (link_target , link_name )
279281 os .remove (link_name + ".tmp" )
280- logger .info ("Created symbolic link: %s -> %s" , link_name , link_target )
282+ logger .info ("%sCreated symbolic link: %s -> %s" , INDENT , link_name , link_target )
281283 except OSError as e :
282284 os .rename (link_name + ".tmp" , link_name )
283- logger .error ("Error creating symlink for %s: %s. Skipping." , link_name , e )
285+ logger .error ("%sError creating symlink for %s: %s. Skipping." , INDENT , link_name , e )
284286
285287
286288def parse_arguments ():
0 commit comments