Make tox -e generate easier to use
- auto detect python paths (which) - make it possible to call `tox -e generate` w/o extra args - update list of pythons to include currently supported versions Change-Id: Ib727242c1aba8597389259d8dbacba7194f9f0d6
This commit is contained in:
parent
269a7bc5ff
commit
ecf18825ab
@ -15,6 +15,7 @@ import copy
|
||||
import hashlib
|
||||
import optparse
|
||||
import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
@ -155,7 +156,7 @@ def _validate_options(options):
|
||||
if not options.pythons:
|
||||
raise Exception("No Pythons given - see -p.")
|
||||
for python in options.pythons:
|
||||
if not os.path.exists(python):
|
||||
if not shutil.which(python):
|
||||
raise Exception(
|
||||
"Python %(python)s not found." % dict(python=python))
|
||||
if not options.requirements:
|
||||
@ -227,6 +228,8 @@ def main(argv=None, stdout=None):
|
||||
_freeze(options.requirements, python) for python in options.pythons]
|
||||
_clone_versions(freezes, options)
|
||||
blacklist = _parse_blacklist(options.blacklist)
|
||||
frozen = sorted(_combine_freezes(freezes, blacklist), key=_make_sort_key)
|
||||
frozen = [
|
||||
"# generated using: tox -e generate\n",
|
||||
*sorted(_combine_freezes(freezes, blacklist), key=_make_sort_key)]
|
||||
stdout.writelines(frozen)
|
||||
stdout.flush()
|
||||
|
4
tox.ini
4
tox.ini
@ -30,10 +30,11 @@ commands = {posargs}
|
||||
commands = update-requirements {posargs}
|
||||
|
||||
[testenv:generate]
|
||||
description = Regenerates upper-constraints.txt
|
||||
# Generate needs an unconstrained install to get new dependencies
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = generate-constraints {posargs}
|
||||
commands = generate-constraints {posargs: -b blacklist.txt -r global-requirements.txt -p python3.6 -p python3.7 -p python3.8 -p python3.9 > upper-constraints.txt}
|
||||
|
||||
[testenv:validate]
|
||||
commands =
|
||||
@ -49,6 +50,7 @@ whitelist_externals = {[testenv:linters]whitelist_externals}
|
||||
commands = {[testenv:linters]commands}
|
||||
|
||||
[testenv:linters]
|
||||
description = Perform linting
|
||||
deps =
|
||||
hacking>=1.0.0
|
||||
bashate>=0.5.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user