Relocatable binary installs....

F

friedmud

Hello all,

I'm currently working on a software package that is going to be
distributed in binary form (with accompanying source) for lot of
different unixes (Linux, AIX, HP-UX and others). Parts of the package
are written in Python... so we are going to want to distribute our own
version of python.

Right now we are just distributing the Python tarball and building it
at install time. This works ok, but we are running into some problems
on some machines with weird default installs (DEC Alphas in
particular).... some of them won't build all the python modules we want
(although our in house machines will).

What I want to do is compile python statically into binaries and then
plop them wherever our customers choose to do an install (we will
provide the source tarballs on a cd as well). The problem we are
running into is that when we do this python continues to think it's
still installed where it was initially compiled and not where it has
been placed (which causes some problems with traceback and some other
functions).

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 / ?

Sorry for the long winded post... just want to make sure you understand
my problem.

Thanks in advance for any help!

Derek
 
F

Fredrik Lundh

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.

</F>
 
S

Steve Holden

Fredrik said:
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"?

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.

But I could be wrong.

always-prepared-to-at-least-admit-the-possibility-ly y'rs - steve
 
S

Steve Holden

Fredrik said:
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"?

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.

But I could be wrong.

always-prepared-to-at-least-admit-the-possibility-ly y'rs - steve
 
F

Fredrik Lundh

Steve said:
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@brain build] mv python2.3 /tmp
[fredrik@brain build] mkdir /tmp/lib
[fredrik@brain build] mv lib /tmp/lib/python2.3
[fredrik@brain build] cd /tmp
[fredrik@brain tmp]$ ./python2.3
import sys
sys.prefix '/tmp'
sys.path ['', '/tmp/lib/python23.zip', '/tmp/lib/python2.3', ...]
[fredrik@brain tmp]$ mkdir spam
[fredrik@brain tmp]$ mv python2.3 spam
[fredrik@brain tmp]$ mv lib spam
[fredrik@brain tmp]$ cd spam/
[fredrik@brain spam]$ ./python2.3
import sys
sys.prefix '/tmp/spam'
sys.path ['', '/tmp/spam/lib/python23.zip', '/tmp/spam/lib/python2.3', ...]

[fredrik@brain spam]$ mkdir bin
[fredrik@brain spam]$ mv python2.3 bin
[fredrik@brain spam]$ bin/python2.3
[fredrik@brain spam]$ cd bin
[fredrik@brain bin]$ ./python2.3'/tmp/spam'

[fredrik@brain fredrik]$ export PATH=/tmp/spam/bin:$PATH
[fredrik@brain bin]$ cd
[fredrik@brain fredrik]$ python2.3
and so on...

</F>
 
S

Steve Holden

Fredrik said:
Steve Holden wrote:

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@brain build] mv python2.3 /tmp
[fredrik@brain build] mkdir /tmp/lib
[fredrik@brain build] mv lib /tmp/lib/python2.3
[fredrik@brain build] cd /tmp
[fredrik@brain tmp]$ ./python2.3

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

[fredrik@brain tmp]$ mkdir spam
[fredrik@brain tmp]$ mv python2.3 spam
[fredrik@brain tmp]$ mv lib spam
[fredrik@brain tmp]$ cd spam/
[fredrik@brain spam]$ ./python2.3
'/tmp/spam'

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


[fredrik@brain spam]$ mkdir bin
[fredrik@brain spam]$ mv python2.3 bin
[fredrik@brain spam]$ bin/python2.3

'/tmp/spam'


[fredrik@brain spam]$ cd bin
[fredrik@brain bin]$ ./python2.3

'/tmp/spam'

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

'/tmp/spam'


and so on...
Well, OK, maybe it's not quite as clear as I thought :)

regards
Steve
 
S

Steve Holden

Fredrik said:
Steve Holden wrote:

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@brain build] mv python2.3 /tmp
[fredrik@brain build] mkdir /tmp/lib
[fredrik@brain build] mv lib /tmp/lib/python2.3
[fredrik@brain build] cd /tmp
[fredrik@brain tmp]$ ./python2.3

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

[fredrik@brain tmp]$ mkdir spam
[fredrik@brain tmp]$ mv python2.3 spam
[fredrik@brain tmp]$ mv lib spam
[fredrik@brain tmp]$ cd spam/
[fredrik@brain spam]$ ./python2.3
'/tmp/spam'

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


[fredrik@brain spam]$ mkdir bin
[fredrik@brain spam]$ mv python2.3 bin
[fredrik@brain spam]$ bin/python2.3

'/tmp/spam'


[fredrik@brain spam]$ cd bin
[fredrik@brain bin]$ ./python2.3

'/tmp/spam'

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

'/tmp/spam'


and so on...
Well, OK, maybe it's not quite as clear as I thought :)

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,293
Latest member
Hue Tran

Latest Threads

Top