From 7bfad8a40dfe71f1a7a8f8a33d6d3a225056ff5e Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 20 Mar 2025 12:42:27 +0000 Subject: [PATCH 1/2] Avoid raising exception when license-files is defined outside of pyproject.toml --- setuptools/config/_apply_pyprojecttoml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setuptools/config/_apply_pyprojecttoml.py b/setuptools/config/_apply_pyprojecttoml.py index ffa3fc3c49..f6fd1e3d1e 100644 --- a/setuptools/config/_apply_pyprojecttoml.py +++ b/setuptools/config/_apply_pyprojecttoml.py @@ -90,7 +90,8 @@ def _apply_tool_table(dist: Distribution, config: dict, filename: StrPath): return # short-circuit if "license-files" in tool_table: - if dist.metadata.license_files: + if "license-files" in config.get("project", {}): + # https://github.com/pypa/setuptools/pull/4837#discussion_r2004983349 raise InvalidConfigError( "'project.license-files' is defined already. " "Remove 'tool.setuptools.license-files'." From f9ad3e103aaaf86119e6d93c509ffaef3184e676 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 20 Mar 2025 12:45:45 +0000 Subject: [PATCH 2/2] Add newsfragment --- newsfragments/4899.bugfix.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 newsfragments/4899.bugfix.rst diff --git a/newsfragments/4899.bugfix.rst b/newsfragments/4899.bugfix.rst new file mode 100644 index 0000000000..7205010ed3 --- /dev/null +++ b/newsfragments/4899.bugfix.rst @@ -0,0 +1,3 @@ +Avoided eagerly raising an exception when ``license-files`` is defined +simultaneously inside and outside of ``pyproject.toml``. +Instead we rely on the existing deprecation error.