41153f0653
Tox 4 released today and is a complete rewrite with many backward incompatible changes. We need to update a number of things to support that in the zuul-jobs tox role and elsewhere. A possibly incomplete list of what was changed in this commit to make this work: * Don't run tox --showconfig with {{ tox_extra_args }} as -vv is in tox_extra_args by default and results in interleaved debug output in the ini output making it invalid ini content. * Update the tox siblings tox config parser to look for renamed environment dir locations. * Stop using whitelist_externals and use allowlist_exteranls because whitelist_externals is removed and external commands that are not explicitly allowed produce errors. * Make the tox version configurable in ensure-tox as some users may not be able to easily upgrade to tox v4. * Escape literal # chars in tox.ini as they are treated as comments when in the command strings now. https://github.com/tox-dev/tox/issues/2617 Change-Id: I38e13b4f13bb1b2d6fb7e5c70b708e9bb016a455
52 lines
1.7 KiB
ReStructuredText
52 lines
1.7 KiB
ReStructuredText
Ensure tox is installed
|
|
|
|
Look for ``tox``, and if not found, install it via ``pip`` into a
|
|
virtual environment for the current user.
|
|
|
|
**Role Variables**
|
|
|
|
.. zuul:rolevar:: ensure_tox_version
|
|
:default: '<4'
|
|
|
|
Version specifier to select the version of tox. For example if your
|
|
project is not compatible with tox v4 you can set this value to
|
|
`<4` to install the latest v3 release. We have started this value
|
|
at `<4` for maximum compatibility, but expect it to change to ''
|
|
in the future when tox v4 is better understood.
|
|
|
|
.. zuul:rolevar:: tox_prefer_python2
|
|
:default: False
|
|
|
|
If tox is not detected, prefer to install tox inside Python 2
|
|
instead of Python 3.
|
|
|
|
If set,
|
|
:zuul:rolevar:`ensure-pip.ensure_pip_from_packages_with_python2`
|
|
will be automatically set to `True` to enable a Python 2
|
|
installation of `pip`.
|
|
|
|
.. zuul:rolevar:: ensure_global_symlinks
|
|
:default: False
|
|
|
|
Install a symlink to the tox executable into ``/usr/local/bin/tox``.
|
|
This can be useful when scripts need to be run that expect to find
|
|
tox in a more standard location and plumbing through the value
|
|
of ``tox_executable`` would be onerous.
|
|
|
|
Setting this requires root access, so should only be done in
|
|
circumstances where root access is available.
|
|
|
|
**Output Variables**
|
|
|
|
.. zuul:rolevar:: tox_executable
|
|
:default: tox
|
|
|
|
After running this role, ``tox_executable`` will be set as the path
|
|
to a valid ``tox``.
|
|
|
|
At role runtime, look for an existing ``tox`` at this specific
|
|
path. Note the default (``tox``) effectively means to find tox in
|
|
the current ``$PATH``. For example, if your base image
|
|
pre-installs tox in an out-of-path environment, set this so the
|
|
role does not attempt to install the user version.
|