autoconf: how to get python_libdir correctly?

Gernot Hillier ghillie at suse.de
Wed Dec 4 07:16:49 EST 2002


Hi!

I need some autoconf help...

I used the following autoconf macros for my python embedding application:

...
python_version=`${PYTHON} -c "import sys; print sys.version[[:3]]"`
python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
python_configdir="${python_execprefix}/lib/python${python_version}/config"
python_moduledir="${python_prefix}/lib/python${python_version}/site-packages"
python_moduleexecdir="${python_execprefix}/lib/python${python_version}/site-packages"
python_includespec="-I${python_prefix}/include/python${python_version}"
python_linkforshared=`${PYTHON} -c "import distutils.sysconfig; print 
distutils.sysconfig.get_config_var('LINKFORSHARED')"`
...

But now I got a report that this causes problems on 64-bit architectures 
where the libs may live in ${python_prefix}/lib64/python. 

The suggested patch was:

-python_configdir="${python_execprefix}/lib/python${python_version}/config"
-python_moduledir="${python_prefix}/lib/python${python_version}/site-packages"
-python_moduleexecdir="${python_execprefix}/lib/python${python_version}/site-packages"
+python_libdir=`${PYTHON} -c "import sys; print sys.path[[1]]"`
+python_configdir="${python_libdir}/config"
+python_moduledir="${python_libdir}/site-packages"
+python_moduleexecdir="${python_libdir}/site-packages"

Can someone tell me if sys.path[1] is the correct/official way to get this 
information? 

Can I rely on sys.path[1] containing the system wide module directory?

Other ideas?

TIA!!

-- 
Bye,

Gernot



More information about the Python-list mailing list