What I've seen in the past, is that if you insert debug statements into
*site.py* it gets a '' in sys.path, and then it calls a function to turn
all paths in 'sys.path' into absolute paths (and thus '' => $PWD).
Obviously you are getting $PWD into your path somehow, the question is
figuring out how.
For bzrlib, one possibility could be to do:
cwd = os.getcwd()
bzr_path = os.path.dirname(sys.argv[0])
if bzr_path != cwd:
while cwd in sys.path:
sys.path.remove(cwd)
Alternatively, if we do it in the 'bzr' main script, we can change the
line to:
bzr_path = os.path.dirname(__file__)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
...
> 09:54 forest@W038$ python /tmp/foo/test.py forest/ usr/lib/ python2. 5/site- packages/ setuptools- 0.6c9-py2. 5.egg', '/home/ forest/ usr/lib/ python2. 5/site- packages/ Satchmo- 0.9_pre- py2.5.egg' , '/home/ forest/ lib/python' , '/home/ forest/ usr/lib/ python2. 6/site- packages' , '/home/ forest/ usr/lib/ python2. 5/site- packages' , '/home/ forest/ usr/lib/ python2. 4/site- packages' , '/home/ forest/ usr/lib/ python2. 3/site- packages' , python2. 6', '/usr/lib/ python2. 6/plat- linux2' , '/usr/lib/ python2. 6/lib-tk' , '/usr/lib/ python2. 6/lib-old' , '/usr/lib/ python2. 6/lib-dynload' , '/usr/lib/ python2. 6/dist- packages' , '/usr/lib/ python2. 6/dist- packages/ PIL', '/usr/lib/ python2. 6/dist- packages/ gst-0.10' , '/var/lib/ python- support/ python2. 6', '/usr/lib/ python2. 6/dist- packages/ gtk-2.0' , '/var/lib/ python- support/ python2. 6/gtk-2. 0', '/usr/lib/ python2. 6/dist- packages/ wx-2.8- gtk2-unicode' , '/usr/local/ lib/python2. 6/dist- packages' , '/home/ forest/ usr/lib/ python2. 4/site- packages' , '/home/ forest/ usr/lib/ python2. 3/site- packages' ]
> ['/tmp/foo', '/home/
> '/tmp/bar', '/usr/lib/
> [/tmp/bar]
^- So indeed, /tmp/bar is in your path.
What I've seen in the past, is that if you insert debug statements into
*site.py* it gets a '' in sys.path, and then it calls a function to turn
all paths in 'sys.path' into absolute paths (and thus '' => $PWD).
Obviously you are getting $PWD into your path somehow, the question is
figuring out how.
For bzrlib, one possibility could be to do:
cwd = os.getcwd() dirname( sys.argv[ 0]) path.remove( cwd)
bzr_path = os.path.
if bzr_path != cwd:
while cwd in sys.path:
sys.
Alternatively, if we do it in the 'bzr' main script, we can change the
line to:
bzr_path = os.path. dirname( __file_ _)
John
=:->
-----BEGIN PGP SIGNATURE----- enigmail. mozdev. org
fN38ACgkQJdeBCY SNAANh7QCgtPkEG dc4GykL51ahAQa4 LADT gRdJnDeCOrYiAO3 Ol
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkp
VMUAn3PAW7mNRid
=pIQS
-----END PGP SIGNATURE-----