I need to setup https proxy for the pip install command within tox environment.

Currenly, I have something like this:

...
[toxenv:test]
install_command = pip install {opts} {packages}
commands = 
    <command1>
    <command2>
...

If I use just pip command, like:

pip install <package>

I will get into error, because I am behind the proxy.

So I do something like this and it work like a sharm:

https_proxy=<proxy_url> pip install <package>

But, the problem is that I need proxy to be setup only for pip install command, and for other commands (command1, command2, ...) https_proxy should be unset.

So the question is how to setup https_proxy for pip install command only in tox and make it not set for all other commands.

P.s. Doing something like this doesn't work:

install_command = https_proxy=<proxy_url> pip install {opts} {packages}

P.s.s. The pip --proxy option doesn't help too, since it sets the http_proxy only.

Beforehand thanks!

share|improve this question
up vote 3 down vote accepted

you can set env variable in tox sessions, and wraps your pip command in a script

proxy_pip.sh

#!/bin/bash
https_proxy=$my_https_proxy http_proxy=$http_proxy pip $@

tos.ini

[testenv]
setenv =    
   my_http_proxy = <proxy_url>
   my_https_proxy = <proxy_url>
install_command = proxy_pip.sh install {opts} {packages}
commands = 
    <command1>
    <command2>
share|improve this answer
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Peter Foti Dec 11 '14 at 14:21
    
updated my answer, should be better – sax Dec 11 '14 at 14:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.