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

Aaron Bentley aaron.bentley at utoronto.ca
Tue Jan 2 16:11:59 GMT 2007


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.

>>AFAIK, the only OSes that used something other than '/' are Windows, DOS
>>and MacOS 1-9.  So it's unlikely that your code will run on a platform
>>where '/' isn't supported as a separator.
>>
>>But still, I think using osutils makes the code clearly correct, whereas
>>os.path makes it suspect.
> 
> 
> osutils won't help me here because it does not have corresponding function
> to os.path.split.

It has basename and dirname, which together are equivalent to split.  So 
yes, it has functionality you can use.

Or better yet, you can add 'split' to osutils.

Aaron




More information about the bazaar mailing list