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.
Ps Doing something like this doesn't work:
install_command = https_proxy=<proxy_url> pip install {opts} {packages}
Pss The pip --proxy option doesn't help too, since it sets the http_proxy only.
Beforehand thanks!
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.