Subject: bug#10227: Python installation fails for Python 3

From: Reuben Thomas <[email-masked]>
Date: Mon, 5 Dec 2011 23:53:41 +0100

The code currently used to get the python package directory is wrong
for Python 3:
>>> from distutils import sysconfig; print (sysconfig.get_python_lib(0,0,'/usr/local'))/usr/local/lib/python3/dist-packages
is wrong (should be /usr/local/lib/python3.2/dist-packages). Now, in
some sense this must be right (since the path is returned by
sysconfig), but the path produced
(/usr/local/lib/python3/dist-packages) is not searched by my Ubuntu
system's installed Python. If instead of automake I install the same
files with distutils (using a suitable setup.py), then the files are
installed in the right place (/usr/local/lib/python3.2/dist-packages).

One solution would be to use the sysconfig module (not
distutils.sysconfig), but that only works in Python 2.7 and 3.2 (not
3.0 or 3.1), so isn't really a starter. Hopefully someone who knows
more about Python than I can help, as it's much nicer to have Python
modules installed from one extra line in Makefile.am than have to add
a whole extra setup.py and require a different tool (albeit one
bundled with Python) to be used. (Actually, that is another idea: how
about delegating to distutils, since it comes with every version of
Python supported by automake?)
-- 
http://rrt.sc3d.org