Fredrik Lundh wrote:
Steve Holden wrote:


Is there a way to make a relocateable python binary... that is... a
python installation that won't care where it is on the machine... and
won't care if it gets put somewhere else besides /  ?


the standard CPython interpreter is 100% "relocatable".  If you think
it isn't, you have to be a bit more specific.


Is it possible that you are using "relocatable" in the standard sense of "code can be located anywhere in physical memory", where the OP is using the same term to mean "can live anywhere in the filestore"?


nope.


I suspect the problem the OP is seeing is because the --prefix configuration parameter will cause an interpreter to look in a specific place for standard libraries. Clearly if you "relocate" the libraries to another directory entirely then an interpreter without any further nouse (and no symbolic links to help it) is going to crap out badly.


clearly?

[EMAIL PROTECTED] build] mv python2.3 /tmp
[EMAIL PROTECTED] build] mkdir /tmp/lib
[EMAIL PROTECTED] build] mv lib /tmp/lib/python2.3
[EMAIL PROTECTED] build] cd /tmp
[EMAIL PROTECTED] tmp]$ ./python2.3

import sys
sys.prefix

'/tmp'

sys.path

['', '/tmp/lib/python23.zip', '/tmp/lib/python2.3', ...]

[EMAIL PROTECTED] tmp]$ mkdir spam
[EMAIL PROTECTED] tmp]$ mv python2.3 spam
[EMAIL PROTECTED] tmp]$ mv lib spam
[EMAIL PROTECTED] tmp]$ cd spam/
[EMAIL PROTECTED] spam]$ ./python2.3

import sys
sys.prefix

'/tmp/spam'

sys.path

['', '/tmp/spam/lib/python23.zip', '/tmp/spam/lib/python2.3', ...]


[EMAIL PROTECTED] spam]$ mkdir bin [EMAIL PROTECTED] spam]$ mv python2.3 bin [EMAIL PROTECTED] spam]$ bin/python2.3

import sys
sys.prefix

'/tmp/spam'


[EMAIL PROTECTED] spam]$ cd bin [EMAIL PROTECTED] bin]$ ./python2.3

import sys
sys.prefix

'/tmp/spam'

[EMAIL PROTECTED] fredrik]$ export PATH=/tmp/spam/bin:$PATH
[EMAIL PROTECTED] bin]$ cd
[EMAIL PROTECTED] fredrik]$ python2.3

import sys
sys.prefix

'/tmp/spam'


and so on...

Well, OK, maybe it's not quite as clear as I thought :-)

regards
 Steve
--
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to