[MERGE][1.0] disable python imports from cwd (problem with python2.4 @ win32: bug #53478)
Aaron Bentley
aaron.bentley at utoronto.ca
Sat Nov 24 15:30:59 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alexander Belchenko wrote:
> This patch fixes problem with python 2.4 that annoys me for years:
>
> if I have bzr installed for my Python (i.e. in site-packages) and
> I cd to bzr sources directory, then running system-wide bzr I constantly
> have problems because bzr try to import bzrlib from current directory
> first, not from site-packages.
>
> Proposed patch fixes all possible variants and works with 2.4 and 2.5.
> In my strong opinion we should not manipulate with sys.path in bzrlib itself,
> only in bzr script. Therefore I did only manual testing.
I would think that run_bzr_subprocess could be used to test this.
> +if os.getcwd() in sys.path[1:]: # skip first item
> + sys.path.pop(sys.path.index(os.getcwd(),1))
So if you run bzr in the directory where it's installed, I think this
could remove the only reference to the bzrlib directory, and prevent
bzrlib from loading. Similarly, it could remove references to other
paths needed for Bazaar to run.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHSEOz0F+nu1YWqI0RAtdMAJ4zBixAX2UVEDG1RWSfJF1c8WTpAgCfREBM
XcSXsHPiuVQHtWiuRKMzpc4=
=75Mn
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list