[Python-checkins] CVS: distutils/distutils util.py,1.28,1.29

Greg Ward python-dev@python.org
Sat, 22 Apr 2000 11:15:02 -0400 (EDT)


Update of /projects/cvsroot/distutils/distutils
In directory thrak:/home/gward/python/distutils/distutils

Modified Files:
	util.py 
Log Message:
Merged in Python 1.5.1 compatibility changes from the 0.1.3 branch:
added 'abspath()' and 'extend()'.


Index: util.py
===================================================================
RCS file: /projects/cvsroot/distutils/distutils/util.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** util.py	2000/04/15 22:15:07	1.28
--- util.py	2000/04/22 15:14:58	1.29
***************
*** 6,10 ****
  # created 1999/03/08, Greg Ward
  
! __revision__ = "$Id: util.py,v 1.28 2000/04/15 22:15:07 gward Exp $"
  
  import sys, os, string, re, shutil
--- 6,10 ----
  # created 1999/03/08, Greg Ward
  
! __revision__ = "$Id: util.py,v 1.29 2000/04/22 15:14:58 gward Exp $"
  
  import sys, os, string, re, shutil
***************
*** 17,20 ****
--- 17,44 ----
  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 ()