diff --git a/importlib_metadata/diagnose.py b/importlib_metadata/diagnose.py new file mode 100644 index 00000000..e405471a --- /dev/null +++ b/importlib_metadata/diagnose.py @@ -0,0 +1,21 @@ +import sys + +from . import Distribution + + +def inspect(path): + print("Inspecting", path) + dists = list(Distribution.discover(path=[path])) + if not dists: + return + print("Found", len(dists), "packages:", end=' ') + print(', '.join(dist.name for dist in dists)) + + +def run(): + for path in sys.path: + inspect(path) + + +if __name__ == '__main__': + run() diff --git a/newsfragments/461.feature.rst b/newsfragments/461.feature.rst new file mode 100644 index 00000000..bf07a91b --- /dev/null +++ b/newsfragments/461.feature.rst @@ -0,0 +1 @@ +Added diagnose script. \ No newline at end of file