Skip to content

Commit d72a43f

Browse files
committed
migrate to parser based on hatchling's
- back away from vendoring - adapt hatchling's license expression parser to accept well-formed LicenseRef- - back to python storage of license data
1 parent fd1d83b commit d72a43f

26 files changed

+982
-34695
lines changed

.pre-commit-config.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ repos:
55
- id: check-toml
66
- id: check-yaml
77
- id: end-of-file-fixer
8-
exclude: '^src/packaging/_vendor'
98
- id: trailing-whitespace
10-
exclude: '^src/packaging/_vendor'
119

1210
- repo: https://github.com/pre-commit/mirrors-mypy
1311
rev: v0.991
1412
hooks:
1513
- id: mypy
16-
exclude: '^(docs|tasks|tests)|setup\.py|^src/packaging/_vendor'
14+
exclude: '^(docs|tasks|tests)|setup\.py'
1715
args: []
1816
additional_dependencies: [pyparsing, nox]
1917

noxfile.py

+3-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# mypy: disallow-untyped-defs=False, disallow-untyped-calls=False
22

3-
import argparse
43
import contextlib
54
import datetime
65
import difflib
@@ -182,32 +181,10 @@ def release(session):
182181
webbrowser.open("https://github.com/pypa/packaging/releases")
183182

184183

185-
# NOTE: This session will COMMIT upgrades to vendored libraries.
186-
# You should therefore not run it directly against `main`. If you
187-
# do (assuming you started with a clean main), you can run:
188-
#
189-
# git checkout -b vendoring-updates
190-
# git checkout main
191-
# git reset --hard origin/main
192184
@nox.session
193-
def vendoring(session: nox.Session) -> None:
194-
# Ensure that the session Python is running 3.10+
195-
# so that truststore can be installed correctly.
196-
session.run(
197-
"python", "-c", "import sys; sys.exit(1 if sys.version_info < (3, 10) else 0)"
198-
)
199-
200-
parser = argparse.ArgumentParser(prog="nox -s vendoring")
201-
parser.add_argument("--upgrade-all", action="store_true")
202-
parser.add_argument("--upgrade", action="append", default=[])
203-
parser.add_argument("--skip", action="append", default=[])
204-
args = parser.parse_args(session.posargs)
205-
206-
session.install("vendoring~=1.2.0")
207-
208-
if not (args.upgrade or args.upgrade_all):
209-
session.run("vendoring", "sync", "-v")
210-
return
185+
def update_licenses(session: nox.Session) -> None:
186+
session.install("httpx")
187+
session.run("python", "tasks/licenses.py")
211188

212189

213190
# -----------------------------------------------------------------------------

pyproject.toml

+2-26
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,11 @@ Source = "https://github.com/pypa/packaging"
3737

3838
[tool.flit.sdist]
3939
include = ["LICENSE*", "tests/", "docs/", "CHANGELOG.rst"]
40-
exclude = ["docs/_build", "tests/manylinux/build-hello-world.sh", "tests/musllinux/build.sh", "tests/hello-world.c", "tests/__pycache__", "build/__pycache__", "src/packaging/_vendor/license_expression/data/*"]
41-
42-
[tool.pytest.ini_options]
43-
addopts = [
44-
"--ignore=src/packaging/_vendor"
45-
]
40+
exclude = ["docs/_build", "tests/manylinux/build-hello-world.sh", "tests/musllinux/build.sh", "tests/hello-world.c", "tests/__pycache__", "build/__pycache__"]
4641

4742

4843
[tool.coverage.run]
4944
branch = true
50-
omit = [
51-
"*/_vendor/*"
52-
]
5345

5446
[tool.coverage.report]
5547
exclude_lines = ["pragma: no cover", "@abc.abstractmethod", "@abc.abstractproperty"]
@@ -65,21 +57,12 @@ warn_unused_ignores = true
6557
module = ["_manylinux"]
6658
ignore_missing_imports = true
6759

68-
[[tool.mypy.overrides]]
69-
module = ["packaging._vendor.*"]
70-
ignore_errors = true
71-
follow_imports = "skip"
72-
ignore_missing_imports = true
73-
7460
[tool.ruff]
7561
src = ["src"]
7662
extend-exclude = [
77-
"_vendor"
63+
"src/packaging/licenses/spdx.py"
7864
]
7965

80-
[tool.ruff.lint.isort]
81-
known-third-party = ["packaging._vendor"]
82-
8366
[tool.ruff.lint]
8467
extend-select = [
8568
"B",
@@ -114,10 +97,3 @@ ignore = [
11497
"ISC001",
11598
"ISC002",
11699
]
117-
118-
[tool.vendoring]
119-
destination = "src/packaging/_vendor/"
120-
requirements = "src/packaging/_vendor/vendor.txt"
121-
namespace = "packaging._vendor"
122-
123-
protected-files = ["__init__.py", "README.rst", "vendor.txt"]

src/packaging/_spdx.json

-1
This file was deleted.

src/packaging/_vendor/__init__.py

Whitespace-only changes.

src/packaging/_vendor/boolean.py.LICENSE.txt

-23
This file was deleted.

src/packaging/_vendor/boolean.pyi

-1
This file was deleted.

src/packaging/_vendor/boolean/__init__.py

-30
This file was deleted.

0 commit comments

Comments
 (0)