retitle 664939 egenix-mx-base: FTBFS with Python 2.7.3: ImportError: cannot 
import name customize_compiler
tags 664939 patch
user ubuntu-de...@lists.ubuntu.com
usertags 664939 ubuntu-patch precise
thanks

On Wed, Mar 21, 2012 at 09:38:24PM +0100, Lucas Nussbaum wrote:
> During a rebuild of all packages in sid, your package failed to build on
> amd64.
> 
> Relevant part:
> > gcc -pthread _configtest.o -L/usr/local/lib -o _configtest
> > _configtest.o: In function `main':
> > /«PKGBUILDDIR»/_configtest.c:5: undefined reference to `clock_gettime'
> > collect2: ld returned 1 exit status

This misidentifies the failure (automatically, I guess).  The true
relevant part is:

  python2.7 setup.py build
  Traceback (most recent call last):
    File "setup.py", line 9, in <module>
      import egenix_mx_base
    File "/«PKGBUILDDIR»/egenix_mx_base.py", line 11, in <module>
      from mxSetup import mx_Extension, mx_version
    File "/«PKGBUILDDIR»/mxSetup.py", line 318, in <module>
      from distutils.ccompiler import customize_compiler
  ImportError: cannot import name customize_compiler
  make: *** [build-ext-python2.7-stamp] Error 1

This is because Python flip-flopped for a while on where
customize_compiler should come from, but as far as I've been able to
tell from analysing its revision history it's been available from
distutils.sysconfig all along and that's the current canonical location.
Here's a patch.

  * mxSetup.py: Go back to importing customize_compiler from
    distutils.sysconfig.  This is needed with Python 2.7.3, and should still
    work with earlier 2.7 versions.

diff -Nru 
egenix-mx-base-3.2.1/debian/patches/distutils_customize_compiler.patch 
egenix-mx-base-3.2.1/debian/patches/distutils_customize_compiler.patch
--- egenix-mx-base-3.2.1/debian/patches/distutils_customize_compiler.patch      
1970-01-01 01:00:00.000000000 +0100
+++ egenix-mx-base-3.2.1/debian/patches/distutils_customize_compiler.patch      
2012-04-02 23:24:34.000000000 +0100
@@ -0,0 +1,37 @@
+Description: Go back to importing customize_compiler from distutils.sysconfig
+ This is needed with Python 2.7.3, and should still work with earlier 2.7
+ versions.
+Author: Colin Watson <cjwat...@ubuntu.com>
+Bug-Debian: http://bugs.debian.org/664939
+Forwarded: no
+Last-Update: 2012-04-02
+
+Index: b/mxSetup.py
+===================================================================
+--- a/mxSetup.py
++++ b/mxSetup.py
+@@ -297,11 +297,12 @@
+ from distutils.command.sdist import sdist
+ from distutils.command.clean import clean
+ import distutils.archive_util
++from distutils.sysconfig import customize_compiler
+ 
+ if (python_version < '2.7' or
+     (python_version > '3.0' and python_version < '3.2')):
+     from distutils.sysconfig import \
+-         get_config_h_filename, parse_config_h, customize_compiler, \
++         get_config_h_filename, parse_config_h, \
+          get_config_vars, get_python_version
+     from distutils.util import get_platform
+ 
+@@ -313,10 +314,6 @@
+          get_config_h_filename, parse_config_h, get_path, \
+          get_config_vars, get_python_version, get_platform
+ 
+-    # This API was moved from distutils.sysconfig to distutils.ccompiler
+-    # in Python 2.7
+-    from distutils.ccompiler import customize_compiler
+-
+ def get_python_include_dir():
+ 
+     """ Return the path to the Python include dir.
diff -Nru egenix-mx-base-3.2.1/debian/patches/series 
egenix-mx-base-3.2.1/debian/patches/series
--- egenix-mx-base-3.2.1/debian/patches/series  1970-01-01 01:00:00.000000000 
+0100
+++ egenix-mx-base-3.2.1/debian/patches/series  2012-04-02 22:38:43.000000000 
+0100
@@ -0,0 +1 @@
+distutils_customize_compiler.patch

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to