From 646aa958297f858e04c947cc4577dfaaba4c703a Mon Sep 17 00:00:00 2001 From: Andrew Plummer Date: Tue, 7 Sep 2021 22:11:08 +0100 Subject: [PATCH] Do not error if use_2to3 is set to a false value --- setup.cfg | 2 +- setuptools/dist.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 92f8616068..bbe000fadf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -124,7 +124,7 @@ distutils.setup_keywords = dependency_links = setuptools.dist:assert_string_list test_loader = setuptools.dist:check_importable test_runner = setuptools.dist:check_importable - use_2to3 = setuptools.dist:invalid + use_2to3 = setuptools.dist:invalid_ignored_if_false egg_info.writers = PKG-INFO = setuptools.command.egg_info:write_pkg_info requires.txt = setuptools.command.egg_info:write_requirements diff --git a/setuptools/dist.py b/setuptools/dist.py index 3363495c91..3fa3048547 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -289,8 +289,11 @@ def assert_bool(dist, attr, value): raise DistutilsSetupError(tmpl.format(attr=attr, value=value)) -def invalid(dist, attr, value): - raise DistutilsSetupError(f"{attr} is invalid.") +def invalid_ignored_if_false(dist, attr, value): + if not value: + warnings.warn("{attr} is ignored") + return + raise DistutilsSetupError(f"{attr} is invalid if it is set to a true value.") def check_requirements(dist, attr, value):