@@ -89,6 +89,21 @@ def _apply_tool_table(dist: Distribution, config: dict, filename: StrPath):
89
89
if not tool_table :
90
90
return # short-circuit
91
91
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
+
92
107
for field , value in tool_table .items ():
93
108
norm_key = json_compatible_key (field )
94
109
@@ -100,23 +115,6 @@ def _apply_tool_table(dist: Distribution, config: dict, filename: StrPath):
100
115
"""
101
116
raise RemovedConfigError ("\n " .join ([cleandoc (msg ), suggestion ]))
102
117
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
-
120
118
norm_key = TOOL_TABLE_RENAMES .get (norm_key , norm_key )
121
119
corresp = TOOL_TABLE_CORRESPONDENCE .get (norm_key , norm_key )
122
120
if callable (corresp ):
0 commit comments