Created
September 30, 2010 05:04
-
-
Save fish2000/604054 to your computer and use it in GitHub Desktop.
dump lists of all directories and egg files, in sys.path and all visible .pth files; group the results accordingly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
whereismyshit.py | |
Created by FI$H 2000 on 2010-09-16. | |
Copyright (c) 2010 OST, LLC. All rights reserved. | |
""" | |
from __future__ import with_statement | |
import sys, os | |
eggs = [] | |
dirs = [] | |
pths = [] | |
def main(): | |
for p in sys.path: | |
if p.endswith('.egg'): | |
eggs.append(p) | |
else: | |
dirs.append(p) | |
try: | |
pths.extend(["%s/%s" % (p, pth) for pth in os.listdir(p) if pth.endswith('.pth')]) | |
except OSError, err: | |
print "WTF: OSError %s for path %s" % (err, p) | |
print "" | |
print "###\t EGGS:" | |
for egg in eggs: | |
print ">>>\t %s" % egg | |
print "" | |
print "###\t DIRS:" | |
for durr in dirs: | |
print ">>>\t %s" % durr | |
print "" | |
print "###\t PTH FILES:" | |
for pth in pths: | |
print ">>>\t %s" % pth | |
with open(pth, 'r') as pthf: | |
print pthf.read() | |
print "" | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment