[Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.24,1.25 compileall.py,1.11,1.12 dircache.py,1.10,1.11 dospath.py,1.28,1.29 filecmp.py,1.11,1.12 imputil.py,1.24,1.25 linecache.py,1.10,1.11 macpath.py,1.38,1.39 mhlib.py,1.31,1.32 ntpath.py,1.48,1.49 os2emxpath.py,1.5,1.6 posixpath.py,1.49,1.50 pstats.py,1.25,1.26 py_compile.py,1.20,1.21 pydoc.py,1.64,1.65 statcache.py,1.15,1.16 uu.py,1.18,1.19 zipfile.py,1.22,1.23
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Sat, 01 Jun 2002 12:51:17 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv18955
Modified Files:
CGIHTTPServer.py compileall.py dircache.py dospath.py
filecmp.py imputil.py linecache.py macpath.py mhlib.py
ntpath.py os2emxpath.py posixpath.py pstats.py py_compile.py
pydoc.py statcache.py uu.py zipfile.py
Log Message:
Replaced obsolete stat module constants with equivalent attributes
Index: CGIHTTPServer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** CGIHTTPServer.py 7 Apr 2002 06:36:22 -0000 1.24
--- CGIHTTPServer.py 1 Jun 2002 19:51:15 -0000 1.25
***************
*** 309,313 ****
except os.error:
return False
! return st[0] & 0111 != 0
--- 309,313 ----
except os.error:
return False
! return st.st_mode & 0111 != 0
Index: compileall.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compileall.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** compileall.py 1 Jun 2002 00:06:20 -0000 1.11
--- compileall.py 1 Jun 2002 19:51:15 -0000 1.12
***************
*** 14,18 ****
import os
- import stat
import sys
import py_compile
--- 14,17 ----
***************
*** 57,62 ****
if tail == '.py':
cfile = fullname + (__debug__ and 'c' or 'o')
! ftime = os.stat(fullname)[stat.ST_MTIME]
! try: ctime = os.stat(cfile)[stat.ST_MTIME]
except os.error: ctime = 0
if (ctime > ftime) and not force: continue
--- 56,61 ----
if tail == '.py':
cfile = fullname + (__debug__ and 'c' or 'o')
! ftime = os.stat(fullname).st_mtime
! try: ctime = os.stat(cfile).st_mtime
except os.error: ctime = 0
if (ctime > ftime) and not force: continue
Index: dircache.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dircache.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dircache.py 16 Mar 2001 08:29:47 -0000 1.10
--- dircache.py 1 Jun 2002 19:51:15 -0000 1.11
***************
*** 24,28 ****
cached_mtime, list = -1, []
try:
! mtime = os.stat(path)[8]
except os.error:
return []
--- 24,28 ----
cached_mtime, list = -1, []
try:
! mtime = os.stat(path).st_mtime
except os.error:
return []
Index: dospath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dospath.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** dospath.py 1 Jun 2002 14:18:45 -0000 1.28
--- dospath.py 1 Jun 2002 19:51:15 -0000 1.29
***************
*** 124,140 ****
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[stat.ST_SIZE]
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[stat.ST_MTIME]
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()."""
- st = os.stat(filename)
- return st[stat.ST_ATIME]
def islink(path):
--- 124,137 ----
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
! return os.stat(filename).st_size
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()."""
! return os.stat(filename).st_mtime
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()."""
+ return os.stat(filename).st_atime
def islink(path):
***************
*** 163,167 ****
except os.error:
return False
! return stat.S_ISDIR(st[stat.ST_MODE])
--- 160,164 ----
except os.error:
return False
! return stat.S_ISDIR(st.st_mode)
***************
*** 173,177 ****
except os.error:
return False
! return stat.S_ISREG(st[stat.ST_MODE])
--- 170,174 ----
except os.error:
return False
! return stat.S_ISREG(st.st_mode)
Index: filecmp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/filecmp.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** filecmp.py 4 Apr 2002 22:55:58 -0000 1.11
--- filecmp.py 1 Jun 2002 19:51:15 -0000 1.12
***************
*** 65,71 ****
def _sig(st):
! return (stat.S_IFMT(st[stat.ST_MODE]),
! st[stat.ST_SIZE],
! st[stat.ST_MTIME])
def _do_cmp(f1, f2):
--- 65,71 ----
def _sig(st):
! return (stat.S_IFMT(st.st_mode),
! st.st_size,
! st.st_mtime)
def _do_cmp(f1, f2):
***************
*** 200,205 ****
if ok:
! a_type = stat.S_IFMT(a_stat[stat.ST_MODE])
! b_type = stat.S_IFMT(b_stat[stat.ST_MODE])
if a_type != b_type:
self.common_funny.append(x)
--- 200,205 ----
if ok:
! a_type = stat.S_IFMT(a_stat.st_mode)
! b_type = stat.S_IFMT(b_stat.st_mode)
if a_type != b_type:
self.common_funny.append(x)
Index: imputil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imputil.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** imputil.py 1 Jun 2002 03:06:31 -0000 1.24
--- imputil.py 1 Jun 2002 19:51:15 -0000 1.25
***************
*** 485,489 ****
except OSError:
return None
! return (s[0] & 0170000) == 0040000
def _timestamp(pathname):
--- 485,489 ----
except OSError:
return None
! return (s.st_mode & 0170000) == 0040000
def _timestamp(pathname):
***************
*** 493,497 ****
except OSError:
return None
! return long(s[8])
--- 493,497 ----
except OSError:
return None
! return long(s.st_mtime)
Index: linecache.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/linecache.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** linecache.py 1 Jun 2002 14:18:45 -0000 1.10
--- linecache.py 1 Jun 2002 19:51:15 -0000 1.11
***************
*** 8,12 ****
import sys
import os
- from stat import *
__all__ = ["getline","clearcache","checkcache"]
--- 8,11 ----
***************
*** 53,57 ****
del cache[filename]
continue
! if size != stat[ST_SIZE] or mtime != stat[ST_MTIME]:
del cache[filename]
--- 52,56 ----
del cache[filename]
continue
! if size != stat.st_size or mtime != stat.st_mtime:
del cache[filename]
***************
*** 97,101 ****
## print '*** Cannot open', fullname, ':', msg
return []
! size, mtime = stat[ST_SIZE], stat[ST_MTIME]
cache[filename] = size, mtime, lines, fullname
return lines
--- 96,100 ----
## print '*** Cannot open', fullname, ':', msg
return []
! size, mtime = stat.st_size, stat.st_mtime
cache[filename] = size, mtime, lines, fullname
return lines
Index: macpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** macpath.py 23 May 2002 15:15:29 -0000 1.38
--- macpath.py 1 Jun 2002 19:51:15 -0000 1.39
***************
*** 101,105 ****
except os.error:
return 0
! return S_ISDIR(st[ST_MODE])
--- 101,105 ----
except os.error:
return 0
! return S_ISDIR(st.st_mode)
***************
*** 108,123 ****
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[ST_SIZE]
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[ST_MTIME]
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[ST_ATIME]
--- 108,120 ----
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
! return os.stat(filename).st_size
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()."""
! return os.stat(filename).st_mtime
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()."""
! return os.stat(filename).st_atime
***************
*** 139,143 ****
except os.error:
return False
! return S_ISREG(st[ST_MODE])
--- 136,140 ----
except os.error:
return False
! return S_ISREG(st.st_mode)
Index: mhlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mhlib.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** mhlib.py 1 Jun 2002 16:07:16 -0000 1.31
--- mhlib.py 1 Jun 2002 19:51:15 -0000 1.32
***************
*** 75,79 ****
import os
import sys
- from stat import ST_NLINK
import re
import mimetools
--- 75,78 ----
***************
*** 156,161 ****
# Get the link count so we can avoid listing folders
# that have no subfolders.
! st = os.stat(fullname)
! nlinks = st[ST_NLINK]
if nlinks <= 2:
return []
--- 155,159 ----
# Get the link count so we can avoid listing folders
# that have no subfolders.
! nlinks = os.stat(fullname).st_nlink
if nlinks <= 2:
return []
***************
*** 184,189 ****
# Get the link count so we can avoid listing folders
# that have no subfolders.
! st = os.stat(fullname)
! nlinks = st[ST_NLINK]
if nlinks <= 2:
return []
--- 182,186 ----
# Get the link count so we can avoid listing folders
# that have no subfolders.
! nlinks = os.stat(fullname).st_nlink
if nlinks <= 2:
return []
Index: ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** ntpath.py 1 Jun 2002 14:18:46 -0000 1.48
--- ntpath.py 1 Jun 2002 19:51:15 -0000 1.49
***************
*** 217,232 ****
def getsize(filename):
"""Return the size of a file, reported by os.stat()"""
! st = os.stat(filename)
! return st[stat.ST_SIZE]
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()"""
! st = os.stat(filename)
! return st[stat.ST_MTIME]
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()"""
! st = os.stat(filename)
! return st[stat.ST_ATIME]
--- 217,229 ----
def getsize(filename):
"""Return the size of a file, reported by os.stat()"""
! return os.stat(filename).st_size
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()"""
! return os.stat(filename).st_mtime
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()"""
! return os.stat(filename).st_atime
***************
*** 261,265 ****
except os.error:
return False
! return stat.S_ISDIR(st[stat.ST_MODE])
--- 258,262 ----
except os.error:
return False
! return stat.S_ISDIR(st.st_mode)
***************
*** 274,278 ****
except os.error:
return False
! return stat.S_ISREG(st[stat.ST_MODE])
--- 271,275 ----
except os.error:
return False
! return stat.S_ISREG(st.st_mode)
Index: os2emxpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os2emxpath.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** os2emxpath.py 1 Jun 2002 14:18:46 -0000 1.5
--- os2emxpath.py 1 Jun 2002 19:51:15 -0000 1.6
***************
*** 176,191 ****
def getsize(filename):
"""Return the size of a file, reported by os.stat()"""
! st = os.stat(filename)
! return st[stat.ST_SIZE]
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()"""
! st = os.stat(filename)
! return st[stat.ST_MTIME]
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()"""
! st = os.stat(filename)
! return st[stat.ST_ATIME]
--- 176,188 ----
def getsize(filename):
"""Return the size of a file, reported by os.stat()"""
! return os.stat(filename).st_size
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()"""
! return os.stat(filename).st_mtime
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()"""
! return os.stat(filename).st_atime
***************
*** 218,222 ****
except os.error:
return False
! return stat.S_ISDIR(st[stat.ST_MODE])
--- 215,219 ----
except os.error:
return False
! return stat.S_ISDIR(st.st_mode)
***************
*** 231,235 ****
except os.error:
return False
! return stat.S_ISREG(st[stat.ST_MODE])
--- 228,232 ----
except os.error:
return False
! return stat.S_ISREG(st.st_mode)
Index: posixpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** posixpath.py 1 Jun 2002 14:18:46 -0000 1.49
--- posixpath.py 1 Jun 2002 19:51:15 -0000 1.50
***************
*** 137,152 ****
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[stat.ST_SIZE]
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[stat.ST_MTIME]
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()."""
! st = os.stat(filename)
! return st[stat.ST_ATIME]
--- 137,149 ----
def getsize(filename):
"""Return the size of a file, reported by os.stat()."""
! return os.stat(filename).st_size
def getmtime(filename):
"""Return the last modification time of a file, reported by os.stat()."""
! return os.stat(filename).st_mtime
def getatime(filename):
"""Return the last access time of a file, reported by os.stat()."""
! return os.stat(filename).st_atime
***************
*** 160,164 ****
except (os.error, AttributeError):
return False
! return stat.S_ISLNK(st[stat.ST_MODE])
--- 157,161 ----
except (os.error, AttributeError):
return False
! return stat.S_ISLNK(st.st_mode)
***************
*** 185,189 ****
except os.error:
return False
! return stat.S_ISDIR(st[stat.ST_MODE])
--- 182,186 ----
except os.error:
return False
! return stat.S_ISDIR(st.st_mode)
***************
*** 198,202 ****
except os.error:
return False
! return stat.S_ISREG(st[stat.ST_MODE])
--- 195,199 ----
except os.error:
return False
! return stat.S_ISREG(st.st_mode)
***************
*** 225,230 ****
def samestat(s1, s2):
"""Test whether two stat buffers reference the same file"""
! return s1[stat.ST_INO] == s2[stat.ST_INO] and \
! s1[stat.ST_DEV] == s2[stat.ST_DEV]
--- 222,227 ----
def samestat(s1, s2):
"""Test whether two stat buffers reference the same file"""
! return s1.st_ino == s2.st_ino and \
! s1.st_dev == s2.st_dev
***************
*** 239,248 ****
except os.error:
return False # It doesn't exist -- so not a mount point :-)
! dev1 = s1[stat.ST_DEV]
! dev2 = s2[stat.ST_DEV]
if dev1 != dev2:
return True # path/.. on a different device as path
! ino1 = s1[stat.ST_INO]
! ino2 = s2[stat.ST_INO]
if ino1 == ino2:
return True # path/.. is the same i-node as path
--- 236,245 ----
except os.error:
return False # It doesn't exist -- so not a mount point :-)
! dev1 = s1.st_dev
! dev2 = s2.st_dev
if dev1 != dev2:
return True # path/.. on a different device as path
! ino1 = s1.st_ino
! ino2 = s2.st_ino
if ino1 == ino2:
return True # path/.. is the same i-node as path
Index: pstats.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** pstats.py 1 Jun 2002 16:07:16 -0000 1.25
--- pstats.py 1 Jun 2002 19:51:15 -0000 1.26
***************
*** 109,113 ****
try:
file_stats = os.stat(arg)
! arg = time.ctime(file_stats[8]) + " " + arg
except: # in case this is not unix
pass
--- 109,113 ----
try:
file_stats = os.stat(arg)
! arg = time.ctime(file_stats.st_mtime) + " " + arg
except: # in case this is not unix
pass
Index: py_compile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/py_compile.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** py_compile.py 1 Jun 2002 16:07:16 -0000 1.20
--- py_compile.py 1 Jun 2002 19:51:15 -0000 1.21
***************
*** 47,53 ****
f = open(file, 'U')
try:
! timestamp = long(os.fstat(f.fileno())[8])
except AttributeError:
! timestamp = long(os.stat(file)[8])
codestring = f.read()
# If parsing from a string, line breaks are \n (see parsetok.c:tok_nextc)
--- 47,53 ----
f = open(file, 'U')
try:
! timestamp = long(os.fstat(f.fileno()).st_mtime)
except AttributeError:
! timestamp = long(os.stat(file).st_mtime)
codestring = f.read()
# If parsing from a string, line breaks are \n (see parsetok.c:tok_nextc)
Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** pydoc.py 1 Jun 2002 14:18:46 -0000 1.64
--- pydoc.py 1 Jun 2002 19:51:15 -0000 1.65
***************
*** 44,48 ****
# path will be displayed.
! import sys, imp, os, stat, re, types, inspect
from repr import Repr
from string import expandtabs, find, join, lower, split, strip, rfind, rstrip
--- 44,48 ----
# path will be displayed.
! import sys, imp, os, re, types, inspect
from repr import Repr
from string import expandtabs, find, join, lower, split, strip, rfind, rstrip
***************
*** 154,158 ****
def synopsis(filename, cache={}):
"""Get the one-line summary out of a module file."""
! mtime = os.stat(filename)[stat.ST_MTIME]
lastupdate, result = cache.get(filename, (0, None))
if lastupdate < mtime:
--- 154,158 ----
def synopsis(filename, cache={}):
"""Get the one-line summary out of a module file."""
! mtime = os.stat(filename).st_mtime
lastupdate, result = cache.get(filename, (0, None))
if lastupdate < mtime:
***************
*** 1699,1703 ****
roots = map(lambda dir: (dir, ''), pathdirs())
Scanner.__init__(self, roots, self.submodules, self.isnewpackage)
! self.inodes = map(lambda (dir, pkg): os.stat(dir)[1], roots)
def submodules(self, (dir, package)):
--- 1699,1703 ----
roots = map(lambda dir: (dir, ''), pathdirs())
Scanner.__init__(self, roots, self.submodules, self.isnewpackage)
! self.inodes = map(lambda (dir, pkg): os.stat(dir).st_ino, roots)
def submodules(self, (dir, package)):
***************
*** 1713,1717 ****
def isnewpackage(self, (dir, package)):
! inode = os.path.exists(dir) and os.stat(dir)[1]
if not (os.path.islink(dir) and inode in self.inodes):
self.inodes.append(inode) # detect circular symbolic links
--- 1713,1717 ----
def isnewpackage(self, (dir, package)):
! inode = os.path.exists(dir) and os.stat(dir).st_ino
if not (os.path.islink(dir) and inode in self.inodes):
self.inodes.append(inode) # detect circular symbolic links
Index: statcache.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/statcache.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** statcache.py 1 Jun 2002 14:18:46 -0000 1.15
--- statcache.py 1 Jun 2002 19:51:15 -0000 1.16
***************
*** 80,82 ****
except _os.error:
return False
! return S_ISDIR(st[ST_MODE])
--- 80,82 ----
except _os.error:
return False
! return S_ISDIR(st.st_mode)
Index: uu.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/uu.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** uu.py 17 Aug 2001 19:59:34 -0000 1.18
--- uu.py 1 Jun 2002 19:51:15 -0000 1.19
***************
*** 53,57 ****
if mode is None:
try:
! mode = os.stat(in_file)[0]
except AttributeError:
pass
--- 53,57 ----
if mode is None:
try:
! mode = os.stat(in_file).st_mode
except AttributeError:
pass
Index: zipfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** zipfile.py 1 Jun 2002 14:18:47 -0000 1.22
--- zipfile.py 1 Jun 2002 19:51:15 -0000 1.23
***************
*** 374,378 ****
arcname."""
st = os.stat(filename)
! mtime = time.localtime(st[8])
date_time = mtime[0:6]
# Create ZipInfo instance to store file information
--- 374,378 ----
arcname."""
st = os.stat(filename)
! mtime = time.localtime(st.st_mtime)
date_time = mtime[0:6]
# Create ZipInfo instance to store file information
***************
*** 573,580 ****
file_pyo = pathname + ".pyo"
if os.path.isfile(file_pyo) and \
! os.stat(file_pyo)[8] >= os.stat(file_py)[8]:
fname = file_pyo # Use .pyo file
elif not os.path.isfile(file_pyc) or \
! os.stat(file_pyc)[8] < os.stat(file_py)[8]:
import py_compile
if self.debug:
--- 573,580 ----
file_pyo = pathname + ".pyo"
if os.path.isfile(file_pyo) and \
! os.stat(file_pyo).st_mtime >= os.stat(file_py).st_mtime:
fname = file_pyo # Use .pyo file
elif not os.path.isfile(file_pyc) or \
! os.stat(file_pyc).st_mtime < os.stat(file_py).st_mtime:
import py_compile
if self.debug: