Package: python-pkg-resources
Version: 5.5.1-1
Severity: normal

Dear Maintainer,

I installed the slimit package and, lacking a man page, ran
 slimit --help
Instead of help I got
<quote>
Traceback (most recent call last):
  File "/usr/bin/slimit", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1189, in 
<module>
    class MarkerEvaluation(object):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1193, in 
MarkerEvaluation
    'python_full_version': platform.python_version,
AttributeError: 'module' object has no attribute 'python_version'
</quote>
which wasn't much use.  The problem is that last stack frame, in
pkg_resources.py, where
<quote>
import platform
...
class MarkerEvaluation(object):
    values = {
        'os_name': lambda: os.name,
        'sys_platform': lambda: sys.platform,
        'python_full_version': platform.python_version,
        'python_version': lambda: platform.python_version()[:3],
...
</quote>
presumes that the module platform has python_version as an attribute
(that is, no less, callable returning a sequence).  A quick python
session:
<quote>
Python 2.7.8 (default, Sep  9 2014, 23:55:56) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.python_version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'python_version'
>>> platform.version
<function version at 0xb72aa56c>
>>> platform.version()
'#1 SMP Debian 3.14.15-2 (2014-08-09)'
>>> import sys
>>> sys.version
'2.7.8 (default, Sep  9 2014, 23:55:56) \n[GCC 4.9.1]'
</quote>
reveals that this is an unrealistic expectation.
Continuing,
<quote>
>>> import pkg_resources
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pkg_resources.py", line 1189, in <module>
    class MarkerEvaluation(object):
  File "pkg_resources.py", line 1193, in MarkerEvaluation
    'python_full_version': platform.python_version,
AttributeError: 'module' object has no attribute 'python_version'
</quote>
I verify that the problem resides entirely within pkg_resources; it
has nothing to do with how slimit is using it.

Commenting out the python_full_version and python_version entries in
values (quoted above), I discover python_implementation is also a
mythical attribute of platform.  Commenting *that* out, I find I am
finally able to import pkg_resources; and slimit --help actually runs,
albeit producing only minimal help.  I don't know what else may be
broken by it, but here's the patch I'm left using:
<patch>
diff -bu /usr/lib/python2.7/dist-packages/pkg_resources.py.orig 
/usr/lib/python2.7/dist-packages/pkg_resources.py
--- /usr/lib/python2.7/dist-packages/pkg_resources.py.orig      2014-08-10 
19:36:30.000000000 +0200
+++ /usr/lib/python2.7/dist-packages/pkg_resources.py   2014-09-17 
15:00:55.183904273 +0200
@@ -1190,11 +1190,11 @@
     values = {
         'os_name': lambda: os.name,
         'sys_platform': lambda: sys.platform,
-        'python_full_version': platform.python_version,
-        'python_version': lambda: platform.python_version()[:3],
+        #'python_full_version': platform.python_version,
+        #'python_version': lambda: platform.python_version()[:3],
         'platform_version': platform.version,
         'platform_machine': platform.machine,
-        'python_implementation': platform.python_implementation,
+        #'python_implementation': platform.python_implementation,
     }
 
     @classmethod

Diff finished.  Wed Sep 17 15:07:54 2014
</patch>

This makes pkg_resources.py unusable (can't import it) and makes at
least one other package unusable (slimit, because it expects to be
able to import pkg_resources).

-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.14-2-686-pae (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-pkg-resources depends on:
pn  python:any  <none>

python-pkg-resources recommends no packages.

Versions of packages python-pkg-resources suggests:
pn  python-distribute      <none>
pn  python-distribute-doc  <none>

-- no debconf information


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

Reply via email to