Skip to content

Commit

Permalink
Use License-Expression in METADATA and PKG-INFO, and parse tool.whey.…
Browse files Browse the repository at this point in the history
…license-key as an SPDX expression.
  • Loading branch information
domdfcoding committed May 15, 2024
1 parent 77eb20a commit 4cca0ea
Show file tree
Hide file tree
Showing 106 changed files with 768 additions and 124 deletions.
13 changes: 12 additions & 1 deletion doc-source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,24 @@ As a minimum, the table MUST contain the keys :tconf:`~project.name` and :tconf:

It is recommended to use an `SPDX Identifier`_, but note that not all map to classifiers.

:bold-title:`Example:`
.. versionchanged:: $VERSION

:tconf:`license-key` may now be an SPDX expression, e.g. ``MIT OR Apache-2.0``.

.. latex:clearpage::
:bold-title:`Examples:`

.. code-block:: TOML
[tool.whey]
license-key = "MIT"
.. code-block:: TOML
[tool.whey]
license-key = "MIT OR Apache-2.0"
.. tconf:: tool.whey.base-classifiers
:type: :toml:`Array` of :toml:`strings <String>`
Expand Down
1 change: 1 addition & 0 deletions formate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ known_third_party = [
"first",
"handy_archives",
"importlib_metadata",
"license_expression",
"natsort",
"packaging",
"pyproject_examples",
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dist-meta>=0.1.0
dom-toml>=2.0.0
domdf-python-tools>=2.8.0
handy-archives>=0.2.0
license-expression>=30.0.0
natsort>=7.1.1
packaging>=20.9
pyproject-parser>=0.11.0
Expand Down
16 changes: 16 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ def check_built_wheel(filename: PathPlus, advanced_file_regression: AdvancedFile
# pytest.param(COMPLETE_PROJECT_A, id="COMPLETE_PROJECT_A"),
pytest.param(COMPLETE_A, id="COMPLETE_A"),
pytest.param(COMPLETE_B, id="COMPLETE_B"),
pytest.param(
COMPLETE_B.replace('license-key = "MIT"', 'license-key = "MIT OR Apache-2.0"'),
id="COMPLETE_B_EXPRESSION_1",
),
pytest.param(
COMPLETE_B.replace('license-key = "MIT"', 'license-key = "GPL-3.0+"'),
id="COMPLETE_B_EXPRESSION_2",
),
pytest.param(
COMPLETE_B.replace('license-key = "MIT"', 'license-key = "MIT OR Apahe"'),
id="COMPLETE_B_INVALID_EXPRESSION_1",
),
pytest.param(
COMPLETE_B.replace('license-key = "MIT"', 'license-key = "(MIT OR Apache-2.0"'),
id="COMPLETE_B_SYNTAX_ERROR_EXPRESSION_1",
),
pytest.param(LONG_REQUIREMENTS, id="LONG_REQUIREMENTS"),
]
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_build_/test_build_additional_files.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Metadata-Version: 2.2
Metadata-Version: 2.4
Name: whey
Version: 2021.0.0
Summary: A simple Python wheel builder for simple projects.
Author-email: Dominic Davis-Foster <dominic@davis-foster.co.uk>
License: MIT
License-Expression: MIT
Keywords: build,distribution,packaging,pep517,pep621,sdist,wheel
Home-page: https://whey.readthedocs.io/en/latest
Project-URL: Home Page, https://whey.readthedocs.io/en/latest
Expand Down
4 changes: 2 additions & 2 deletions tests/test_build_/test_build_additional_files_source_dir.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Metadata-Version: 2.2
Metadata-Version: 2.4
Name: whey
Version: 2021.0.0
Summary: A simple Python wheel builder for simple projects.
Author-email: Dominic Davis-Foster <dominic@davis-foster.co.uk>
License: MIT
License-Expression: MIT
Keywords: build,distribution,packaging,pep517,pep621,sdist,wheel
Home-page: https://whey.readthedocs.io/en/latest
Project-URL: Home Page, https://whey.readthedocs.io/en/latest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build_/test_build_complete_COMPLETE_A_.RECORD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
whey/__init__.py,sha256=LVQwFWJ6dxQ2sw6nn9Ds2o34vNd7PVVmHK9aDW6AmIY,21
whey-2021.0.0.dist-info/LICENSE,sha256=5wizT6r_v4VTz5CuAQ2HSwrPhYUFwQypVskUSmY1reQ,20
whey-2021.0.0.dist-info/METADATA,sha256=Kt-Pv11iCkvNL7YcilCNYD7iYBD4mXWCg-p_PGdn49Q,1410
whey-2021.0.0.dist-info/METADATA,sha256=wQgDuhUDBI8we_Vo0p9J3qj-8xjj_BPijZxsXPp8D9o,1421
whey-2021.0.0.dist-info/WHEEL,sha256=Z8ApXUcOYK5VMz9yebTyUF13KAMNT6RSnd-lLcivEVA,84
whey-2021.0.0.dist-info/entry_points.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
whey-2021.0.0.dist-info/RECORD,,
4 changes: 2 additions & 2 deletions tests/test_build_/test_build_complete_COMPLETE_A_.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Metadata-Version: 2.2
Metadata-Version: 2.4
Name: whey
Version: 2021.0.0
Summary: A simple Python wheel builder for simple projects.
Author-email: Dominic Davis-Foster <dominic@davis-foster.co.uk>
License: MIT
License-Expression: MIT
Keywords: build,distribution,packaging,pep517,pep621,sdist,wheel
Home-page: https://whey.readthedocs.io/en/latest
Project-URL: Documentation, https://whey.readthedocs.io/en/latest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build_/test_build_complete_COMPLETE_B_.RECORD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
whey/__init__.py,sha256=LVQwFWJ6dxQ2sw6nn9Ds2o34vNd7PVVmHK9aDW6AmIY,21
whey-2021.0.0.dist-info/LICENSE,sha256=5wizT6r_v4VTz5CuAQ2HSwrPhYUFwQypVskUSmY1reQ,20
whey-2021.0.0.dist-info/METADATA,sha256=8y-1C1IzjZjVaevM0cDZantWiiYQ0gC9ECV_K_G1Lak,1472
whey-2021.0.0.dist-info/METADATA,sha256=KYQvzdrNV2KNBxzS_e91YniP9mxV1VQNv5N0VvC4Q1M,1483
whey-2021.0.0.dist-info/WHEEL,sha256=Z8ApXUcOYK5VMz9yebTyUF13KAMNT6RSnd-lLcivEVA,84
whey-2021.0.0.dist-info/entry_points.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
whey-2021.0.0.dist-info/RECORD,,
4 changes: 2 additions & 2 deletions tests/test_build_/test_build_complete_COMPLETE_B_.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Metadata-Version: 2.2
Metadata-Version: 2.4
Name: whey
Version: 2021.0.0
Summary: A simple Python wheel builder for simple projects.
Author-email: Dominic Davis-Foster <dominic@davis-foster.co.uk>
License: MIT
License-Expression: MIT
Keywords: build,distribution,packaging,pep517,pep621,sdist,wheel
Home-page: https://whey.readthedocs.io/en/latest
Project-URL: Home Page, https://whey.readthedocs.io/en/latest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
whey/__init__.py,sha256=LVQwFWJ6dxQ2sw6nn9Ds2o34vNd7PVVmHK9aDW6AmIY,21
whey-2021.0.0.dist-info/LICENSE,sha256=5wizT6r_v4VTz5CuAQ2HSwrPhYUFwQypVskUSmY1reQ,20
whey-2021.0.0.dist-info/METADATA,sha256=I0oGbdk1MlJyLJaNJG6xNFiISzS8pR43aNGBzRja9ro,1560
whey-2021.0.0.dist-info/WHEEL,sha256=Z8ApXUcOYK5VMz9yebTyUF13KAMNT6RSnd-lLcivEVA,84
whey-2021.0.0.dist-info/entry_points.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
whey-2021.0.0.dist-info/RECORD,,
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[build-system]
requires = [ "whey",]
build-backend = "whey"

[project]
name = "Whey"
version = "2021.0.0"
description = "A simple Python wheel builder for simple projects."
readme = "README.rst"
keywords = [ "pep517", "pep621", "build", "sdist", "wheel", "packaging", "distribution",]
dynamic = []
dependencies = [ "httpx", "gidgethub[httpx]>4.0.0", "django>2.1; os_name != 'nt'", "django>2.0; os_name == 'nt'",]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: Apache Software License",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
requires-python = ">=3.6"

[project.license]
file = "LICENSE"

[[project.authors]]
email = "dominic@davis-foster.co.uk"
name = "Dominic Davis-Foster"

[project.urls]
Homepage = "https://whey.readthedocs.io/en/latest"
"Home Page" = "https://whey.readthedocs.io/en/latest"
Documentation = "https://whey.readthedocs.io/en/latest"
"Issue Tracker" = "https://github.com/repo-helper/whey/issues"
"Source Code" = "https://github.com/repo-helper/whey"

[tool.whey]
base-classifiers = [ "Development Status :: 4 - Beta",]
python-versions = [ "3.6", "3.7", "3.8", "3.9", "3.10",]
python-implementations = [ "CPython", "PyPy",]
platforms = [ "Windows", "macOS", "Linux",]
license-key = "MIT OR Apache-2.0"
package = "whey"
37 changes: 37 additions & 0 deletions tests/test_build_/test_build_complete_COMPLETE_B_EXPRESSION_1_.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Metadata-Version: 2.4
Name: whey
Version: 2021.0.0
Summary: A simple Python wheel builder for simple projects.
Author-email: Dominic Davis-Foster <dominic@davis-foster.co.uk>
License-Expression: MIT OR Apache-2.0
Keywords: build,distribution,packaging,pep517,pep621,sdist,wheel
Home-page: https://whey.readthedocs.io/en/latest
Project-URL: Home Page, https://whey.readthedocs.io/en/latest
Project-URL: Documentation, https://whey.readthedocs.io/en/latest
Project-URL: Issue Tracker, https://github.com/repo-helper/whey/issues
Project-URL: Source Code, https://github.com/repo-helper/whey
Platform: Windows
Platform: macOS
Platform: Linux
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.6
Requires-Dist: django>2.1; os_name != "nt"
Requires-Dist: django>2.0; os_name == "nt"
Requires-Dist: gidgethub[httpx]>4.0.0
Requires-Dist: httpx
Description-Content-Type: text/x-rst


Spam Spam Spam Spam
44 changes: 44 additions & 0 deletions tests/test_build_/test_build_complete_COMPLETE_B_EXPRESSION_1_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
sdist_content:
- whey-2021.0.0/LICENSE
- whey-2021.0.0/PKG-INFO
- whey-2021.0.0/README.rst
- whey-2021.0.0/pyproject.toml
- whey-2021.0.0/requirements.txt
- whey-2021.0.0/whey/__init__.py
stderr: ''
stdout: 'Copying .../whey/__init__.py -> whey/__init__.py
Writing whey-2021.0.0.dist-info/LICENSE
Writing whey-2021.0.0.dist-info/entry_points.txt
Writing whey-2021.0.0.dist-info/METADATA
Writing whey-2021.0.0.dist-info/WHEEL
Writing whey-2021.0.0.dist-info/RECORD
Wheel created at .../whey-2021.0.0-py3-none-any.whl
Copying .../whey/__init__.py -> whey/__init__.py
Writing LICENSE
Copying .../pyproject.toml -> pyproject.toml
Copying .../requirements.txt -> requirements.txt
Writing README.rst
Writing PKG-INFO
Source distribution created at .../whey-2021.0.0.tar.gz
'
wheel_content:
- whey/__init__.py
- whey-2021.0.0.dist-info/LICENSE
- whey-2021.0.0.dist-info/METADATA
- whey-2021.0.0.dist-info/WHEEL
- whey-2021.0.0.dist-info/entry_points.txt
- whey-2021.0.0.dist-info/RECORD
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
whey/__init__.py,sha256=LVQwFWJ6dxQ2sw6nn9Ds2o34vNd7PVVmHK9aDW6AmIY,21
whey-2021.0.0.dist-info/LICENSE,sha256=5wizT6r_v4VTz5CuAQ2HSwrPhYUFwQypVskUSmY1reQ,20
whey-2021.0.0.dist-info/METADATA,sha256=GcB2CeihrNfxnMzS_Ml2aCgxd5B8JY77O3BGVr6BwVI,1524
whey-2021.0.0.dist-info/WHEEL,sha256=Z8ApXUcOYK5VMz9yebTyUF13KAMNT6RSnd-lLcivEVA,84
whey-2021.0.0.dist-info/entry_points.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
whey-2021.0.0.dist-info/RECORD,,
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = [ "whey",]
build-backend = "whey"

[project]
name = "Whey"
version = "2021.0.0"
description = "A simple Python wheel builder for simple projects."
readme = "README.rst"
keywords = [ "pep517", "pep621", "build", "sdist", "wheel", "packaging", "distribution",]
dynamic = []
dependencies = [ "httpx", "gidgethub[httpx]>4.0.0", "django>2.1; os_name != 'nt'", "django>2.0; os_name == 'nt'",]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
requires-python = ">=3.6"

[project.license]
file = "LICENSE"

[[project.authors]]
email = "dominic@davis-foster.co.uk"
name = "Dominic Davis-Foster"

[project.urls]
Homepage = "https://whey.readthedocs.io/en/latest"
"Home Page" = "https://whey.readthedocs.io/en/latest"
Documentation = "https://whey.readthedocs.io/en/latest"
"Issue Tracker" = "https://github.com/repo-helper/whey/issues"
"Source Code" = "https://github.com/repo-helper/whey"

[tool.whey]
base-classifiers = [ "Development Status :: 4 - Beta",]
python-versions = [ "3.6", "3.7", "3.8", "3.9", "3.10",]
python-implementations = [ "CPython", "PyPy",]
platforms = [ "Windows", "macOS", "Linux",]
license-key = "GPL-3.0+"
package = "whey"
36 changes: 36 additions & 0 deletions tests/test_build_/test_build_complete_COMPLETE_B_EXPRESSION_2_.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Metadata-Version: 2.4
Name: whey
Version: 2021.0.0
Summary: A simple Python wheel builder for simple projects.
Author-email: Dominic Davis-Foster <dominic@davis-foster.co.uk>
License-Expression: GPL-3.0+
Keywords: build,distribution,packaging,pep517,pep621,sdist,wheel
Home-page: https://whey.readthedocs.io/en/latest
Project-URL: Home Page, https://whey.readthedocs.io/en/latest
Project-URL: Documentation, https://whey.readthedocs.io/en/latest
Project-URL: Issue Tracker, https://github.com/repo-helper/whey/issues
Project-URL: Source Code, https://github.com/repo-helper/whey
Platform: Windows
Platform: macOS
Platform: Linux
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.6
Requires-Dist: django>2.1; os_name != "nt"
Requires-Dist: django>2.0; os_name == "nt"
Requires-Dist: gidgethub[httpx]>4.0.0
Requires-Dist: httpx
Description-Content-Type: text/x-rst


Spam Spam Spam Spam
Loading

0 comments on commit 4cca0ea

Please sign in to comment.