[Distutils] New code snapshot

Greg Ward gward@python.net
Wed, 2 Aug 2000 21:30:16 -0400


On 01 August 2000, Corran Webster said:
> Unfortunately, it seems like sometimes the trailing ":" is required.  To
> explain why, I need to explain a little bit more about mac pathnames.  On
> the mac, a path starting with a colon is relative, while one which doesn't
> start with a colon is absolute (ie. the reverse of the posix convention),
> _unless_ it's just a single name (ie. no colons whatsoever) in which case
> it's relative.  The end result of this is that "Macintosh HD" refers to a
> file in the local directory called "Macintosh HD" (as does ":Macintosh
> HD"), while "Macintosh HD:" refers to the root directory of the hard disk
> "Macintosh HD".
> 
> However, "Macintosh HD:Applications:" and "Macintosh HD:Applications" are
> the same thing as each other. Similarly ":Macintosh HD:Applications:" and
> ":Macintosh HD:Applications" are the same as each other.

Ooh, tricky!  Now I can see why Mac OS doesn't have a command-line
interface: if users can't understand the difference between "/foo" and
"foo", how on earth will they understand that "foo" == ":foo" != "foo:",
while "foo:bar" == ":foo:bar" (but "foo:bar" == "foo:bar:" and
":foo:bar" == ":foo:bar:").  Aieee!  Doesn't quite rival VMS for
complexity, but it's getting there.

> There's a similar problem with ":", "::", etc.  Removing a trailing ":" in
> these cases directly affects the meaning.
[...]
> Having looked at this, I can see why Mac normpath can't just strip trailing
> colons.  However, the cases where we have to leave a trailing colon are
> fairly easily identified (ie. paths which have just one ":" and it's at the
> end should have the trailing colon left intact, as should paths which are
> entirely colons...)

Agreed.  Sounds fairly straightforward to implement Mac OS' rules.  I've
glanced at the patch you mailed me privately and will comment in more
detail when I respond to that.

> OK.  Hopefully a suitable replacement for normpath will do the trick - just
> grep for "import os" and patch it in...

Changed my mind on that: any Distutils code that uses normpath should
use the Distutils version, which will be identical to os.path.normpath
except for OS/Python combinations where normpath is broken
(specifically, Python 1.5 on Mac OS).  Details when I respond to your
patch.

> Even with this improvement, we're not out of the woods.  This fixes problem
> 2, but we'll still need to worry about substituting correctly in the cases
> where we have a trailing ":".  At least these shouldn't be too hard to
> detect - I think it's just install.py that needs to take this into account,
> since os.path.join() is used everywhere else, right?

Ugh.  Head hurts.  Have to think about this more once normpath is
working.

        Greg
-- 
Greg Ward - Linux nerd                                  gward@python.net
http://starship.python.net/~gward/
... I think I'd better go back to my DESK and toy with a few common
MISAPPREHENSIONS ...