Package: tox-globinterpreter
Usage:tox--scanshows previously found name to executable path mappings.tox--scanPATTERN1 PATTERN2searches the patterns for python executables
and stores paths found in that way for future use bytoxThis allows you to easily specify multiple python executables fortoxto
use. Without the need for permanently or temporarily adding their paths to
your$PATH, which does
have unacceptable side effects in all cases, except for direct commandline
invocation oftoxvia an alias (as you can guess not my typical usage).On Windows the executables can be found via the registry. Therefore specifying
PATTERNS to find executables is unnecessary and relatively cumbersome.tox--scanregistrywill scan the registry for executable paths and
add provide these for future runs. This finally allows it to runtoxon
windows without the need to clutterC:\with python installs.InstallationSince tox 2.0 the plugin mechanism based onpluggyis included intox.
You can just do:pip install tox_globinterpreterIf you installpytest(pip install pytest) to test this module
itself, and you use the bash shell, make sure you rehash bash (hash-ror
re-activate the virtual environment.Default tox interpreter finding behaviourNon-Windowstoxsearches through the$PATHspecified paths for python executables
(ToDo: check).For many Linux distributions the system python (and more recently pythons, as
both 2.7.x and 3.4.X are used by system utilities as Linux distributions
slowly moves to Python3) cannot be replaced by a newer micro version without
a lot of hassle. These newer micro versions should be installed in some
“other” directory e.g./opt/python/2.7.9. Itsbindirectory cannot
be added to the normal PATH during startup as this will break some
system programs relying on the older python micro version (and its additionally
installed libraries).This directory can temporarily be added to each invocation oftoxby
making an alias fortox, but that doesn’t work iftoxis called from
a Makefile. And aliasingmaketo include that path can break invocations
of system utilities from the same Makefile.WindowsOn Windowstoxlooks for installations inC:\\python?.?and
determines the version based on the directory name (ToDo: check).This doesn’t work when you have the python interpreters installed in the non
default location, e.g. necessary when you want 64 and 32 bit versions
installed, or when you have them installed under the more correctC:\ProgramFiles\or similar directory.tox_globinterpreter plugin extensionsNon-Windowstox_globinterpreteradds one commandline option totox:--scan.
If invoked with arguments, these arguments should be a pattern, or list of
patterns that will beglobb-ed andshlex-ed to form a mapping
of base names to paths to python binaries that is then stored globally
per user for future
usage (under $XDG_CONFIG_HOME/tox, defaulting to ~/.config/tox).
E.g.:tox --scan '/opt/python/2.?/bin/python?.?' ../../../opt/python/pypy*/bin/pypy(please note that only the second argument is not expanded by the shell, the
first is quoted and expanded bytox_globinterpreter).Iftox--scanis invoked without arguments, then the currently
stored mapping (base name to executable)is printed out. E.g.:python2.7 /opt/python/2.7/bin/python2.7
pypy /opt/python/pypy-2.5.0/bin/pypy(if the same base name is found multiple times, thefirstone in the list
is used).If the environment variableTOX_INTERPRETER_GLOBSis set this
will cause the python binaries to be searched for using the patterns
specified by that environment variable (expanded and searched every time).IfTOX_INTERPRETER_GLOBSis set it prevents the use of the–scan-ned
list, and either of them is set, the normal search through PATH is not
done.During--scan-ning the base name (py27) to be used in theenvlistintox.ini, is determined based on the name of the binary if this
includes a version number (python2.7). if the binary equalspythonthe base name (including version) is determined by invoking the interpreter.
When expandingTOX_INTERPRETER_GLOBS, this invocation to determine
version information is currently considered too expensive.Windowstox_globinterpreteradds commandline options totox, the
primary one of which is:--scan.On windows you should specify--scanc:/python/*/python.exec:/pypy*/*/*/pyp.exefirst to create a
mapping of base names to paths. This doesn’t get them from the registry
as the registry is incomplete (only one of both 64 and 32 bit version
of a particular CPython is registered, pypy is not registered at all).Iftox--scanis invoked without arguments, then the currently
stored mapping is printed out. E.g.:python2.7 c:\python\2.7\python2.7.exe
python2.7 c:\python\2.7-32\python2.7.exeIf you have 64 and 32 bit versions installed select the-32version by
doing:tox -r --32(This might be supported intoxitself at some point, currently you cannot
specifypy27-32as the32part is never handed totox_get_python_executable)HistoryI originally implemented the possibility to specify the list of interpreters
as a patch fortoxfor which I put in a PR that lingered for two years
(with repeated updates) until I was asked to update it (once more, but this
time by the author of tox). Shortly after the plugin interface was provided
and this plugin fortoxreplaces the earlier PR requeststox.