Relocatable binary installs....

Steve Holden steve at holdenweb.com
Mon Jan 31 14:20:10 EST 2005


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?
> 
> [fredrik at brain build] mv python2.3 /tmp
> [fredrik at brain build] mkdir /tmp/lib
> [fredrik at brain build] mv lib /tmp/lib/python2.3
> [fredrik at brain build] cd /tmp
> [fredrik at brain tmp]$ ./python2.3
> 
>>>>import sys
>>>>sys.prefix
> 
> '/tmp'
> 
>>>>sys.path
> 
> ['', '/tmp/lib/python23.zip', '/tmp/lib/python2.3', ...]
> 
> [fredrik at brain tmp]$ mkdir spam
> [fredrik at brain tmp]$ mv python2.3 spam
> [fredrik at brain tmp]$ mv lib spam
> [fredrik at brain tmp]$ cd spam/
> [fredrik at brain spam]$ ./python2.3
> 
>>>>import sys
>>>>sys.prefix
> 
> '/tmp/spam'
> 
>>>>sys.path
> 
> ['', '/tmp/spam/lib/python23.zip', '/tmp/spam/lib/python2.3', ...]
> 
> 
> [fredrik at brain spam]$ mkdir bin
> [fredrik at brain spam]$ mv python2.3 bin
> [fredrik at brain spam]$ bin/python2.3
> 
>>>>import sys
>>>>sys.prefix
> 
> '/tmp/spam'
> 
> 
> [fredrik at brain spam]$ cd bin
> [fredrik at brain bin]$ ./python2.3
> 
>>>>import sys
>>>>sys.prefix
> 
> '/tmp/spam'
> 
> [fredrik at brain fredrik]$ export PATH=/tmp/spam/bin:$PATH
> [fredrik at brain bin]$ cd
> [fredrik at brain 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




More information about the Python-list mailing list