Skip to content
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
14 changes: 5 additions & 9 deletions flit_core/flit_core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ class Metadata(object):
license_files = ()
dynamic = ()

metadata_version = "2.3"
metadata_version = "2.4"

def __init__(self, data):
data = data.copy()
Expand Down Expand Up @@ -427,19 +427,15 @@ def write_metadata_file(self, fp):
license_expr = getattr(self, self._normalise_field_name("License-Expression"))
license = getattr(self, self._normalise_field_name("License"))
if license_expr:
# TODO: License-Expression requires Metadata-Version '2.4'
# Backfill it to the 'License' field for now
# fp.write(u'License-Expression: {}\n'.format(license_expr))
fp.write(u'License: {}\n'.format(license_expr))
elif license:
fp.write(u'License-Expression: {}\n'.format(license_expr))
elif license: # Deprecated, superseded by License-Expression
fp.write(u'License: {}\n'.format(license))

for clsfr in self.classifiers:
fp.write(u'Classifier: {}\n'.format(clsfr))

# TODO: License-File requires Metadata-Version '2.4'
# for file in self.license_files:
# fp.write(u'License-File: {}\n'.format(file))
for file in self.license_files:
fp.write(u'License-File: {}\n'.format(file))

for req in self.requires_dist:
normalised_req = self._normalise_requires_dist(req)
Expand Down
2 changes: 1 addition & 1 deletion flit_core/flit_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def read_pep621_metadata(proj, path) -> LoadedConfig:
if not cl.startswith('License :: '):
continue
raise ConfigError(
"License classifier are deprecated in favor of the license expression. "
"License classifiers are deprecated in favor of the license expression. "
"Remove the '{}' classifier".format(cl)
)
md_dict['classifiers'] = proj['classifiers']
Expand Down
4 changes: 2 additions & 2 deletions flit_core/tests_core/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ def test_metadata_2_3_provides_extra(provides_extra, expected_result):
('value', 'expected_license', 'expected_license_expression'),
[
({'license': 'MIT'}, 'MIT', None),
({'license_expression': 'MIT'}, 'MIT', None), # TODO Metadata 2.4
({'license_expression': 'Apache-2.0'}, 'Apache-2.0', None) # TODO Metadata 2.4
({'license_expression': 'MIT'}, None, 'MIT'),
({'license_expression': 'Apache-2.0'}, None, 'Apache-2.0'),
],
)
def test_metadata_license(value, expected_license, expected_license_expression):
Expand Down
2 changes: 1 addition & 1 deletion flit_core/tests_core/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_bad_include_paths(path, err_match):
# ({'license': "MIT License"}, "Invalid license expression: 'MIT License'"), # TODO
(
{'license': 'MIT', 'classifiers': ['License :: OSI Approved :: MIT License']},
"License classifier are deprecated in favor of the license expression",
"License classifiers are deprecated in favor of the license expression",
),
({'license-files': 1}, r"\blist\b"),
({'license-files': ["/LICENSE"]}, r"'/LICENSE'.+must not start with '/'"),
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["flit_core >=3.10.1,<4"]
requires = ["flit_core >=3.11,<4"]
build-backend = "flit_core.buildapi"

[project]
Expand All @@ -16,9 +16,9 @@ dependencies = [
]
requires-python = ">=3.8"
readme = "README.rst"
license = {file = "LICENSE"}
license = "BSD-3-Clause"
license-files = ["LICENSE"]
classifiers = ["Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand Down