Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
* gregor herrmann gre...@debian.org, 2012-08-14, 19:11: +-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') To be super-correct, the other f_loc = ... line should be fixed in the same way: Python 3.1 doesn't support keyword arguments in str.encode() either. But that would make a difference only for backports; if you build the package in wheezy, you'll get a dependency on python3 (= 3.2.something). Other than that, the patch looks good. And it even makes the test suite pass! :) Before: | $ python2.6 test/auto.py | FFE.FEE...FEFE.FEFEFE.EFEFEFEFFEFEFEFEFE. | [...] | -- | Ran 26 tests in 7.758s | | FAILED (failures=17, errors=17) After: | $ python2.6 test/auto.py | .. | -- | Ran 26 tests in 9.586s | | OK Of course, it would be nicer if such bugs were caught when python-distutils-extra is being built, so I filed #684967. -- Jakub Wilk -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
Hello Jakub, Gregor, thanks for spotting this! I fixed Jakub's two other bug reports about running the test suite, and I'll upload a new version with the two python 2.6 incompatibilities today. Martin -- Martin Pitthttp://www.piware.de Ubuntu Developer http://www.ubuntu.com Debian Developer http://www.debian.org -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
On Wed, 15 Aug 2012 10:48:50 +0200, Jakub Wilk wrote: * gregor herrmann gre...@debian.org, 2012-08-14, 19:11: +-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') To be super-correct, the other f_loc = ... line should be fixed in the same way: Python 3.1 doesn't support keyword arguments in str.encode() either. Oh, I guess I should have read the python stdlib docs closer. Thanks for the review and the improvement! (And thanks Martin for the quick upload). 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: Elton John: Circle Of Love signature.asc Description: Digital signature
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
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.0 +0200 +++ python-distutils-extra-2.35/debian/changelog 2012-08-14 19:09:27.0 +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.0 +0100 +++ python-distutils-extra-2.35/debian/patches/backwards-compatibility-for-python2.6.patch 2012-08-14 18:56:10.0 +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: +
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
Hi On Tue, Aug 14, 2012 at 07:11:29PM +0200, gregor herrmann wrote: Ok, with your patch a bit extended, both linaro-image-tools and nautilus-image-manipulator finally build! \o/ Only to confirm: works for me too. Regards, Salvatore signature.asc Description: Digital signature
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
Hi Only some more results to this bugreport. On Fri, Aug 10, 2012 at 04:47:33PM +0200, gregor herrmann wrote: On Fri, 10 Aug 2012 15:52:43 +0200, Salvatore Bonaccorso wrote: What I do not yet understand, is why it still uses python2.6 for both packages: at least nautilus-image-manipulator depends on python, which now defaults to 2.7, so some other dependencies brings in python2.6? In the chroot when the build fails: # aptitude why python2.6 i pbuilder-satisfydepends-dummy Depends python-nose i A python-nose Depends python2.6 But then again, it also shouldn't fail if python2.6 is installed by accident on the build system. But again, I only did a first look so my initial disclaimer still holds :) Same here :) 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- [1]: See attached patch. Thanks for looking too at it Gregor. The perl group makes an expidition into python land? Let's see if this is successful :) :-). Regards, Salvatore Description: Use sys.version_info[0] instead of sys.version_info.major Use sys.version_info[0] instead of sys.version_info.major for backwards compatibility to python2.6. Author: Salvatore Bonaccorso car...@debian.org Bug-Debian: http://bugs.debian.org/682631 --- python-distutils-extra-2.35.orig/DistUtilsExtra/auto.py +++ python-distutils-extra-2.35/DistUtilsExtra/auto.py @@ -104,7 +104,7 @@ def setup(**attrs): 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') else: @@ -387,7 +387,7 @@ def __add_imports(imports, file, attrs): 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') signature.asc Description: Digital signature
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
On Thu, 09 Aug 2012 17:37:01 +0200, gregor herrmann wrote: I'm no python expert and only did the NMU upload for nautilus-image-manipulator recently, but I have found that e.g. google-apps-manager does [1,2] for python2.6 'compatibility': [1]: http://code.google.com/p/google-apps-manager/issues/detail?id=61 [2]: https://code.google.com/p/google-apps-manager/source/detail?r=253# Nice, I'm learning something about python by looking at bug reports :) https://code.google.com/p/google-apps-manager/source/diff?spec=svn253r=253format=sidepath=/trunk/gam.py shows the diff. But: The error | WARNING: the following files are not recognized by DistUtilsExtra.auto: | Traceback (most recent call last): | File setup.py, line 86, in module | cmdclass={'install': InstallAndUpdateDataDirectory} | File /usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py, line 107, in setup | if(sys.version_info.major 3): | AttributeError: 'tuple' object has no attribute 'major' | dh_auto_clean: python2.6 setup.py clean -a returned exit code 1 | make: *** [clean] Error 1 in sid or in wheezy: | Traceback (most recent call last): | File setup.py, line 86, in module | cmdclass={'install': InstallAndUpdateDataDirectory} | File /usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py, line 98, in setup | __requires(attrs, src_all) | File /usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py, line 458, in __requires | __add_imports(imports, s, attrs) | File /usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py, line 383, in __add_imports | if(sys.version_info.major 3): | AttributeError: 'tuple' object has no attribute 'major' | dh_auto_build: python2.6 setup.py build --force returned exit code 1 | make: *** [build] Error 1 doesn't happen in these packages themselves but: # ls -l /usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py lrwxrwxrwx 1 root root 49 Aug 3 11:57 /usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py - ../../../../share/pyshared/DistUtilsExtra/auto.py # readlink -f /usr/lib/python2.6/dist-packages/DistUtilsExtra/auto.py /usr/share/pyshared/DistUtilsExtra/auto.py # dpkg -S /usr/share/pyshared/DistUtilsExtra/auto.py python-distutils-extra: /usr/share/pyshared/DistUtilsExtra/auto.py Should the bugs be reassigned? Someone with python knowledge needed here :) 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: Beatles: Sgt. Pepper's Lonely Hearts Club Band signature.asc Description: Digital signature
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
On Fri, 10 Aug 2012 15:52:43 +0200, Salvatore Bonaccorso wrote: What I do not yet understand, is why it still uses python2.6 for both packages: at least nautilus-image-manipulator depends on python, which now defaults to 2.7, so some other dependencies brings in python2.6? In the chroot when the build fails: # aptitude why python2.6 i pbuilder-satisfydepends-dummy Depends python-nose i A python-nose Depends python2.6 But then again, it also shouldn't fail if python2.6 is installed by accident on the build system. But again, I only did a first look so my initial disclaimer still holds :) Same here :) Thanks for looking too at it Gregor. The perl group makes an expidition into python land? Let's see if this is successful :) 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: Pink Floyd: Time signature.asc Description: Digital signature
Bug#682631: Bug#682634: Bug#682631: linaro-image-tools: FTBFS: AttributeError: 'tuple' object has no attribute 'major'
On Thu, 09 Aug 2012 12:51:24 +0200, Salvatore Bonaccorso wrote: I'm no python expert and only did the NMU upload for nautilus-image-manipulator recently, but I have found that e.g. google-apps-manager does [1,2] for python2.6 'compatibility': [1]: http://code.google.com/p/google-apps-manager/issues/detail?id=61 [2]: https://code.google.com/p/google-apps-manager/source/detail?r=253# Nice, I'm learning something about python by looking at bug reports :) https://code.google.com/p/google-apps-manager/source/diff?spec=svn253r=253format=sidepath=/trunk/gam.py shows the diff. Let's try: % python2.6 Python 2.6.8 (unknown, Jun 28 2012, 18:14:12) [GCC 4.7.1] on linux2 Type help, copyright, credits or license for more information. import sys sys.version_info (2, 6, 8, 'final', 0) sys.version_info.major Traceback (most recent call last): File stdin, line 1, in module AttributeError: 'tuple' object has no attribute 'major' sys.version_info[0] 2 % python2.7 Python 2.7.3rc2 (default, Apr 22 2012, 22:35:38) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information. import sys sys.version_info sys.version_info(major=2, minor=7, micro=3, releaselevel='candidate', serial=2) sys.version_info.major 2 sys.version_info[0] 2 % python3.2 Python 3.2.3 (default, Jul 13 2012, 21:02:37) [GCC 4.7.1] on linux2 Type help, copyright, credits or license for more information. import sys sys.version_info sys.version_info(major=3, minor=2, micro=3, releaselevel='final', serial=0) sys.version_info.major 3 sys.version_info[0] 3 Looks like it should work for those AttributeError: 'tuple' object has no attribute 'major' bugs. 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: Aimee Mann: Calling It Quits signature.asc Description: Digital signature