Where are we with simultaneous Python Framework installs

Rainer Müller raimue at macports.org
Fri May 9 00:30:56 PDT 2008


Blair Zajac wrote:
> I don't think we can just move the site-packages, can we?  There are .so's in there.

No, especially not because they are recorded in file_map.db to be 
installed at the old location. If you just move them, they are not known 
to MacPorts at all.

It would be possible to do it vice-versa and put a symlink into the 
framework pointing to /opt/local/lib/pythonX.Y/.
If I recall correctly this is the current behavior used by the python2.4 
port (which was chosen to avoid reinstalling all py-* ports?).
But somehow I don't want to make an exception for lib/ and treat it 
different than include/ and bin/. Better put everything into the 
framework and make symlinks at the usual places pointing to it.

> Shouldn't we require a recompile of all python 25 ports?  It's safer.  Just bump 
> all the revisions after we release 1.6.1.

No, just bumping revisions is not enough. Some paths like 
/opt/local/lib/pythonX.Y will change from a directory to a symlink to 
the framework. Our registry can't handle that. If the directory still 
exists and the pythonX.Y port tries to create a symlink there it fails 
with "File exists".

So, all pyX.Y-* ports have to be completely uninstalled before doing the 
transition. That's the main problem why we need these hooks described in 
the wiki (Way 1 and Way 2).

>> If we also need to update this at build time, the python port groups 
>> need an update to set and restore this link for building. Is there no 
>> other way to choose a version than changing the Current symlink? I am 
>> afraid of race conditions when we often change this symlink...
> 
> We just need this symlink for building though?  After build time doesn't 
> everything have the Current symlink resolved?

Yes, that should be the case.

> We would need a lock on simultaneous Python builds also.

At the moment I am thinking if we need the Current symlink at all. How 
would one use this Framework (see also my tests below)?

If we just add -I and -L with framework paths in the python port group 
we don't need to bother about the Current symlink at all. I think this 
is the best solution.

Are there any other options? I tried to link some program to the python 
framework in /opt/local using gcc, but it didn't work.

$ gcc -o foo foo.c -Z -syslibroot /opt/local -framework Python
ld: framework not found Python
collect2: ld returned 1 exit status

I think I had all necessary files in place:

$ ls -la /opt/local/Library/Frameworks/Python.framework/{,Versions}
/opt/local/Library/Frameworks/Python.framework/:
total 16
drwxr-xr-x  5 root  admin  170 May  9 09:23 .
drwxr-xr-x  4 root  admin  136 Jan 19 05:56 ..
lrwxr-xr-x  1 root  admin   20 May  9 09:22 Headers -> Versions/2.5/Headers
lrwxr-xr-x  1 root  admin   19 May  9 09:23 Python -> Versions/2.5/Python
lrwxr-xr-x  1 root  admin   22 May  9 09:23 Resources -> 
Versions/2.5/Resources
drwxr-xr-x  6 root  admin  204 May  9 09:23 Versions

/opt/local/Library/Frameworks/Python.framework/Versions:
total 8
drwxr-xr-x   6 root  admin  204 May  9 09:23 .
drwxr-xr-x   5 root  admin  170 May  9 09:23 ..
drwxr-xr-x   8 root  admin  272 Apr 24 04:09 2.5
lrwxr-xr-x   1 root  admin    3 May  9 09:23 Current -> 2.5

So if someone knows how to link against a framework in a custom path, 
please advice.

Rainer


More information about the macports-dev mailing list