Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail fast when use_2to3 is supplied. #2770

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/2769.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build now fails fast when ``use_2to3`` is supplied.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +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
egg_info.writers =
PKG-INFO = setuptools.command.egg_info:write_pkg_info
requires.txt = setuptools.command.egg_info:write_requirements
Expand Down
4 changes: 4 additions & 0 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ 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.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaraco in the light of #2775, maybe this could at least be turned into

Suggested change
raise DistutilsSetupError(f"{attr} is invalid.")
if not value: # it's okay, if it's False
warnings.warn(f"Remove the {attr} setting from your packaging.")
return
raise DistutilsSetupError(f"{attr} is invalid.")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally was writing the function with this check, but then I wanted to make the "check" function suitable for any invalid value. I'll review the referenced bug and consider this proposal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it turned out more impactful on the scale than you've probably expected. Seems rather urgent.



def check_requirements(dist, attr, value):
"""Verify that install_requires is a valid requirements list"""
try:
Expand Down