Control: -1 + patch

On Mon, 13 Aug 2012 21:18:57 +0200, Salvatore Bonaccorso wrote:

> If I apply to the package the change we discussed[1] now the packages
> linaro-image-tools and nautilus-image-manipulator FTBFS in unstable
> with:
> 
> ----cut---------cut---------cut---------cut---------cut---------cut-----
> dpkg-buildpackage: source package linaro-image-tools
> dpkg-buildpackage: source version 2012.06-1
> dpkg-buildpackage: source changed by Fathi Boudra <f...@debian.org>
> dpkg-buildpackage: host architecture amd64
>  dpkg-source --before-build linaro-image-tools-2012.06
>  debian/rules clean
> dh clean --with python2
>    dh_testdir
>    dh_auto_clean
> running clean
> 'build/lib.linux-x86_64-2.6' does not exist -- can't clean it
> 'build/bdist.linux-x86_64' does not exist -- can't clean it
> 'build/scripts-2.6' does not exist -- can't clean it
> WARNING: the following files are not recognized by DistUtilsExtra.auto:
> Traceback (most recent call last):
>   File "setup.py", line 21, in <module>
>     "linaro-hwpack-replace"],
>   File "/usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py", line 109, 
> in setup
>     f_loc = f.decode('ascii', errors='ignore')
> TypeError: decode() takes no keyword arguments
> dh_auto_clean: python2.6 setup.py clean -a returned exit code 1
> make: *** [clean] Error 1
> dpkg-buildpackage: error: debian/rules clean gave error exit status 2
> ----cut---------cut---------cut---------cut---------cut---------cut-----

*sigh*

Ok, keyword arguments for String.decode() where also introduced in
2.7 according to
http://docs.python.org/library/stdtypes.html#string-methods

But it seems to work to just leave out the keyword:

% ipython2.6

In [1]: str="bla"

In [2]: str.decode('ascii', errors='ignore')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-fc67a01f7fc4> in <module>()
----> 1 str.decode('ascii', errors='ignore')

TypeError: decode() takes no keyword arguments

In [3]: str.decode('ascii', 'ignore')
Out[3]: u'bla'

% ipython2.7

In [1]: str="bla"

In [2]: str.decode('ascii', errors='ignore')
Out[2]: u'bla'

In [3]: str.decode('ascii', 'ignore')
Out[3]: u'bla'


Gnarf, this package doesn't build with my locale. - Ok, fixored.


Ok, with your patch a bit extended, both linaro-image-tools and
nautilus-image-manipulator finally build! \o/

Debdiff attached.



Cheers,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Vic Chesnutt: untitled
diff -Nru python-distutils-extra-2.35/debian/changelog python-distutils-extra-2.35/debian/changelog
--- python-distutils-extra-2.35/debian/changelog	2012-08-03 13:56:31.000000000 +0200
+++ python-distutils-extra-2.35/debian/changelog	2012-08-14 19:09:27.000000000 +0200
@@ -1,3 +1,16 @@
+python-distutils-extra (2.35-1.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Fix "linaro-image-tools: FTBFS: AttributeError: 'tuple' object has
+    no attribute 'major'": add patch
+    backwards-compatibility-for-python2.6.patch; coproduction of Salvatore
+    Bonaccorso and yours truly.
+    (Closes: #682631)
+  * debian/rules: set LC_ALL and LANG to C, too, otherwise the package FTBFS
+    if LC_CTYPE is set in the environment.
+
+ -- gregor herrmann <gre...@debian.org>  Tue, 14 Aug 2012 19:01:43 +0200
+
 python-distutils-extra (2.35-1) unstable; urgency=low
 
   * auto.py: Fix printing of unrecognized non-ASCII file names under ASCII
diff -Nru python-distutils-extra-2.35/debian/patches/backwards-compatibility-for-python2.6.patch python-distutils-extra-2.35/debian/patches/backwards-compatibility-for-python2.6.patch
--- python-distutils-extra-2.35/debian/patches/backwards-compatibility-for-python2.6.patch	1970-01-01 01:00:00.000000000 +0100
+++ python-distutils-extra-2.35/debian/patches/backwards-compatibility-for-python2.6.patch	2012-08-14 18:56:10.000000000 +0200
@@ -0,0 +1,31 @@
+Description: Use sys.version_info[0] and drop keyword from decode()
+ - Use sys.version_info[0] instead of sys.version_info.major for backwards
+   compatibility to python2.6.
+ - Drop keyword use from String.decode() call in <3 code path; added in 2.7
+Author: Salvatore Bonaccorso <car...@debian.org>
+ gregor herrmann <gre...@debian.org>
+Bug-Debian: http://bugs.debian.org/682631
+
+--- a/DistUtilsExtra/auto.py
++++ b/DistUtilsExtra/auto.py
+@@ -104,9 +104,9 @@
+         enc = locale.getpreferredencoding()
+         for f in sorted(src):
+             # ensure that we can always print the file name
+-            if(sys.version_info.major < 3):
++            if(sys.version_info[0] < 3):
+                 # hack to make this work with Python 2
+-                f_loc = f.decode('ascii', errors='ignore')
++                f_loc = f.decode('ascii', 'ignore')
+             else:
+                 f_loc = f.encode(enc, errors='replace').decode(enc, errors='replace')
+             print ('  ' + f_loc)
+@@ -387,7 +387,7 @@
+         with open(file, 'rb') as f:
+             # send binary blob for python2, otherwise sending an unicode object with
+             # "encoding" directive makes ast triggering an exception in python2
+-            if(sys.version_info.major < 3):
++            if(sys.version_info[0] < 3):
+                 file_content = f.read()
+             else:
+                 file_content = f.read().decode('UTF-8')
diff -Nru python-distutils-extra-2.35/debian/patches/series python-distutils-extra-2.35/debian/patches/series
--- python-distutils-extra-2.35/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ python-distutils-extra-2.35/debian/patches/series	2012-08-14 18:54:02.000000000 +0200
@@ -0,0 +1 @@
+backwards-compatibility-for-python2.6.patch
diff -Nru python-distutils-extra-2.35/debian/rules python-distutils-extra-2.35/debian/rules
--- python-distutils-extra-2.35/debian/rules	2012-08-03 13:56:31.000000000 +0200
+++ python-distutils-extra-2.35/debian/rules	2012-08-14 19:01:38.000000000 +0200
@@ -22,7 +22,7 @@
 	#sed -i 's,^#!/usr/bin/python,#!/usr/bin/python3,' debian/python3-distutils-extra/usr/bin/python3-mkdebian
 
 	# run tests with python3
-	cd test; LC_ALL= LANGUAGE= LANG=C PYTHONPATH=`pwd`/../debian/python3-distutils-extra/usr/lib/python3/dist-packages/ python3 ./auto.py -v
+	cd test; LC_ALL=C LANGUAGE=C LANG=C PYTHONPATH=`pwd`/../debian/python3-distutils-extra/usr/lib/python3/dist-packages/ python3 ./auto.py -v
 
 override_dh_auto_clean:
 	dh_auto_clean

Attachment: signature.asc
Description: Digital signature

Reply via email to