Skip to content

Commit

Permalink
Use improve custom vendoring logic for validate-pyproject
Browse files Browse the repository at this point in the history
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
  • Loading branch information
abravalheri and webknjaz committed Feb 9, 2022
1 parent f6bea44 commit e2b4e3a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setuptools/_vendor/_validate_pyproject/NOTICE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The code contained in this directory was automatically generated using the
following command:

python -m validate_pyproject.vendoring --output-dir setuptools/_vendor/_validate_pyproject --enable-plugins setuptools distutils --very-verbose
python -m validate_pyproject.vendoring --output-dir=setuptools/_vendor/_validate_pyproject --enable-plugins setuptools distutils --very-verbose

Please avoid changing it manually.

Expand Down
2 changes: 1 addition & 1 deletion setuptools/extern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ def install(self):

names = (
'packaging', 'pyparsing', 'ordered_set', 'more_itertools', 'importlib_metadata',
'zipp', 'importlib_resources', 'jaraco', 'tomli', '_validate_pyproject'
'zipp', 'importlib_resources', 'jaraco', 'tomli', '_validate_pyproject',
)
VendorImporter(__name__, names, 'setuptools._vendor').install()
13 changes: 6 additions & 7 deletions tools/vendored.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import re
import sys
import shutil
import string
import subprocess
import venv
Expand Down Expand Up @@ -145,16 +143,17 @@ def install_validate_pyproject(vendor):
opts["ignore_cleanup_errors"] = True

with TemporaryDirectory(**opts) as tmp:
venv.create(tmp, with_pip=True)
path = os.pathsep.join(Path(tmp).glob("*"))
venv_python = shutil.which("python", path=path)
env_builder = venv.EnvBuilder(with_pip=True)
env_builder.create(tmp)
context = env_builder.ensure_directories(tmp)
venv_python = getattr(context, 'env_exec_cmd', context.env_exe)

subprocess.check_call([venv_python, "-m", "pip", "install", pkg])
cmd = [
venv_python,
"-m",
"validate_pyproject.vendoring",
"--output-dir",
str(vendor / "_validate_pyproject"),
f"--output-dir={vendor / '_validate_pyproject' !s}",
"--enable-plugins",
"setuptools",
"distutils",
Expand Down

0 comments on commit e2b4e3a

Please sign in to comment.