From: Daira Hopwood <daira@jacaranda.org>
Date: Tue, 28 Apr 2015 17:42:57 +0000 (+0100)
Subject: zetuptoolz: tolerate a single string for __requires__, and improve error reporting... 
X-Git-Tag: allmydata-tahoe-1.10.1a1~30
X-Git-Url: https://git.rkrishnan.org/pf/content/rgr-080307.php?a=commitdiff_plain;h=575d7a20a9c9c4cc839c8fb094055dc04177f290;p=tahoe-lafs%2Ftahoe-lafs.git

zetuptoolz: tolerate a single string for __requires__, and improve error reporting. fixes ticket:2242

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

diff --git a/setuptools-0.6c16dev5.egg/pkg_resources.py b/setuptools-0.6c16dev5.egg/pkg_resources.py
index a94d89f8..52ce472f 100644
--- a/setuptools-0.6c16dev5.egg/pkg_resources.py
+++ b/setuptools-0.6c16dev5.egg/pkg_resources.py
@@ -529,14 +529,19 @@ class WorkingSet(object):
         # If we have a __requires__ then we can already tell if this
         # dist is unsatisfactory, in which case we won't add it.
         if __requires__ is not None:
-            for thisreqstr in __requires__:
+            if isinstance(__requires__, basestring):
+                array_of__requires__ = [__requires__]
+            else:
+                array_of__requires__ = __requires__
+
+            for thisreqstr in array_of__requires__:
                 try:
                     for thisreq in parse_requirements(thisreqstr):
                         if thisreq.key == dist.key:
                             if dist not in thisreq:
                                 return
                 except ValueError, e:
-                    e.args = tuple(e.args + ({'thisreqstr': thisreqstr},))
+                    e.args = tuple(e.args + ({'thisreqstr': thisreqstr, '__requires__': __requires__},))
                     raise
 
         self.by_key[dist.key] = dist