]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Replace obsolete stat module constants with
authorWalter Dörwald <walter@livinglogic.de>
Thu, 6 Jun 2002 09:48:13 +0000 (09:48 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Thu, 6 Jun 2002 09:48:13 +0000 (09:48 +0000)
equivalent attributes in a few more spots.

This closes SF patch http://www.python.org/sf/562373

Lib/fileinput.py
Lib/shutil.py

index 5626ee8adc0673291b28383481826bcb71f05a29..d45aeca960b9361b52dbdbf97cbed2d2399868ca 100644 (file)
@@ -79,7 +79,7 @@ XXX Possible additions:
 
 """
 
-import sys, os, stat
+import sys, os
 
 __all__ = ["input","close","nextfile","filename","lineno","filelineno",
            "isfirstline","isstdin","FileInput"]
@@ -300,7 +300,7 @@ class FileInput:
                     os.rename(self._filename, self._backupfilename)
                     self._file = open(self._backupfilename, "r")
                     try:
-                        perm = os.fstat(self._file.fileno())[stat.ST_MODE]
+                        perm = os.fstat(self._file.fileno()).st_mode
                     except:
                         self._output = open(self._filename, "w")
                     else:
index 434012730276e45ab469b619a8ce46d3d3c336e2..3076be92e167cb2edb293bcb904c96421ddc3e20 100644 (file)
@@ -38,15 +38,15 @@ def copymode(src, dst):
     """Copy mode bits from src to dst"""
     if hasattr(os, 'chmod'):
         st = os.stat(src)
-        mode = stat.S_IMODE(st[stat.ST_MODE])
+        mode = stat.S_IMODE(st.st_mode)
         os.chmod(dst, mode)
 
 def copystat(src, dst):
     """Copy all stat info (mode bits, atime and mtime) from src to dst"""
     st = os.stat(src)
-    mode = stat.S_IMODE(st[stat.ST_MODE])
+    mode = stat.S_IMODE(st.st_mode)
     if hasattr(os, 'utime'):
-        os.utime(dst, (st[stat.ST_ATIME], st[stat.ST_MTIME]))
+        os.utime(dst, (st.st_atime, st.st_mtime))
     if hasattr(os, 'chmod'):
         os.chmod(dst, mode)