#! /usr/bin/env python """ Clean up /usr/lib/python2.x/site-packages directory with all EIAO Python modules. """ __author__ = "Anand B Pillai" __maintainer__ = "Anand B Pillai" __version__ = "$Id: setup.py 1974 2006-08-29 18:45:23Z abp $" import sys, os import site import glob import re site_dir = [s for s in site._init_pathinfo() if s.endswith('site-packages')][0] eiaore = re.compile(r'EIAO', re.IGNORECASE) for f in glob.glob(site_dir + '/*.py'): try: data = open(f).read() if eiaore.search(data): # Delete file print 'Removing file %s and its compiled files...' % f os.system('rm -rf ' + f + '*') except (OSError, IOError), e: print e