Use tox with --print-deps-to-file instead of parsing stdout
This commit is contained in:
parent
ec073171f3
commit
7ba1a33967
@ -8,6 +8,7 @@ from io import StringIO
|
|||||||
import subprocess
|
import subprocess
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
|
import tempfile
|
||||||
import email.parser
|
import email.parser
|
||||||
|
|
||||||
print_err = functools.partial(print, file=sys.stderr)
|
print_err = functools.partial(print, file=sys.stderr)
|
||||||
@ -175,16 +176,15 @@ def generate_run_requirements(backend, requirements):
|
|||||||
|
|
||||||
|
|
||||||
def generate_tox_requirements(toxenv, requirements):
|
def generate_tox_requirements(toxenv, requirements):
|
||||||
requirements.extend(['tox-current-env'], source='tox itself')
|
requirements.extend(['tox-current-env >= 0.0.2'], source='tox itself')
|
||||||
tox_output = subprocess.run(
|
with tempfile.NamedTemporaryFile('r') as depfile:
|
||||||
['tox', '--print-deps-only', '-qre', toxenv],
|
with hook_call():
|
||||||
encoding='utf-8',
|
subprocess.run(
|
||||||
stdout=subprocess.PIPE,
|
['tox', '--print-deps-to-file', depfile.name, '-qre', toxenv],
|
||||||
check=True,
|
check=True,
|
||||||
).stdout
|
)
|
||||||
lines = tox_output.splitlines()
|
requirements.extend(depfile.read().splitlines(),
|
||||||
summary = lines.index(35 * '_' + ' summary ' + 36 * '_')
|
source=f'tox --print-deps-only: {toxenv}')
|
||||||
requirements.extend(lines[:summary], source=f'tox --print-deps-only: {toxenv}')
|
|
||||||
|
|
||||||
|
|
||||||
def python3dist(name, op=None, version=None):
|
def python3dist(name, op=None, version=None):
|
||||||
|
@ -278,7 +278,7 @@ Tox depndencies:
|
|||||||
python3dist(setuptools) >= 40.8
|
python3dist(setuptools) >= 40.8
|
||||||
python3dist(wheel)
|
python3dist(wheel)
|
||||||
python3dist(wheel)
|
python3dist(wheel)
|
||||||
python3dist(tox-current-env)
|
python3dist(tox-current-env) >= 0.0.2
|
||||||
python3dist(toxdep1)
|
python3dist(toxdep1)
|
||||||
python3dist(toxdep2)
|
python3dist(toxdep2)
|
||||||
python3dist(inst)
|
python3dist(inst)
|
||||||
|
Loading…
Reference in New Issue
Block a user