Skip to content

Commit

Permalink
Update Command Line Tool's pip if it's older then version 22
Browse files Browse the repository at this point in the history
pip 21 is new enough to download the appropriate wheel file instead of build
it from source, Apple provides 20
  • Loading branch information
xxyzz committed Feb 28, 2022
1 parent 7946863 commit 4a1f1a8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ def install_extra_deps(self):
self.pip_install(pkg, value['version'], value['compiled'])

def upgrade_mac_pip(self):
import re

r = subprocess.run([self.py, '-m', 'pip', '--version'],
check=True, capture_output=True, text=True)
if r.stdout.startswith('pip 20'):
subprocess.run([self.py, '-m', 'pip', 'install', '-U', 'pip'],
check=True, capture_output=True, text=True)
m = re.match(r'pip (\d+)\.', r.stdout)
if m and int(m.group(1)) < 22:
subprocess.run(
[self.py, '-m', 'pip', 'install', '--user', '-U', 'pip'],
check=True, capture_output=True, text=True)

0 comments on commit 4a1f1a8

Please sign in to comment.