comparison cutils/treesum.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 27d1aaf5fe39
comparison
equal deleted inserted replaced
155:bf74ce3c968d 156:481cc9b26861
310 for top, fsobjects in walk.walk( 310 for top, fsobjects in walk.walk(
311 root, 311 root,
312 follow_symlinks=follow_directory_symlinks): 312 follow_symlinks=follow_directory_symlinks):
313 dir_dgst = algorithm[0]() 313 dir_dgst = algorithm[0]()
314 for fso in fsobjects: 314 for fso in fsobjects:
315 # print("NNNNNNNN", fso.name, fso.stat,
316 # "%o (%o)" % (fso.stat.st_mode, stat.S_IMODE(fso.stat.st_mode)))
315 if fso.is_dir: 317 if fso.is_dir:
316 if fso.is_symlink and not follow_directory_symlinks: 318 if fso.is_symlink and not follow_directory_symlinks:
317 linktgt = util.fsencode(os.readlink(fso.path)) 319 linktgt = util.fsencode(os.readlink(fso.path))
318 linkdgst = algorithm[0]() 320 linkdgst = algorithm[0]()
319 linkdgst.update(b"%d:%s," % (len(linktgt), linktgt)) 321 linkdgst.update(b"%d:%s," % (len(linktgt), linktgt))