bzr using cwd in pythonpath?

John A Meinel john at arbash-meinel.com
Wed Nov 30 14:13:48 GMT 2005


Aaron Bentley wrote:
> Jamie Wilkinson wrote:
>>> This one time, at band camp, Andrew Bennetts wrote:
>>>
>>>> tokenize usually gets N_TOKENS from "from token import *", but in your case I'll
>>>> bet its finding token.py in your current directory.
>>>>
>>>> This is definitely something that should be fixed...
>>>
>>> So, bug in tokenize, or bug in bzr's sys.path?
> 
> If it's the same bug we found at UBZ, it's a bit more complicated.  It's
> a bug related to empty plugin paths.  I could have sworn John Meinel had
> fixed this one already, though.
> 
> Could you try 'BZR_PLUGIN_PATH="/" bzr merge ../feng.bzr'?
> 
> Aaron

This is a different bug. The one I fixed was if you did:

touch foo.xxx
bzr foo.xxx

It would try to execute foo.xxx in the local path, even though it wasn't
in your BZRPATH.

This bug is because one of the functions does "from foo import
something" and if foo.py happens to be in the local directory, it might
try to import it.
The issue is that "tokenize.py" and "token.py" are system libraries,
which someone has created a local file with the same name. And as of
right now, local always trumps global. (I remember reading a PEP where
they were going to introduce from . import foo to change how you import
locally, so you can always get back to the global object, I thought it
was on target for 2.4, but that didn't seem to happen).

Anyway, I doubt this is a bzr problem, the only thing bzr might be doing
is adding "." to the PYTHONPATH, but I don't believe it does it by default.

On a side note: is anyone using BZRPATH, or can we remove it? I know at
one point people wanted to have external commands that weren't plugins,
and if people are using them, we can leave them in.

But I would like to remove the dead code if possible.

At the very least, I propose we change it to BZR_COMMAND_PATH, or at
least BZR_PATH to be more consistent with other environment variables.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051130/04dccf57/attachment.pgp 


More information about the bazaar mailing list