comparison cutils/util/walk.py @ 156:481cc9b26861

Calculate "stat()" for directories also in a WalkDirEntry
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 06 Jan 2025 14:38:07 +0100
parents bf74ce3c968d
children 29dd5528174c
comparison
equal deleted inserted replaced
155:bf74ce3c968d 156:481cc9b26861
107 # 107 #
108 # If is_symlink() raises an OSError, consider that the entry 108 # If is_symlink() raises an OSError, consider that the entry
109 # is not a symbolic link, same behaviour than os.path.islink(). 109 # is not a symbolic link, same behaviour than os.path.islink().
110 # 110 #
111 w._is_symlink = False 111 w._is_symlink = False
112 if not w._is_dir: 112 # Do not supress errors here and (consistently) follow symlinks
113 # Do not supress errors here and (consistently) follow symlinks 113 w._stat_result = entry.stat(follow_symlinks=True)
114 w._stat_result = entry.stat(follow_symlinks=True)
115 return w 114 return w
116 115
117 @staticmethod 116 @staticmethod
118 def sort_key(entry): 117 def sort_key(entry):
119 return entry._fsname 118 return entry._fsname