[MERGE][1.0] disable python imports from cwd (problem with python2.4 @ win32: bug #53478)
John Arbash Meinel
john at arbash-meinel.com
Mon Nov 26 20:02:53 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alexander Belchenko wrote:
> Aaron Bentley ?8H5B:
>> Alexander Belchenko wrote:
>>> Alexander Belchenko has voted abstain.
>>> Status is now: Waiting
>>> Comment:
>>> actually this patch incorrect if we invoke bzr from directory where
>>> bzrlib installed, e.g. Lib\site-packages.
>> By abstaining, rather than rejecting, you're still inviting other people
>> to vote on this. Is that your intent?
>
> I'd like to hear comments from John and Robert.
I haven't followed this thread very closely (on vacation this last week).
I seem to remember sys.path getting '' put into it, but then some other code in
site.py changing it to expand it to os.getcwd().
In fact, looking at the bug:
https://bugs.launchpad.net/bzr/+bug/53478
I find this patch was the fix:
http://launchpadlibrarian.net/3498888/site-py-update.diff
+ if dir == '':
+ # On some platforms there is an extra empty string in the list
+ # of paths, which causes the current working directory to always
+ # be added to the search path. Prevent this.
+ # it will be added later if it is required by the code that adds
+ # dirname(sys.argv[0])
+ continue
I believe I tracked down how we were getting '' in the original sys.path, but I
can't remember it now.
Anyway, if the raw string '' is in sys.path, it makes sense to me to filter it
out in the 'bzr' front-end script.
I'm not as convinced about removing os.getcwd().
So in summary:
if '' in sys.path:
sys.path.remove('')
is good. And I would start with that, and see if it gets you to what you need,
without checking getcwd().
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHSyZtJdeBCYSNAAMRAmb4AKDSh+ri/vatB1sfD59zA9kgMK/9GACghAVa
wSQMAArEe2LGM6pSYc+d86s=
=eWaB
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list