Use tox with --print-deps-to-file instead of parsing stdout

This commit is contained in:
Miro Hrončok 2019-08-12 17:29:26 +02:00
parent ec073171f3
commit 7ba1a33967
2 changed files with 11 additions and 11 deletions

View File

@ -8,6 +8,7 @@ from io import StringIO
import subprocess
import pathlib
import re
import tempfile
import email.parser
print_err = functools.partial(print, file=sys.stderr)
@ -175,16 +176,15 @@ def generate_run_requirements(backend, requirements):
def generate_tox_requirements(toxenv, requirements):
requirements.extend(['tox-current-env'], source='tox itself')
tox_output = subprocess.run(
['tox', '--print-deps-only', '-qre', toxenv],
encoding='utf-8',
stdout=subprocess.PIPE,
check=True,
).stdout
lines = tox_output.splitlines()
summary = lines.index(35 * '_' + ' summary ' + 36 * '_')
requirements.extend(lines[:summary], source=f'tox --print-deps-only: {toxenv}')
requirements.extend(['tox-current-env >= 0.0.2'], source='tox itself')
with tempfile.NamedTemporaryFile('r') as depfile:
with hook_call():
subprocess.run(
['tox', '--print-deps-to-file', depfile.name, '-qre', toxenv],
check=True,
)
requirements.extend(depfile.read().splitlines(),
source=f'tox --print-deps-only: {toxenv}')
def python3dist(name, op=None, version=None):

View File

@ -278,7 +278,7 @@ Tox depndencies:
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env)
python3dist(tox-current-env) >= 0.0.2
python3dist(toxdep1)
python3dist(toxdep2)
python3dist(inst)