position independent build of python

E

erikj

Hi,

If my understanding is correct, the sys.prefix variable holds the root
directory python uses to find related files, and eg its site-packages.

the value of sys.prefix is specified at compile time.

it seems that on windows, when I build/install python at one location,
and
later move it to another location, python will find all its needs
relative to the new location.

however, when I do the same on linux, python keeps looking for
its dependencies in the build location.

is there a possibility to have it always look at a position relative
to the location of the executable ? the goal is to be able to build
python on one machine, and then simply copy the build tree to
other machines at other locations.

Thank you and regards,

Erik
 
D

Diez B. Roggisch

erikj said:
If my understanding is correct, the sys.prefix variable holds the root
directory python uses to find related files, and eg its site-packages.

the value of sys.prefix is specified at compile time.

it seems that on windows, when I build/install python at one location,
and
later move it to another location, python will find all its needs
relative to the new location.

however, when I do the same on linux, python keeps looking for
its dependencies in the build location.

is there a possibility to have it always look at a position relative
to the location of the executable ? the goal is to be able to build
python on one machine, and then simply copy the build tree to
other machines at other locations.

Maybe looking at virtualenv, especially with the --no-site-packages
variable set gives you a hint. AFAIK there are some hard-coded paths
involved, but not inside compiled code. Maybe you can remedy that somehow.

Diez
 
E

erikj

That's indeed a good idea, I will investigate it. But if this
works, I still need some kind of wrapper around python itself...
 

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

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top