summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-05-03 12:39:16 -0400
committerJason R. Coombs <jaraco@jaraco.com>2015-05-03 12:39:16 -0400
commit0cc8362038f6feb3ede00ee9ce8ba8c7d04940d9 (patch)
treefe489fb6cb4ebd3e2e52df136eb276147b58ab5f
parente55483f33a61c302461ed480a3556d746b8aba40 (diff)
downloadpython-setuptools-git-0cc8362038f6feb3ede00ee9ce8ba8c7d04940d9.tar.gz
Use new string formatting
-rw-r--r--setuptools/dist.py15
1 files 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"""