Hi,
Apologies for the length of this post. I am using zc.buildout to
compile a specific python version with various extra libraries (e.g.
aspell, mysql). This is all working fine, and I have it creating an
interpreter with all the required libraries via the "interpreter" parameter.
However, I then want to compile/make/make install zope2 against this
specific python interpreter via ./configure --with-python=./bin/mypython
etc... I am using the zc.recipe.cmmi recipe to do this.
This fails (it works if I use the python executable as the --with-python
argument). I've tracked it down to a small difference between the
standard python interpreter and the one generated by the zc.recipe.egg
recipe:
- the standard python interpreter seems to add the directory of the
file you are running to the path
- the generated one does not add the directory to the path
This means that
./Python2.3/bin/python inst/configure.py runs fine
but ./bin/mypython inst/configure.py fails with an import error as it
cannot import anything relative to the file being run
I don't want to add it in as an "extra_path" because it is not needed
after this step and I don't want it to be part of the standard environment.
My question is:
- is this a desirable difference in behaviour between the two
interpreters? I expected them to work exactly the same...
- what's the cleanest way to get this working consistently/in an
automated way through the buildout?
At the moment, I have manually added the following into the generated
script to recreate the behaviour:
if _args:
+ import os
+ sys.argv[:] = _args
+ f = sys.argv[0]
+ p = os.path.split( os.path.abspath(f) )[:-1]
+ sys.path[0:0] = os.path.join( p )
execfile(f)
Thanks,
Miles
_______________________________________________
Distutils-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig