diff options
author | Guido van Rossum <guido@python.org> | 1990-10-21 16:17:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1990-10-21 16:17:34 (GMT) |
commit | 40d9304d66edcab3925c75e9d8ad093562cf5d7b (patch) | |
tree | 3bc446bca5a87b869635865bb2f1e97b0b33116b /Lib/dircmp.py | |
parent | 6b47ed1f9d21371b33d5a46615edef8b61ac4a94 (diff) | |
download | cpython-40d9304d66edcab3925c75e9d8ad093562cf5d7b.zip cpython-40d9304d66edcab3925c75e9d8ad093562cf5d7b.tar.gz cpython-40d9304d66edcab3925c75e9d8ad093562cf5d7b.tar.bz2 |
Use 'stat' module instead of hardcoding information from <sys/stat.h>.
Diffstat (limited to 'Lib/dircmp.py')
-rw-r--r-- | Lib/dircmp.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/Lib/dircmp.py b/Lib/dircmp.py index 762a186..819f0bd 100644 --- a/Lib/dircmp.py +++ b/Lib/dircmp.py @@ -9,17 +9,7 @@ import path import dircache import cmpcache import statcache - - -# File type constants from <sys/stat.h>. -# -S_IFDIR = 4 -S_IFREG = 8 - -# Extract the file type from a stat buffer. -# -def S_IFMT(st): return st[0] / 4096 - +from stat import * # Directory comparison class. # @@ -79,13 +69,13 @@ class dircmp(): ok = 0 # if ok: - a_type = S_IFMT(a_stat) - b_type = S_IFMT(b_stat) + a_type = S_IFMT(a_stat[ST_MODE]) + b_type = S_IFMT(b_stat[ST_MODE]) if a_type <> b_type: dd.common_funny.append(x) - elif a_type = S_IFDIR: + elif S_ISDIR(a_type): dd.common_dirs.append(x) - elif a_type = S_IFREG: + elif S_ISREG(a_type): dd.common_files.append(x) else: dd.common_funny.append(x) |