Issues

Issue #114 new

win32: specify python.exe locations

Adam Groszer
created an issue

Any chance to have a place to specify pyhon.exe locations? The problem is that not everyone can/will use the r"c:\python\d.\d\python.exe" location. E.g. on winbot.zope.org I need 32 and 64 bit pythons beside each other. I'd vote for a global tox.ini where one could define something.

Comments (16)

  1. Adam Groszer reporter

    Found the PR. I'm OK with an ENV variable too. Whatever makes it work. Guessing just won't work for everyone.

    re globs: be prepared for exotic locations ;-)

  2. Anthon van der Neut

    Adam Groszer : Below is what holger krekel wrote this morning. I will probably be able to implement this based on his wishes, both commandline and environment var. Most time consuming will be writing the tests, although I am getting better at that... I will let you know when I have something that is testable.

    Original message:

    I don't want to get into the business of putting things in $HOME with tox right now. In fact, tox-1.6 now sets a pseudo-HOME during installing dependencies. In the long run, i'd like to move tox.ini to support specifying python versions instead of doing things based on names and "basepython" settings. I.e. set a python_version = >2.5,<2.6, and then tox will find a good match based on looking at all available interpreters. note that tox-1.6 already has new code in tox/interpreters.py which queries all specified python versions at configuration time. Creating a map from version->executable should be straight forward. What remains is the question of how to discover interpreters. I think we could - in conjunction with the above idea - start with an option "--interpreter-globs" which which is a shlex.split()-able list of globs-patterns so in your case "/opt/python/*/bin/python?.?" to discover all pythons. We can also have a TOX_INTERPRETER_GLOBS env var which is read in as well, and can be set from $HOME/.bashrc.

  3. Adam Groszer reporter

    Some salt for your tests. Please be prepared on windows for such locations:

    • c:\python2.7
    • c:\python27_32
    • c:\python2.7_32
    • c:\python2.7.3_32
    • c:\a dir with spaces\python2.7

    and such variatons.

    The problem is that you can install python.exe practically anywhere. Where linux has a well established standard of python\d.\d, the same is a pain on windows.

  4. Anthon van der Neut

    Adam Groszer I just uploaded a PR for the changes to allow --interpreter-globs and/or TOX_INTERPRETER_GLOBS. https://bitbucket.org/hpk42/tox/pull-request/69/interpreter-globs-extensions-for-option/diff. I am not sure if you are willing to try this out before holger krekel integrates this in release, but if you do, you can find the source here: https://bitbucket.org/anthon_van_der_neut/tox_interpreter-globs and of course I can help assist if there are any problems.

    I tested this on my Virtual Machine based Windows where Python 2.7 is installed under C:\Program Files\Python27\ (so spaces work) if your 32 and 64 bit versions have some regularity in the naming then the globbing should be able to find you all the 64bit or all the 32bits at a time.

  5. Anthon van der Neut

    Christian Heimes: Reading the registry is an interesting additional possibility, but those entries are not necessary to run Python. And they don't need to be there (they are in fact not always there, as I can see on one of my windows installations). Relying on them is IMHO in the same league as relying on python being in C:\pythonX.Y : useful for most cases but not for all.

  6. Marius Gedminas

    AFAICS all you need is the ability to use two config files instead of one: - one system-specific, to specify the basepython setting for all the [testenv:pyXY] sections, and - one project-specific to specify the dependencies and commands

    I was going to say that ConfigParser supports multiple config files seamlessly, but then did a quick grep and I see tox uses py.iniconfig instead, about which I know nothing.

  7. Anthon van der Neut

    Holger, I can get it back into mergable shape once more if you want, it would be nice if it then gets merged as I already did that once. I have used my fork for myself for the longest time but then wanted to use some new tox feature a month some three months ago, and now use an alias for tox (that gets the right micro version where I have multiple major.minor versions installed), on Linux, where this is easy. On windows it is a pain, via the registry only one micro (the last one installed) can be found. I really need to be able to test 2.7.3, 2.7.6 and 2.7.9 as I the older two micro versions are installed at some customers and I am not in the position to upgrade. I have given some thought about a wrapper for tox that handles this as I currently have multiple (memory gobbling) windows VMs, but I much rather spent the time whipping this PR in shape.

  8. holger krekel repo owner

    Anthon van der Neut thanks for your efforts. I'd appreciate if you bring the PR back into shape. One issue we need to solve on top is how to specify interpreter versions from the environments, for example basepython = python==2.7.6, basepython = pypy>=2.3.0,<2.4, reusing setuptools/pip requirements syntax.

  9. holger krekel repo owner

    Also, i would expect tox to find all python interpreters automatically that are reachable through $PATH (and ideally the windows registry). We might also need to cache version info if it turns out calling all of the interpreters at tox startup takes too long.

  10. Log in to comment