[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 5750 - branches/cvs2svn-kfogel/tools/cvs2svn

From: Jeffrey C. Ollie <jeff_at_ollie.clive.ia.us>
Date: 2003-04-29 20:22:50 CEST

On Tue, 2003-04-29 at 08:54, Karl Fogel wrote:
> "Jeffrey C. Ollie" <jeff@ollie.clive.ia.us> writes:
> > Doh! Open mouth, insert foot. Still, there seem to be a lot of places
> > where paths are pulled apart/put together by hand. I think that it would
> > save some headaches later if either the posixpath.* routines (os.path ==
> > posixpath on Unix) or a small set of subroutines were developed to
> > handle all of the path mangling.
>
> Thanks for the tip, Jeff... I don't see `posixpath' documented in the
> Python library reference
>
> http://www.python.org/doc/current/lib/lib.html
>
> (There are `posix' and `posixfile', both of are clearly not to be used
> in a portable script.) Am I missing something?

posixpath is imported automatically when you import "os" on a Unix
system and is accessible via "os.path". There are similar modules for
Windows and MacOS systems. But yes, since posixpath is undocumented
it's hard to justify relying on it.

> I don't yet see any advantage to subroutines to do what split() and
> join() already do, but if our repository path manipulation starts
> getting more complex, then it might be worth it.

The main problem with using os.path.{join|split} is that their behavior
changes depending on platform. Directly using posixpath ensures that
'/' is used to separate directories and not ':' or '\'. But depending
on an undocumented module (even one as important as posixpath) probably
isn't the best either. Which is why I suggested using custom
subroutines (potentially cribbed from posixpath). With some
subroutines, you can make sure that you don't get doubled slashes, etc.

Jeff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 29 20:23:48 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.