Tox: How can I add virtualenv --always-copy options?

Created on 17 Sep 2016  路  12Comments  路  Source: tox-dev/tox

type

Most helpful comment

ups - sorry, I had associated that with you for whatever reason - anyway you did other great things recently :)

Thanks to @igordcard then 馃帀

All 12 comments

Original comment by @RonnyPfannschmidt

not yet, but it should be reasonably easy to add,
i suspect its a nice item start contributing,
if you are interested, please drop by in the irc channel #pylib on freenode

Original comment by pahaz

Is this possible?

Closing this as it is very old and things have moved a lot since then.

I've bumped into this today, apparently this is needed so that the vagrant file you added can run on Windows 馃槻 we should probably reopen it to make this happen for ourselves (development purpose)

@obestwalter

vagrant@vagrant-arch vagrant]$ tox -e py27 -vv
  removing /vagrant/.tox/log
using tox.ini: /vagrant/tox.ini
using tox-2.6.0 from /home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/tox/__init__.py
GLOB start: packaging 
GLOB sdist-make: /vagrant/setup.py
  removing /vagrant/.tox/dist
  /vagrant$ /home/vagrant/.pyenv/versions/3.6.0/bin/python3.6 /vagrant/setup.py sdist --formats=zip --dist-dir /vagrant/.tox/dist >/vagrant/.tox/log/tox-0.log
GLOB finish: packaging after 1.84 seconds
copying new sdistfile to '/home/vagrant/.tox/distshare/tox-2.6.1.dev61+g2b2a51f.d20170507.zip'
py27 start: getenv /vagrant/.tox/py27
py27 create: /vagrant/.tox/py27
  removing /vagrant/.tox/py27
setting PATH=/vagrant/.tox/py27/bin:/home/vagrant/.pyenv/versions/3.6.0/bin:/home/vagrant/.pyenv/libexec:/home/vagrant/.pyenv/plugins/python-build/bin:/home/vagrant/.pyenv/plugins/pyenv-virtualenv/bin:/home/vagrant/.pyenv/plugins/pyenv-update/bin:/home/vagrant/.pyenv/plugins/pyenv-installer/bin:/home/vagrant/.pyenv/plugins/pyenv-doctor/bin:/home/vagrant/.pyenv/shims:/home/vagrant/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
  /vagrant/.tox$ /home/vagrant/.pyenv/versions/3.6.0/bin/python3.6 -m virtualenv --python /home/vagrant/.pyenv/shims/python2.7 py27 >/vagrant/.tox/py27/log/py27-0.log
ERROR: invocation failed (exit code 1), logfile: /vagrant/.tox/py27/log/py27-0.log
ERROR: actionid: py27
msg: getenv
cmdargs: ['/home/vagrant/.pyenv/versions/3.6.0/bin/python3.6', '-m', 'virtualenv', '--python', '/home/vagrant/.pyenv/shims/python2.7', 'py27']
env: {'SSH_CONNECTION': '10.0.2.2 2682 10.0.2.15 22', 'LANG': 'C', 'PYENV_ROOT': '/home/vagrant/.pyenv', 'OLDPWD': '/', 'PYENV_HOOK_PATH': '/home/vagrant/.pyenv/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks:/home/vagrant/.pyenv/plugins/pyenv-virtualenv/etc/pyenv.d:/home/vagrant/.pyenv/plugins/pyenv-which-ext/etc/pyenv.d', 'XDG_SESSION_ID': 'c3', 'USER': 'vagrant', 'PYENV_DIR': '/vagrant', 'PWD': '/vagrant', 'HOME': '/home/vagrant', 'SSH_CLIENT': '10.0.2.2 2682 22', 'PYENV_VERSION': '3.6.0:2.6.9:2.7.13:3.3.6:3.4.5:3.5.2:pypy2-5.6.0', 'SSH_TTY': '/dev/pts/0', 'MAIL': '/var/spool/mail/vagrant', 'SHELL': '/bin/bash', 'TERM': 'xterm-256color', 'SHLVL': '1', 'PYENV_SHELL': 'bash', 'LOGNAME': 'vagrant', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', 'XDG_RUNTIME_DIR': '/run/user/1000', 'PATH': '/vagrant/.tox/py27/bin:/home/vagrant/.pyenv/versions/3.6.0/bin:/home/vagrant/.pyenv/libexec:/home/vagrant/.pyenv/plugins/python-build/bin:/home/vagrant/.pyenv/plugins/pyenv-virtualenv/bin:/home/vagrant/.pyenv/plugins/pyenv-update/bin:/home/vagrant/.pyenv/plugins/pyenv-installer/bin:/home/vagrant/.pyenv/plugins/pyenv-doctor/bin:/home/vagrant/.pyenv/shims:/home/vagrant/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl', 'PYTHONHASHSEED': '4276403710', 'VIRTUAL_ENV': '/vagrant/.tox/py27'}

New python executable in /vagrant/.tox/py27/bin/python2.7
Also creating executable in /vagrant/.tox/py27/bin/python
Traceback (most recent call last):
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
    main()
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 1370, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 71] Protocol error
Running virtualenv with interpreter /home/vagrant/.pyenv/shims/python2.7

ERROR: InvocationError: /home/vagrant/.pyenv/versions/3.6.0/bin/python3.6 -m virtualenv --python /home/vagrant/.pyenv/shims/python2.7 py27 (see /vagrant/.tox/py27/log/py27-0.log)

The need of this always copy is optional on the invoking environment, so this should be either a tox cli argument, or taken from the env; what do you guys think?

[vagrant@vagrant-arch vagrant]$ /home/vagrant/.pyenv/versions/3.6.0/bin/python3.6 -m virtualenv --python /home/vagrant/.pyenv/shims/python2.7  py27  
Running virtualenv with interpreter /home/vagrant/.pyenv/shims/python2.7
New python executable in /vagrant/py27/bin/python2.7
Also creating executable in /vagrant/py27/bin/python
Traceback (most recent call last):
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
    main()
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/home/vagrant/.pyenv/versions/3.6.0/lib/python3.6/site-packages/virtualenv.py", line 1370, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 71] Protocol error
[vagrant@vagrant-arch vagrant]$ /home/vagrant/.pyenv/versions/3.6.0/bin/python3.6 -m virtualenv --python /home/vagrant/.pyenv/shims/python2.7  py27 --always-copy
Running virtualenv with interpreter /home/vagrant/.pyenv/shims/python2.7
New python executable in /vagrant/py27/bin/python2.7
Also creating executable in /vagrant/py27/bin/python
Installing setuptools, pip, wheel...done.
[vagrant@vagrant-arch vagrant]$ 

@gaborbernat thanks for trying this. Let's reopen this then.

I have no opinion about from where to fetch it yet. Is there some "prior art" in the code, where we could take inspiration from for this kind of problem?

just realized that @asottile added this already as a cli arg for 2.6, so I guess we can close this as resolved?

http://tox.readthedocs.io/en/latest/example/basic.html?highlight=alwayscopy#prevent-symbolic-links-in-virtualenv

heh, I don't want to take credit for something I didn't do, here's the changeset thanks to @igordcard

https://github.com/tox-dev/tox/pull/434

ups - sorry, I had associated that with you for whatever reason - anyway you did other great things recently :)

Thanks to @igordcard then 馃帀

yeah, it works via that :+1:

fixed since 2.6 - see http://tox.readthedocs.io/en/latest/config.html?highlight=alwayscopy#confval-alwayscopy=True|False

Use the flag fo systems that need it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

obestwalter picture obestwalter  路  5Comments

obestwalter picture obestwalter  路  3Comments

pytoxbot picture pytoxbot  路  5Comments

gaborbernat picture gaborbernat  路  3Comments

ssbarnea picture ssbarnea  路  5Comments