[Python-checkins] python/dist/src/Lib ntpath.py,1.44,1.44.8.1
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Sat, 05 Oct 2002 21:34:46 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv4840
Modified Files:
Tag: release22-maint
ntpath.py
Log Message:
Backport 1.45:
Allow abspath to still do something sensisble if the nt module can not be imported.
Index: ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v
retrieving revision 1.44
retrieving revision 1.44.8.1
diff -C2 -d -r1.44 -r1.44.8.1
*** ntpath.py 5 Nov 2001 21:25:02 -0000 1.44
--- ntpath.py 6 Oct 2002 04:34:44 -0000 1.44.8.1
***************
*** 458,463 ****
def abspath(path):
"""Return the absolute version of a path"""
! if path: # Empty path must return current working directory.
from nt import _getfullpathname
try:
path = _getfullpathname(path)
--- 458,473 ----
def abspath(path):
"""Return the absolute version of a path"""
! try:
from nt import _getfullpathname
+ except ImportError: # Not running on Windows - mock up something sensible.
+ global abspath
+ def _abspath(path):
+ if not isabs(path):
+ path = join(os.getcwd(), path)
+ return normpath(path)
+ abspath = _abspath
+ return _abspath(path)
+
+ if path: # Empty path must return current working directory.
try:
path = _getfullpathname(path)