Skip to content

Commit b5b2b1f

Browse files
committed
Call pip with the subprocess module.
1 parent 1377638 commit b5b2b1f

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

run.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1+
import subprocess
12
import sys
23

3-
# https://stackoverflow.com/a/51704613
4-
try:
5-
from pip import main as pipmain
6-
except ImportError:
7-
from pip._internal import main as pipmain
8-
9-
# More pip changes breaking us.
10-
main_fn = pipmain
11-
if hasattr(pipmain, 'main'):
12-
main_fn = pipmain.main
13-
144
DEFAULT_LOGGER = 'rlbot'
155

166
if __name__ == '__main__':
@@ -23,15 +13,15 @@
2313
logger.log(logging_utils.logging_level,
2414
'Skipping upgrade check for now since it looks like you have no internet')
2515
elif public_utils.is_safe_to_upgrade():
26-
main_fn(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
16+
subprocess.call([sys.executable, "-m", "pip", "install", '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
2717

2818
# https://stackoverflow.com/a/44401013
2919
rlbots = [module for module in sys.modules if module.startswith('rlbot')]
3020
for rlbot_module in rlbots:
3121
sys.modules.pop(rlbot_module)
3222

3323
except ImportError:
34-
main_fn(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
24+
subprocess.call([sys.executable, "-m", "pip", "install", '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
3525

3626
try:
3727
if len(sys.argv) > 1 and sys.argv[1] == 'gui':

0 commit comments

Comments
 (0)