[MERGE] Bugfix #68124: Allow import plugins from zip archives

John Arbash Meinel john at arbash-meinel.com
Tue Jan 2 18:56:24 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Belchenko wrote:
> Aaron Bentley ?8H5B:
>>> Alexander Belchenko wrote:
>>>>> Certainly, it behaves differently on Windows vs Unix:
>>>>>
>>>>>>>> a = 'a\\b\\c'
>>>>>>>> os.path.split(a)
>>>>> ('', 'a\\b\\c')
>>>>
>>>> This example unrelated to my code, because inside zip archives always
>>>> used
>>>> '/' as path separator.
>>> It is not unrelated to your code, because it shows that os.path.split is
>>> sensitive to platform differences.
>>>
>>> It is possible that your code would fail on Mac OS classic, because it
>>> used ':' as a separator, and '/' may have been valid as a filename
>>> character.
> 
> I wonder how zip works on MacOS classic in the case when '/'
> is valid filename character?

Well, I would assume they translate '/' => ':' since that is their
equivalent values.

I know on Mac OS X, there is a weird translation going on, where if you
put ':' or '/' into a filename it can actually accept them, and
depending on how it is accessed, it will show up as one or the other.

For example, you can open up Finder, and create a file named 'test/bar',
and then if you use a shell and do 'ls' it shows up as 'test:bar'.

Regardless, we don't really support OS X classic.

But I think the best solution is to just add 'split()' to osutils, I
think it was just an oversight that we forgot to do so.

...

> I think better way doing this is adding to osutils:
> 
> import ntpath
> split = ntpath.split
> 
> But after your comment about MacOS, I feel it's not enough.
> 
> Alexander

If we find any specific problems, then we can write a wrapper for the
MacOS version of 'split'. We already do it for normpath (on win32 and
mac), so it isn't hard to do it for another function (it is what osutils
is *for*).

To start with, though, I would probably prefer to just use
split = os.path.split

Unless there is a specific reason why we need ntpath behavior.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFmqrYJdeBCYSNAAMRAgFHAKChnxoWivmfvn67JlaWd8Pu9wqN1wCfTLD0
8PwPh0whKVEydJYKraBzK30=
=U7so
-----END PGP SIGNATURE-----




More information about the bazaar mailing list