Hack to make this play nicer with *old* versions of Python: os.path.abspath()

was not available in Python 1.5.1.  (Yes, a user actually tried to use this
with that version of Python!)
This commit is contained in:
Fred Drake 2001-05-29 16:10:07 +00:00
parent 597bc1d46f
commit 964c074a62
1 changed files with 10 additions and 0 deletions

View File

@ -46,6 +46,16 @@ import sys
import tempfile 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]) MYDIR = os.path.abspath(sys.path[0])
TOPDIR = os.path.dirname(MYDIR) TOPDIR = os.path.dirname(MYDIR)