Skip to content

Commit b44b4f1

Browse files
committed
Suggestions
1 parent ab277d3 commit b44b4f1

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

setuptools/config/_apply_pyprojecttoml.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ def _apply_tool_table(dist: Distribution, config: dict, filename: StrPath):
8989
if not tool_table:
9090
return # short-circuit
9191

92+
if "license-files" in tool_table:
93+
if dist.metadata.license_files:
94+
raise InvalidConfigError(
95+
"'project.license-files' is defined already. "
96+
"Remove 'tool.setuptools.license-files'."
97+
)
98+
99+
pypa_guides = "guides/writing-pyproject-toml/#license-files"
100+
SetuptoolsDeprecationWarning.emit(
101+
"'tool.setuptools.license-files' is deprecated in favor of "
102+
"'project.license-files'",
103+
see_url=f"https://packaging.python.org/en/latest/{pypa_guides}",
104+
due_date=(2026, 2, 18), # Warning introduced on 2025-02-18
105+
)
106+
92107
for field, value in tool_table.items():
93108
norm_key = json_compatible_key(field)
94109

@@ -100,23 +115,6 @@ def _apply_tool_table(dist: Distribution, config: dict, filename: StrPath):
100115
"""
101116
raise RemovedConfigError("\n".join([cleandoc(msg), suggestion]))
102117

103-
if norm_key == "license_files":
104-
if dist.metadata.license_files:
105-
raise InvalidConfigError(
106-
"'project.license-files' is defined already. "
107-
"Remove 'tool.setuptools.license-files'."
108-
)
109-
110-
pypa_guides = "guides/writing-pyproject-toml/#license-files"
111-
SetuptoolsDeprecationWarning.emit(
112-
"'tool.setuptools.license-files' is deprecated in favor of "
113-
"'project.license-files'",
114-
see_url=f"https://packaging.python.org/en/latest/{pypa_guides}",
115-
)
116-
# Warning introduced on 2025-02-18
117-
# TODO: Should we add a due date? It may affect old/unmaintained
118-
# packages in the ecosystem and cause problems...
119-
120118
norm_key = TOOL_TABLE_RENAMES.get(norm_key, norm_key)
121119
corresp = TOOL_TABLE_CORRESPONDENCE.get(norm_key, norm_key)
122120
if callable(corresp):

0 commit comments

Comments
 (0)