bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10227: Python installation fails for Python 3


From: Roumen Petrov
Subject: bug#10227: Python installation fails for Python 3
Date: Fri, 23 Nov 2012 00:35:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121030 Firefox/16.0 SeaMonkey/2.13.2

Stefano Lattarini wrote:
tags 10227 - moreinfo
thanks

On 11/21/2012 06:58 PM, Reuben Thomas wrote:
On 21 November 2012 13:41, Stefano Lattarini <address@hidden>wrote:

tags 10227 + moreinfo
thanks

Hi Roumen, Reuben.

I'm going through old open bugs, and I've noticed this one.  Is the
problem still present, after the recent updates to the python support?
[SNIP]
on my Ubuntu 12.10 system). I'm sorry, I can't tell whether, as Roumen
suggests, this is an Ubuntu packaging bug, or an automake bug.
It seems to me this is a feature as I found this one:

http://patch-tracker.debian.org/patch/series/view/python2.6/2.6.6-8/distutils-install-layout.diff

OK, thanks for explaining it once again.  I can now reproduce the same
issue on Debian.  I think this is something we should try to work around,
since we cannot have our installation rules broken by default on both
Debian and Ubuntu ...
Lets say platforms that use the "/posix_local/" installation scheme instead wrong or broken.

It seems to me that this is the sort of thing the pyconfigure people
ought to know about.

By peeking at their repository, I came up with the minimal patch below,
which should do the trick.  Can you verify it works for you as well?

Regards,
   Stefano

---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

 From 30463e31e481537462713cb680279aded6a9d449 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Thu, 22 Nov 2012 12:03:07 +0100
Subject: [PATCH] python: make installed modules find by default on Debian and 
Ubuntu

This change fixes automake bug#10227.

The code used to get the python package directory was wrong for Python 3,
at least on Debian and Ubuntu distributions.  In the case the installation
was using the default prefix "/usr/local", python modules were incorrectly
installed in the directory

     /usr/local/lib/python3/dist-packages

(which is *not* searched by default), rather than in a directory like

     /usr/local/lib/python3.x/dist-packages

which is searched by default.

* m4/python.m4 (AM_PATH_PYTHON): Try to use the 'sysconfig' module if
possible, for better interactions with python 3.x.



Signed-off-by: Stefano Lattarini <address@hidden>
---
  [SNIP]

@@ -122,7 +141,14 @@ AC_DEFUN([AM_PATH_PYTHON],
       else
         am_py_prefix=$prefix
       fi
-     am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; 
sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null`
+     am_cv_python_pythondir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`

Tested with python build from master branch on 2012-11-13 - both paths (sysconfig and distutils.sysconfig based) return same results.

       case $am_cv_python_pythondir in
       $am_py_prefix*)
         am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
@@ -157,7 +183,14 @@ AC_DEFUN([AM_PATH_PYTHON],
       else
         am_py_exec_prefix=$exec_prefix
       fi
-     am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; 
sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 
2>/dev/null`
+     am_cv_python_pyexecdir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('platlib', vars={'base':'$am_py_prefix'})

Stefano, please use platbase as variable - see Lib/sysconfig.py :
....
INSTALL_SCHEMES = {
    'posix_prefix': {
...
        'purelib': '{base}/lib/python{py_version_short}/site-packages',
        'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
...

+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
       case $am_cv_python_pyexecdir in
       $am_py_exec_prefix*)
         am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`

Also I think that python experts should confirm if patch is correct.

Roumen






reply via email to

[Prev in Thread] Current Thread [Next in Thread]