diff options
| author | Jack Diederich <jackdied@gmail.com> | 2006-08-26 18:42:06 (GMT) | 
|---|---|---|
| committer | Jack Diederich <jackdied@gmail.com> | 2006-08-26 18:42:06 (GMT) | 
| commit | 7b60464ceb845c3117e9524b17f30443423c3b9d (patch) | |
| tree | 7c222c22f1ca0f1a466bf1271172f90716cf789a /Lib/posixpath.py | |
| parent | 4582d7d905ae4299dd2ff981bfbab5980c9ddb79 (diff) | |
| download | cpython-7b60464ceb845c3117e9524b17f30443423c3b9d.zip cpython-7b60464ceb845c3117e9524b17f30443423c3b9d.tar.gz cpython-7b60464ceb845c3117e9524b17f30443423c3b9d.tar.bz2  | |
- Move functions common to all path modules into genericpath.py and have the
  OS speicifc path modules import them.
- Have os2emxpath import common functions fron ntpath instead of using copies
Diffstat (limited to 'Lib/posixpath.py')
| -rw-r--r-- | Lib/posixpath.py | 71 | 
1 files changed, 1 insertions, 70 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 9eac6bc..9dd0e90 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -12,6 +12,7 @@ for manipulation of the pathname component of URLs.  import os  import stat +from genericpath import *  __all__ = ["normcase","isabs","join","splitdrive","split","splitext",             "basename","dirname","commonprefix","getsize","getmtime", @@ -119,37 +120,6 @@ def dirname(p):      return split(p)[0] -# Return the longest prefix of all list elements. - -def commonprefix(m): -    "Given a list of pathnames, returns the longest common leading component" -    if not m: return '' -    s1 = min(m) -    s2 = max(m) -    n = min(len(s1), len(s2)) -    for i in xrange(n): -        if s1[i] != s2[i]: -            return s1[:i] -    return s1[:n] - -# Get size, mtime, atime of files. - -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 getctime(filename): -    """Return the metadata change time of a file, reported by os.stat().""" -    return os.stat(filename).st_ctime -  # Is a path a symbolic link?  # This will always return false on systems where os.lstat doesn't exist. @@ -161,19 +131,6 @@ def islink(path):          return False      return stat.S_ISLNK(st.st_mode) - -# Does a path exist? -# This is false for dangling symbolic links. - -def exists(path): -    """Test whether a path exists.  Returns False for broken symbolic links""" -    try: -        st = os.stat(path) -    except os.error: -        return False -    return True - -  # Being true for dangling symbolic links is also useful.  def lexists(path): @@ -185,32 +142,6 @@ def lexists(path):      return True -# Is a path a directory? -# This follows symbolic links, so both islink() and isdir() can be true -# for the same path. - -def isdir(path): -    """Test whether a path is a directory""" -    try: -        st = os.stat(path) -    except os.error: -        return False -    return stat.S_ISDIR(st.st_mode) - - -# Is a path a regular file? -# This follows symbolic links, so both islink() and isfile() can be true -# for the same path. - -def isfile(path): -    """Test whether a path is a regular file""" -    try: -        st = os.stat(path) -    except os.error: -        return False -    return stat.S_ISREG(st.st_mode) - -  # Are two filenames really pointing to the same file?  def samefile(f1, f2):  | 
