]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Hack to make this play nicer with *old* versions of Python: os.path.abspath()
authorFred Drake <fdrake@acm.org>
Tue, 29 May 2001 16:10:07 +0000 (16:10 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 29 May 2001 16:10:07 +0000 (16:10 +0000)
was not available in Python 1.5.1.  (Yes, a user actually tried to use this
with that version of Python!)

Doc/tools/mkhowto

index 6481e93e2bb558b5b68fc5abdf17f426fedd6c41..f92cbda1aae48c780ccc755ab04d580af39a096d 100755 (executable)
@@ -46,6 +46,16 @@ import sys
 import tempfile
 
 
+if not hasattr(os.path, "abspath"):
+    def abspath(path):
+        """Return an absolute path."""
+        if not os.path.isabs(path):
+            path = os.path.join(os.getcwd(), path)
+        return os.path.normpath(path)
+
+    os.path.abspath = abspath
+
+
 MYDIR = os.path.abspath(sys.path[0])
 TOPDIR = os.path.dirname(MYDIR)