Update of /cvsroot/happydoc/HappyDoc/happydoclib
In directory usw-pr-cvs1:/tmp/cvs-serv30445/happydoclib
Modified Files:
path.py
Log Message:
Changed one more test to not use hard-coded path values to attempt for
platform-neutrality.
Changed removeRelativePrefix() to be more platform-neutral.
Index: path.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/path.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** path.py 2002/02/02 13:49:47 1.6
--- path.py 2002/02/03 18:48:47 1.7
***************
*** 72,75 ****
--- 72,82 ----
#
+ def isSomethingThatLooksLikeDirectory(path):
+ return (os.path.isdir(path)
+ or
+ os.path.islink(path)
+ or
+ os.path.ismount(path)
+ )
def rmkdir(path):
***************
*** 80,86 ****
if len(parts) > 1:
parent, child = parts
! if not (os.path.isdir(parent) or os.path.islink(parent)):
rmkdir(parent)
! if not (os.path.isdir(path) or os.path.islink(path)):
os.mkdir(path)
return
--- 87,93 ----
if len(parts) > 1:
parent, child = parts
! if not isSomethingThatLooksLikeDirectory(parent):
rmkdir(parent)
! if not isSomethingThatLooksLikeDirectory(path):
os.mkdir(path)
return
***************
*** 285,290 ****
Returns a new string, unless no changes are made.
"""
! if filename and filename[0] in '.':
! while filename and (filename[0] in './'):
filename = filename[1:]
return filename
--- 292,298 ----
Returns a new string, unless no changes are made.
"""
! chars_to_remove = os.curdir + os.sep
! if filename and filename[0] == os.curdir:
! while filename and (filename[0] in chars_to_remove):
filename = filename[1:]
return filename
***************
*** 485,489 ****
def testComputeRelativeHTMLLinkUpOneDirectory(self):
! expected = '../my.gif'
actual = computeRelativeHTMLLink('index.html',
os.path.join(os.pardir, 'my.gif'),
--- 493,497 ----
def testComputeRelativeHTMLLinkUpOneDirectory(self):
! expected = os.path.join(os.pardir, 'my.gif')
actual = computeRelativeHTMLLink('index.html',
os.path.join(os.pardir, 'my.gif'),
|