[Python-modules-team] Bug#703351: /usr/bin/py.test fails with ValueError

Roderich Schupp roderich.schupp at gmail.com
Mon Mar 18 17:56:24 UTC 2013


Package: python-pytest
Version: 2.3.4-1~exp1
Severity: serious
Tags: patch

$ py.test-2.7 -v
Traceback (most recent call last):
  File "/usr/bin/py.test-2.7", line 5, in <module>
    sys.exit(load_entry_point('pytest==2.3.4    * Bump Standards-Version to
3.9.4, no change needed.', 'console_scripts', 'py.test')())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 343, in
load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 335, in
get_distribution
    if isinstance(dist,basestring): dist = Requirement.parse(dist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2678, in parse
    reqs = list(parse_requirements(s))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2603, in
parse_requirements
    line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2581, in
scan_list
    "Expected ',' or end-of-list in",line,"at",line[p:]
ValueError: ("Expected ',' or end-of-list in", 'pytest==2.3.4    * Bump
Standards-Version to 3.9.4, no change needed.', 'at', '    * Bump Standards-
Version to 3.9.4, no change needed.')

The casue is this line in py.test

sys.sys.exit(load_entry_point('pytest==2.3.4    * Bump Standards-Version to
3.9.4, no change needed.', 'console_scripts',
'py.test')())exit(load_entry_point('pytest==2.3.4    * Bump Standards-Version
to 3.9.4, no change needed.', 'console_scripts', 'py.test')())

generated in debian/rules

UPSTREAM = $(shell dpkg-parsechangelog | grep Version | sed 's/Version:
\(.*\)-.*/\1/' )

but

$ dpkg-parsechangelog
Source: pytest
Version: 2.3.4-1~exp1
Distribution: experimental
....
   * Bump Standards-Version to 3.9.4, no change needed.
....

i.e. a second line with the string "Version" in it :)
Suggested fix:

UPSTREAM = $(shell dpkg-parsechangelog | sed -n 's/^Version: \(.*\)-.*/\1/p' )

There's another, but  minor problem: the shebang line for /usr/bin/py.test-VER
(generated in postinst) is always

#! /usr/bin/python

Note the blank after the hash bang. It's inserted by recent versions
of function fix_shebang from /usr/share/python/debpython/tools.py which
is used by dh_python{2,3}.
Suggested fix is to be more liberal in postinst when adjusting the shebang
line:

--- pytest-2.3.4-ORIG/debian/python-pytest.postinst     2013-03-18
18:53:25.169215831 +0100
+++ pytest-2.3.4/debian/python-pytest.postinst  2013-03-18 18:54:06.152287209
+0100
@@ -19,7 +19,7 @@
         for version in `pyversions -vi`; do
             if [ $version ]; then
                 cp /usr/bin/py.test /usr/bin/py.test-$version
-                sed -i "s,#!/usr/bin/python,#!/usr/bin/python$version,"
"/usr/bin/py.test-$version"
+                sed -i "s,#! */usr/bin/python,#!/usr/bin/python$version,"
"/usr/bin/py.test-$version"
             fi
         done
     ;;
--- pytest-2.3.4-ORIG/debian/python3-pytest.postinst    2013-03-18
18:53:25.165215922 +0100
+++ pytest-2.3.4/debian/python3-pytest.postinst 2013-03-18 18:53:55.464529382
+0100
@@ -20,7 +20,7 @@
         for version in `py3versions -vi`; do
             if [ $version ]; then
                 cp /usr/bin/py.test-3 /usr/bin/py.test-$version
-                sed -i "s,#!/usr/bin/python3,#!/usr/bin/python$version,"
"/usr/bin/py.test-$version"
+                sed -i "s,#! */usr/bin/python3,#!/usr/bin/python$version,"
"/usr/bin/py.test-$version"
             fi
         done
     ;;












-- System Information:
Debian Release: 7.0
  APT prefers raring
  APT policy: (500, 'raring'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.8.3 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-pytest depends on:
ii  python                2.7.3-13
ii  python-pkg-resources  0.6.34-1
ii  python-py             1.4.12-1

python-pytest recommends no packages.

Versions of packages python-pytest suggests:
ii  python-mock  1.0.1-1

-- no debconf information



More information about the Python-modules-team mailing list