[win32][BUG] url to filesystem???

Martin Pool mbp at canonical.com
Wed Jun 14 04:50:58 BST 2006


On 14/06/2006, at 1:32 PM, John Arbash Meinel wrote:

> The bug was explicitly in the win32 handling of paths. So there really
> isn't a way to catch that on non-win32.
>
> Otherwise we need to create a '_win32_split' function, so that we can
> test it. And a very similar '_posix_split'.
>
> Right now in urlutils we have a 'if sys.platform == 'win32' for split
> and strip_trailing_slash, and then local_path_to_url and
> local_path_from_url are already switched in from  
> _win32_local_path_to_url.
>
> I'm sort of okay with doing multiple functions for 'split()' since
> basename and dirname depend directly on it. I'm less okay with doing
> that for all the callers up the stack.
>
> How would you like to handle it?

Well, my overriding concern is to have *some* test that will catch  
this if it regresses.  The behaviour can be executed equally well on  
non-win32, although it's not relevant to local paths, so it would be  
a bit of a shame not to test it everywhere.

I had imagined just say having _win32_split and _posix_split, and  
then setting split to point to either of them depending on the platform.

Alternatively if you want a smaller change then how about this: add a  
module variable

   platform = sys.platform

then a test can set/reset that to examine win32-specific behaviour.

-- 
Martin







More information about the bazaar mailing list