tools: Call pip from a sub-process instead of importing it
The pip documentation recommends calling pip using a subprocess, instead of importing it and using it's internal API. The API of pip==10.0.0 is different from that of older versions, and provisioning is broken with this version. [pip docs]: https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program Closes #370
This commit is contained in:
parent
55aff6f64b
commit
3c53c36c21
|
@ -6,7 +6,7 @@ from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
import glob
|
||||||
import pip
|
import subprocess
|
||||||
if False:
|
if False:
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
|
@ -105,4 +105,5 @@ bots_subdirs = map(lambda d: os.path.abspath(d), glob.glob(bots_dir + '/*'))
|
||||||
bot_paths = filter(lambda d: os.path.isdir(d), bots_subdirs)
|
bot_paths = filter(lambda d: os.path.isdir(d), bots_subdirs)
|
||||||
for bot_path in bot_paths:
|
for bot_path in bot_paths:
|
||||||
req_path = os.path.join(bot_path, 'requirements.txt')
|
req_path = os.path.join(bot_path, 'requirements.txt')
|
||||||
rcode = pip.main(['install', '-r', req_path, '--quiet'])
|
if os.path.exists(req_path):
|
||||||
|
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', req_path, '--quiet'])
|
||||||
|
|
Loading…
Reference in a new issue