Mailing List Archive

python/dist/src/Lib/distutils dir_util.py,1.11,1.12
Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory sc8-pr-cvs1:/tmp/cvs-serv974

Modified Files:
dir_util.py
Log Message:
Part of the fix for bug #410541: add ensure_relative() function


Index: dir_util.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dir_util.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dir_util.py 19 Nov 2002 13:12:27 -0000 1.11
--- dir_util.py 26 Nov 2002 17:42:48 -0000 1.12
***************
*** 7,11 ****
__revision__ = "$Id$"

! import os
from types import *
from distutils.errors import DistutilsFileError, DistutilsInternalError
--- 7,11 ----
__revision__ = "$Id$"

! import os, sys
from types import *
from distutils.errors import DistutilsFileError, DistutilsInternalError
***************
*** 213,214 ****
--- 213,228 ----
log.warn(grok_environment_error(
exc, "error removing %s: " % directory))
+
+
+ def ensure_relative (path):
+ """Take the full path 'path', and make it a relative path so
+ it can be the second argument to os.path.join().
+ """
+ drive, path = os.path.splitdrive(path)
+ if sys.platform == 'mac':
+ return os.sep + path
+ else:
+ if path[0:1] == os.sep:
+ path = drive + path[1:]
+ return path
+