2.5 from source install problem with extensions

Anton Hartl anton.hartl at gmail.com
Wed Apr 18 13:39:36 EDT 2007


Hi,

On 2007-04-18, Florian Demmer <fdemmer at gmail.com> wrote:
> On Apr 18, 12:36 pm, Florian  Demmer <fdem... at gmail.com> wrote:
>> Hi!
>>
>> I am doing a from source installation of Python 2.5 on some old Debian
>> machine. As the target directoy I want /opt/somename so i added it to
>> the configure like so:
>>
>> ./configure --prefix=/opt/somedir
>>
>> The following make works fine as far as I can see. Then the make
>> install also actually works and installs python in /opt/somedir with
>> all its subdirectoris (bin, lib, man, include).
>> The extensions (*.so) however get put in /usr/local/lib/... and there
>> also in the wrong python directoy: 2.4

Basically I had the same problem(s).

>> (How) can I change the install_dir for the extensions?
>> Why does it use python2.4 anyway?! What env var or else is set here
>> that I cannot find?

I've patched setup.py as follows:

--- setup.py.orig       Thu Aug 10 01:42:18 2006
+++ setup.py    Mon Dec 25 19:05:29 2006
@@ -147,6 +147,14 @@
             if ext.name in sys.builtin_module_names:
                 self.extensions.remove(ext)
 
+           # so -lpython2.5 works in the build
+           ext.library_dirs.append('.')
+
+           # so shared libs requiring libpython2.5.so work
+           py_instdir = os.environ.get("INSTDIR_PYTHON", None)
+           if py_instdir:
+               ext.library_dirs.append(os.path.join(py_instdir, 'lib'))
+
         if platform != 'mac':
             # Parse Modules/Setup and Modules/Setup.local to figure out which
             # modules are turned on in the file.


Then you have to add INSTDIR_PYTHON to your shell environment, i.e.

INSTDIR_PYTHON=/opt/somedir ; export INSTDIR_PYTHON

or whatever your shell requires.

This works for me.  Hope it helps,

    Anton



More information about the Python-list mailing list