Bug#722214: dh-python: ASCII conversion error in pybuild autotest

2013-09-09 Thread B. Clausius
To reproduce:
1) setup.py contains non ascii character (e.g. copyright symbol)
2) LC_ALL=C (e.g. in pbuilder)

$ PYBUILD_VERBOSE=1 LC_ALL=C dh_auto_test -O--buildsystem=pybuild
D: pybuild pybuild:445: version: 1.20130903-1
D: pybuild pybuild:446: ['/usr/bin/pybuild', '--test', '-i',
'python{version}', '-p', '3.3', '--dir', '.']
D: pybuild pybuild:35: cfg: Namespace(after_build=None,
after_clean=None, after_configure=None, after_install=None,
after_test=None, before_build=None, before_clean=None,
before_configure=None, before_install=None, before_test=None,
build_args=None, build_only=False, clean_args=None, clean_only=False,
configure_args=None, configure_only=False, custom_tests=False,
destdir='debian/tmp', detect_only=False, dir='.', disable=None,
ext_destdir=None, ext_pattern='\\.so(\\.[^/]*)?$', install_args=None,
install_dir=None, install_only=False, interpreter=['python{version}'],
list_systems=False, name=None, quiet=False, really_quiet=False,
system=None, test_args=None, test_nose=False, test_only=True,
test_pytest=False, test_tox=False, verbose=True, versions=['3.3'])
D: pybuild pybuild:88: detected build system: distutils (certainty: 60%)
E: pybuild pybuild:255: test: plugin distutils failed with: 'ascii'
codec can't decode byte 0xc2 in position 57: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/bin/pybuild", line 252, in main
run(func, interpreter, version, c)
  File "/usr/bin/pybuild", line 207, in run
result = func(context, args)
  File "/usr/share/dh-python/dhpython/build/base.py", line 179, in
wrapped_func
command = func(self, context, args, *oargs, **kwargs)
  File "/usr/share/dh-python/dhpython/build/plugin_distutils.py", line
52, in wrapped_func
return func(self, context, args, *oargs, **kwargs)
  File "/usr/share/dh-python/dhpython/build/plugin_distutils.py", line
109, in test
if fp.read().find('test_suite') > 0:
  File "/usr/lib/python3.3/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 57:
ordinal not in range(128)
dh_auto_test: pybuild --test -i python{version} -p 3.3 --dir . returned
exit code 13


With the attached patch the file is opened in binary mode, so that the
encoding does not matter.

diff --git a/dhpython/build/plugin_distutils.py b/dhpython/build/plugin_distutils.py
index 5c76c13..b50dbd6 100644
--- a/dhpython/build/plugin_distutils.py
+++ b/dhpython/build/plugin_distutils.py
@@ -105,8 +105,8 @@ class BuildSystem(Base):
 def test(self, context, args):
 if not self.cfg.custom_tests:
 fpath = join(args['dir'], args['setup_py'])
-with open(fpath) as fp:
-if fp.read().find('test_suite') > 0:
+with open(fpath, 'rb') as fp:
+if fp.read().find(b'test_suite') > 0:
 # TODO: is that enough to detect if test target is available?
 return '{interpreter} {setup_py} test {args}'
 return super(BuildSystem, self).test(context, args)


Bug#722214: dh-python: ASCII conversion error in pybuild autotest

2013-09-08 Thread Scott Kitterman
Package: dh-python
Version: 1.20130903-1
Severity: important

Still working on pybik (so you can grab it from the PAPT svn to recreate
this problem):

make[1]: Leaving directory `/tmp/buildd/pybik-1.1'
   dh_auto_test -O--buildsystem=pybuild
E: pybuild pybuild:255: test: plugin distutils failed with: 'ascii' codec can't 
decode byte 0xc2 in position 57: ordinal not in range(128)
dh_auto_test: pybuild --test -i python{version} -p 3.3 --dir . returned exit 
code 13
make: *** [build] Error 13

I'm not 100% sure if that's an actual dh-python bug or it's just very
unfriendly about explaining there's a bug in the package.


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