From 97e8f94e24a57a446dee965f71532acacf7354d9 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 25 Nov 2024 01:07:59 +0100 Subject: [PATCH] Remove License-Expression field --- newsfragments/4706.feature.rst | 2 +- setuptools/_core_metadata.py | 9 +++------ setuptools/tests/config/test_apply_pyprojecttoml.py | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/newsfragments/4706.feature.rst b/newsfragments/4706.feature.rst index 38b09276c0..1d34f5f476 100644 --- a/newsfragments/4706.feature.rst +++ b/newsfragments/4706.feature.rst @@ -1 +1 @@ -Added initial support for ``License-Expression`` (`PEP 639 `_). -- by :user:`cdce8p` +Added initial support for license expression (`PEP 639 `_). -- by :user:`cdce8p` diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py index f44ba50c92..efc8976f1e 100644 --- a/setuptools/_core_metadata.py +++ b/setuptools/_core_metadata.py @@ -175,12 +175,9 @@ def write_field(key, value): if attr_val is not None: write_field(field, attr_val) - if self.license_expression: - write_field('License-Expression', rfc822_escape(self.license_expression)) - else: - license = self.get_license() - if license: - write_field('License', rfc822_escape(license)) + license = self.license_expression or self.get_license() + if license: + write_field('License', rfc822_escape(license)) for project_url in self.project_urls.items(): write_field('Project-URL', '%s, %s' % project_url) diff --git a/setuptools/tests/config/test_apply_pyprojecttoml.py b/setuptools/tests/config/test_apply_pyprojecttoml.py index c90f7aadc2..0f40176a13 100644 --- a/setuptools/tests/config/test_apply_pyprojecttoml.py +++ b/setuptools/tests/config/test_apply_pyprojecttoml.py @@ -289,7 +289,7 @@ def test_utf8_maintainer_in_metadata( # issue-3663 PEP639_LICENSE_EXPRESSION, None, 'MIT OR Apache-2.0', - 'License-Expression: MIT OR Apache-2.0', + 'License: MIT OR Apache-2.0', # TODO Metadata version '2.4' id='license-expression', ), ),