From 0cc8362038f6feb3ede00ee9ce8ba8c7d04940d9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 3 May 2015 12:39:16 -0400 Subject: Use new string formatting --- setuptools/dist.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 05669366..d7ad4655 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -115,19 +115,20 @@ def check_extras(dist, attr, value): def assert_bool(dist, attr, value): """Verify that value is True, False, 0, or 1""" if bool(value) != value: - raise DistutilsSetupError( - "%r must be a boolean value (got %r)" % (attr,value) - ) + tmpl = "{attr!r} must be a boolean value (got {value!r})" + raise DistutilsSetupError(tmpl.format(attr=attr, value=value)) + + def check_requirements(dist, attr, value): """Verify that install_requires is a valid requirements list""" try: list(pkg_resources.parse_requirements(value)) - except (TypeError, ValueError) as e: + except (TypeError, ValueError) as error: tmpl = ( - "%r must be a string or list of strings " - "containing valid project/version requirement specifiers; %s" + "{attr!r} must be a string or list of strings " + "containing valid project/version requirement specifiers; {error}" ) - raise DistutilsSetupError(tmpl % (attr, e)) + raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) def check_entry_points(dist, attr, value): """Verify that entry_points map is parseable""" -- cgit v1.2.1