summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-04-22 15:14:58 (GMT)
committerGreg Ward <gward@python.net>2000-04-22 15:14:58 (GMT)
commitaa458bc46500a2b135cad66a4fd66cac69b8be51 (patch)
treea6485c15e97fb07169bcb9e4fc8f0d59c634302f
parentd80506c23815aa1410c44dfb65cd53abdd12ffa0 (diff)
downloadcpython-aa458bc46500a2b135cad66a4fd66cac69b8be51.zip
cpython-aa458bc46500a2b135cad66a4fd66cac69b8be51.tar.gz
cpython-aa458bc46500a2b135cad66a4fd66cac69b8be51.tar.bz2
Merged in Python 1.5.1 compatibility changes from the 0.1.3 branch:
added 'abspath()' and 'extend()'.
-rw-r--r--Lib/distutils/util.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index be3a1d6..9c436b9 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -18,6 +18,30 @@ from distutils.dep_util import *
from distutils.archive_util import *
+# Need to define 'abspath()', because it was new with Python 1.5.2
+if hasattr (os.path, 'abspath'):
+ abspath = os.path.abspath
+else:
+ def abspath(path):
+ if not os.path.isabs(path):
+ path = os.path.join(os.getcwd(), path)
+ return os.path.normpath(path)
+
+
+# More backwards compatability hacks
+def extend (list, new_list):
+ """Appends the list 'new_list' to 'list', just like the 'extend()'
+ list method does in Python 1.5.2 -- but this works on earlier
+ versions of Python too."""
+
+ if hasattr (list, 'extend'):
+ list.extend (new_list)
+ else:
+ list[len(list):] = new_list
+
+# extend ()
+
+
def get_platform ():
"""Return a string (suitable for tacking onto directory names) that
identifies the current platform. Under Unix, identifies both the OS