Files
Matthieu Darbois 7c3d29faf2 fix: use --upgrade rather than --ignore-installed to upgrade pip (#268)
* fix: use `--upgrade` rather than `--ignore-installed` to upgrade pip

This removes left over files when upgrading pip.

* remove all installed python on macOS
2024-05-08 08:32:38 -05:00

25 lines
719 B
Python

import glob
import os.path
import sysconfig
from collections import defaultdict
def check_dist_info():
paths = set([sysconfig.get_path("purelib"), sysconfig.get_path("platlib")])
versions = defaultdict(list)
for path in paths:
pattern = os.path.join(path, "*.dist-info")
for dist_info in glob.glob(pattern):
name = os.path.basename(dist_info).split("-", maxsplit=1)[0]
versions[name].append(dist_info)
exit_code = 0
for name in versions:
if len(versions[name]) > 1:
print("multiple dist-info found for {}: {}".format(name, versions[name]))
exit_code = 1
exit(exit_code)
if __name__ == "__main__":
check_dist_info()