Skip to content

Commit

Permalink
Declare the dependencies and update vendoring routine for setuptools …
Browse files Browse the repository at this point in the history
…(only) to simply install the dependencies to the _vendor folder.
  • Loading branch information
jaraco committed Jul 3, 2024
1 parent 3accd5c commit 62bd80f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 26 deletions.
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ classifiers = [
]
keywords = ["CPAN PyPI distutils eggs package management"]
requires-python = ">=3.8"
dependencies = []
dependencies = [
"packaging>=24",
"ordered-set>=3.1.1",
"more_itertools>=8.8",
"jaraco.text>=3.7",
"importlib_resources>=5.10.2",
"importlib_metadata>=6",
"tomli>=2.0.1",
"wheel>=0.43.0",
]

[project.urls]
Source = "https://github.com/pypa/setuptools"
Expand Down
12 changes: 0 additions & 12 deletions setuptools/_vendor/vendored.txt

This file was deleted.

5 changes: 4 additions & 1 deletion setuptools/extern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ def install(self):
# cog.outl(f"names = (\n{names}\n)")
# ]]]
names = (
'backports',
'autocommand',
'importlib_metadata',
'importlib_resources',
'inflect',
'jaraco',
'more_itertools',
'ordered_set',
'packaging',
'tomli',
'typeguard',
'typing_extensions',
'wheel',
'zipp',
)
Expand Down
43 changes: 31 additions & 12 deletions tools/vendored.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import subprocess
from textwrap import dedent

from jaraco.packaging import metadata
from path import Path


Expand All @@ -13,7 +14,7 @@ def remove_all(paths):


def update_vendored():
update_pkg_resources()
# update_pkg_resources()
update_setuptools()


Expand Down Expand Up @@ -207,19 +208,37 @@ def update_pkg_resources():
rewrite_platformdirs(vendor / "platformdirs")


def load_deps():
"""
Read the dependencies from `.`.
"""
return metadata.load('.').get_all('Requires-Dist')


def install_deps(deps, vendor):
"""
Install the deps to vendor.
"""
install_args = [
sys.executable,
'-m',
'pip',
'install',
'--target',
str(vendor),
'--python-version',
'3.8',
'--only-binary',
':all:',
] + list(deps)
subprocess.check_call(install_args)


def update_setuptools():
vendor = Path('setuptools/_vendor')
install(vendor)
rewrite_packaging(vendor / 'packaging', 'setuptools.extern')
repair_namespace(vendor / 'jaraco')
repair_namespace(vendor / 'backports')
rewrite_jaraco_text(vendor / 'jaraco/text', 'setuptools.extern')
rewrite_jaraco_functools(vendor / 'jaraco/functools', 'setuptools.extern')
rewrite_jaraco_context(vendor / 'jaraco', 'setuptools.extern')
rewrite_importlib_resources(vendor / 'importlib_resources', 'setuptools.extern')
rewrite_importlib_metadata(vendor / 'importlib_metadata', 'setuptools.extern')
rewrite_more_itertools(vendor / "more_itertools")
rewrite_wheel(vendor / "wheel")
deps = load_deps()
clean(vendor)
install_deps(deps, vendor)


def yield_top_level(name):
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ allowlist_externals = git, sh
deps =
path
cogapp
jaraco.packaging
# workaround for pypa/pyproject-hooks#192
pyproject-hooks<1.1
commands =
vendor: python -m tools.vendored
sh -c "git grep -l -F '\[\[\[cog' | xargs -t cog -I {toxinidir} -r" # update `*.extern`
Expand Down

0 comments on commit 62bd80f

Please sign in to comment.