]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
posix -> os
authorGuido van Rossum <guido@python.org>
Tue, 31 Mar 1992 19:04:48 +0000 (19:04 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 31 Mar 1992 19:04:48 +0000 (19:04 +0000)
Lib/cmp.py
Lib/cmpcache.py
Lib/irix5/flp.py
Lib/lib-stdwin/anywin.py
Lib/lib-stdwin/dirwin.py
Lib/persist.py
Lib/plat-irix5/flp.py
Lib/statcache.py
Lib/stdwin/anywin.py
Lib/stdwin/dirwin.py

index 1b48c679a43a4528f4f68e74f15306fbc93889ad..a73b795f8b6b59451460a66bcd6fbc9a14a5e298 100644 (file)
@@ -8,14 +8,14 @@
 #      - We keep a cache of outcomes of earlier comparisons
 #      - We don't fork a process to run 'cmp' but read the files ourselves
 
-import posix
+import os
 
 cache = {}
 
 def cmp(f1, f2): # Compare two files, use the cache if possible.
        # Return 1 for identical files, 0 for different.
        # Raise exceptions if either file could not be statted, read, etc.
-       s1, s2 = sig(posix.stat(f1)), sig(posix.stat(f2))
+       s1, s2 = sig(os.stat(f1)), sig(os.stat(f2))
        if s1[0] <> 8 or s2[0] <> 8:
                # Either is a not a plain file -- always report as different
                return 0
index 20202e266b918fb61a034844cd6559147f5cbdea..d59fa60d023282510963d5014f2cb9f6fc3cd5aa 100644 (file)
@@ -9,7 +9,7 @@
 #      - We keep a cache of outcomes of earlier comparisons
 #      - We don't fork a process to run 'cmp' but read the files ourselves
 
-import posix
+import os
 from stat import *
 import statcache
 
@@ -20,7 +20,7 @@ cache = {}
 
 
 # Compare two files, use the cache if possible.
-# May raise posix.error if a stat or open of either fails.
+# May raise os.error if a stat or open of either fails.
 #
 def cmp(f1, f2):
        # Return 1 for identical files, 0 for different.
index e6608f8053c5ee01e748e02a724934dd6f14066c..fcc95f02cb9b5c16540aad0436ff11e216b29e26 100755 (executable)
@@ -4,7 +4,7 @@
 # Jack Jansen, December 1991
 #
 import string
-import path
+import os
 import sys
 import FL
 
@@ -106,11 +106,11 @@ def wrlong(fp, x):
     fp.write(chr(a) + chr(b) + chr(c) + chr(d))
 
 def getmtime(filename):
-    import posix
+    import os
     from stat import ST_MTIME
     try:
-       return posix.stat(filename)[ST_MTIME]
-    except posix.error:
+       return os.stat(filename)[ST_MTIME]
+    except os.error:
        return None
 
 #
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
            fp = None
     else:
        for pc in sys.path:
-           pn = path.join(pc, filename)
+           pn = os.path.join(pc, filename)
            try:
                fp = open(pn, 'r')
                filename = pn
index bb7e86547b891610d149e576eaf357eabdbaa94e..38ee8690a6d2e82cfb9058961637a0bf37fdc79f 100644 (file)
@@ -3,11 +3,11 @@
 
 import dirwin
 import filewin
-import path
+import os
 
 def open(name):
        print 'opening', name, '...'
-       if path.isdir(name):
+       if os.path.isdir(name):
                w = dirwin.open(name)
        else:
                w = filewin.open(name)
index beb522292127a48e15b4c911e764d0d07dc3b654..e8b01702074f25a125bd08858451828d35fe039f 100644 (file)
@@ -2,24 +2,24 @@
 
 # Directory windows, a subclass of listwin
 
+import os
 import gwin
 import listwin
 import anywin
-import path
 import dircache
 
 def action(w, string, i, detail):
        (h, v), clicks, button, mask = detail
        if clicks == 2:
-               name = path.join(w.name, string)
+               name = os.path.join(w.name, string)
                try:
                        w2 = anywin.open(name)
                        w2.parent = w
-               except posix.error, why:
+               except os.error, why:
                        stdwin.message('Can\'t open ' + name + ': ' + why[1])
 
 def open(name):
-       name = path.join(name, '')
+       name = os.path.join(name, '')
        list = dircache.opendir(name)[:]
        list.sort()
        dircache.annotate(name, list)
index 52cc6fb496f5d0001cbfb77f7f233259c71611ea..ae7d58ba7e2b83fab2741aeb164c39f7c688343c 100755 (executable)
@@ -32,16 +32,16 @@ defaultfile = 'wsrestore.py'
 
 def save():
        import __main__
-       import posix
+       import os
        # XXX On SYSV, if len(defaultfile) >= 14, this is wrong!
        backup = defaultfile + '~'
        try:
-               posix.unlink(backup)
-       except posix.error:
+               os.unlink(backup)
+       except os.error:
                pass
        try:
-               posix.rename(defaultfile, backup)
-       except posix.error:
+               os.rename(defaultfile, backup)
+       except os.error:
                pass
        fp = open(defaultfile, 'w')
        writedict(__main__.__dict__, fp)
index e6608f8053c5ee01e748e02a724934dd6f14066c..fcc95f02cb9b5c16540aad0436ff11e216b29e26 100755 (executable)
@@ -4,7 +4,7 @@
 # Jack Jansen, December 1991
 #
 import string
-import path
+import os
 import sys
 import FL
 
@@ -106,11 +106,11 @@ def wrlong(fp, x):
     fp.write(chr(a) + chr(b) + chr(c) + chr(d))
 
 def getmtime(filename):
-    import posix
+    import os
     from stat import ST_MTIME
     try:
-       return posix.stat(filename)[ST_MTIME]
-    except posix.error:
+       return os.stat(filename)[ST_MTIME]
+    except os.error:
        return None
 
 #
@@ -157,7 +157,7 @@ def _open_formfile2(filename):
            fp = None
     else:
        for pc in sys.path:
-           pn = path.join(pc, filename)
+           pn = os.path.join(pc, filename)
            try:
                fp = open(pn, 'r')
                filename = pn
index bf13eb5add83c6aa2e2942d12cf74d4d8d05715a..04381f3861591c0603b9f6455feddf7aa9708cff 100644 (file)
@@ -3,11 +3,11 @@
 # Maintain a cache of file stats.
 # There are functions to reset the cache or to selectively remove items.
 
-import posix
+import os
 from stat import *
 
 # The cache.
-# Keys are pathnames, values are `posix.stat' outcomes.
+# Keys are pathnames, values are `os.stat' outcomes.
 #
 cache = {}
 
@@ -17,7 +17,7 @@ cache = {}
 def stat(path):
        if cache.has_key(path):
                return cache[path]
-       cache[path] = ret = posix.stat(path)
+       cache[path] = ret = os.stat(path)
        return ret
 
 
@@ -81,6 +81,6 @@ def forget_except_prefix(prefix):
 def isdir(path):
        try:
                st = stat(path)
-       except posix.error:
+       except os.error:
                return 0
        return S_ISDIR(st[ST_MODE])
index bb7e86547b891610d149e576eaf357eabdbaa94e..38ee8690a6d2e82cfb9058961637a0bf37fdc79f 100755 (executable)
@@ -3,11 +3,11 @@
 
 import dirwin
 import filewin
-import path
+import os
 
 def open(name):
        print 'opening', name, '...'
-       if path.isdir(name):
+       if os.path.isdir(name):
                w = dirwin.open(name)
        else:
                w = filewin.open(name)
index beb522292127a48e15b4c911e764d0d07dc3b654..e8b01702074f25a125bd08858451828d35fe039f 100755 (executable)
@@ -2,24 +2,24 @@
 
 # Directory windows, a subclass of listwin
 
+import os
 import gwin
 import listwin
 import anywin
-import path
 import dircache
 
 def action(w, string, i, detail):
        (h, v), clicks, button, mask = detail
        if clicks == 2:
-               name = path.join(w.name, string)
+               name = os.path.join(w.name, string)
                try:
                        w2 = anywin.open(name)
                        w2.parent = w
-               except posix.error, why:
+               except os.error, why:
                        stdwin.message('Can\'t open ' + name + ': ' + why[1])
 
 def open(name):
-       name = path.join(name, '')
+       name = os.path.join(name, '')
        list = dircache.opendir(name)[:]
        list.sort()
        dircache.annotate(name, list)