Commit 33544f0b authored by Marc Abramowitz's avatar Marc Abramowitz

Nicer error when problem in install_requires

Instead of:

    $ python setup.py egg_info
    error in adminweb setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers

We now have the more helpful:

    $ python setup.py egg_info
    error in adminweb setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers.
    Error: Expected version spec in smsdk.authsvc>=0.0.8,2.0 at 2.0

It took me longer than it should to find the problem with the old error
message. The new error message would've helped greatly.
parent 13a5cc5b
...@@ -122,11 +122,15 @@ def check_requirements(dist, attr, value): ...@@ -122,11 +122,15 @@ def check_requirements(dist, attr, value):
"""Verify that install_requires is a valid requirements list""" """Verify that install_requires is a valid requirements list"""
try: try:
list(pkg_resources.parse_requirements(value)) list(pkg_resources.parse_requirements(value))
except (TypeError,ValueError): except (TypeError, ValueError) as e:
raise DistutilsSetupError( raise DistutilsSetupError(
"%r must be a string or list of strings " "%r must be a string or list of strings "
"containing valid project/version requirement specifiers" % (attr,) "containing valid project/version requirement specifiers.\n"
"Error: %s"
% (attr, ' '.join(e.args))
) )
def check_entry_points(dist, attr, value): def check_entry_points(dist, attr, value):
"""Verify that entry_points map is parseable""" """Verify that entry_points map is parseable"""
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment