From 40d9304d66edcab3925c75e9d8ad093562cf5d7b Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 21 Oct 1990 16:17:34 +0000 Subject: Use 'stat' module instead of hardcoding information from . --- Lib/dircmp.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'Lib/dircmp.py') diff --git a/Lib/dircmp.py b/Lib/dircmp.py index 762a186095..819f0bdf9f 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 . -# -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) -- cgit v1.2.1