Skip to content

Commit

Permalink
Problem: not easy to know current versions of pip, setuptools
Browse files Browse the repository at this point in the history
and wheels in developement

Solution: show used versions
  • Loading branch information
gotcha committed Mar 7, 2021
1 parent 2dbcc13 commit 5c2e3eb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,26 @@ def check_upgrade(package):
except subprocess.CalledProcessError:
raise RuntimeError("Upgrade %s failed." % package)


def show(package):
try:
sys.stdout.flush()
output = subprocess.check_output(
[sys.executable, '-m', 'pip', 'show', package],
)
for line in output.splitlines():
if line.startswith(b'Name') or line.startswith(b'Version'):
print(line.decode('utf8'))
except subprocess.CalledProcessError:
raise RuntimeError("Upgrade %s failed." % package)


need_restart = False
for package in ['pip', 'setuptools', 'wheel']:
did_upgrade = check_upgrade(package)
show(package)
need_restart = need_restart or did_upgrade

if need_restart:
print("Restart")
sys.stdout.flush()
Expand Down

0 comments on commit 5c2e3eb

Please sign in to comment.