Skip to content

Commit 1377638

Browse files
committed
Fixing the pipmain issue in a backwards compatible manner.
1 parent 083f6c5 commit 1377638

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

run.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
except ImportError:
77
from pip._internal import main as pipmain
88

9+
# More pip changes breaking us.
10+
main_fn = pipmain
11+
if hasattr(pipmain, 'main'):
12+
main_fn = pipmain.main
13+
914
DEFAULT_LOGGER = 'rlbot'
1015

1116
if __name__ == '__main__':
@@ -18,15 +23,15 @@
1823
logger.log(logging_utils.logging_level,
1924
'Skipping upgrade check for now since it looks like you have no internet')
2025
elif public_utils.is_safe_to_upgrade():
21-
pipmain.main(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
26+
main_fn(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
2227

2328
# https://stackoverflow.com/a/44401013
2429
rlbots = [module for module in sys.modules if module.startswith('rlbot')]
2530
for rlbot_module in rlbots:
2631
sys.modules.pop(rlbot_module)
2732

2833
except ImportError:
29-
pipmain.main(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
34+
main_fn(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
3035

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

0 commit comments

Comments
 (0)