Skip to content

Instantly share code, notes, and snippets.

@fish2000
Created September 30, 2010 05:25
Show Gist options
  • Save fish2000/604076 to your computer and use it in GitHub Desktop.
Save fish2000/604076 to your computer and use it in GitHub Desktop.
sometimes you need to find some shit (in this case, the 'site-packages' folder which went missing after the OS X 10.6 upgrade)
#!/usr/bin/env python
# find /usr /opt /System /Library ~ -name "site-packages" -print 2> /dev/null
import os
print ">>>\t FINDING MY SHIT...."
whwreismyshit = os.execv('/usr/bin/find', (
'/usr', '/opt',
#os.getenv('HOME'),
'/System/Library/Frameworks', '/Library/Python',
'-name', "site-packages",
'-print',
'2>', '/dev/null'))
places = whwreismyshit.split("\n")
print ">>>\t POTENTIAL SHIT IS IN %n PLACES:" % len(places)
for place in places:
print ""
print "+ %s" % place
shit = os.listdir(place)
shit.sort() # side effects are so not cool
eggs = filter(lambda x: x.endswith('.egg'), shit)
pths = filter(lambda x: x.endswith('.pth'), shit)
pys = filter(lambda x: x.endswith('.py'), shit)
pycs = filter(lambda x: x.endswith('.pyc'), shit)
libs = filter(lambda x: x.endswith('.so') or x.endswith('.dylib'), shit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment