<s> import inventory <EOL> import re <EOL> import os <EOL> import shutil <EOL> import site <EOL> def clean_module ( module_name ) : <EOL> pattern = re . compile ( '<STR_LIT>' % module_name ) <EOL> try : <EOL> for sitepackage in site . getsitepackages ( ) : <EOL> try : <EOL> for file in os . listdir ( sitepackage ) : <EOL> if pattern . match ( file ) : <EOL> file = os . path . join ( sitepackage , file ) <EOL> print ( '<STR_LIT>' % file ) <EOL> if os . path . isdir ( file ) : <EOL> shutil . rmtree ( file ) <EOL> else : <EOL> os . unlink ( file ) <EOL> except Exception as e : <EOL> pass <EOL> except Exception as e : <EOL> pass <EOL> def clean_cur_path ( module_path , name ) : <EOL> build_dir = os . path . join ( module_path , '<STR_LIT>' ) <EOL> if os . path . exists ( build_dir ) : <EOL> print ( '<STR_LIT>' % build_dir ) <EOL> shutil . rmtree ( build_dir ) <EOL> dist_dir = os . path . join ( module_path , '<STR_LIT>' ) <EOL> if os . path . exists ( dist_dir ) : <EOL> print ( '<STR_LIT>' % dist_dir ) <EOL> shutil . rmtree ( dist_dir ) <EOL> egg_dir = os . path . join ( module_path , '<STR_LIT>' % name ) <EOL> if os . path . exists ( egg_dir ) : <EOL> print ( '<STR_LIT>' % egg_dir ) <EOL> shutil . rmtree ( egg_dir ) <EOL> tox_dir = os . path . join ( module_path , '<STR_LIT>' ) <EOL> if os . path . exists ( tox_dir ) : <EOL> print ( '<STR_LIT>' % tox_dir ) <EOL> shutil . rmtree ( tox_dir ) <EOL> os . chdir ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:..>' ) ) <EOL> modulePaths = inventory . getModulePaths ( ) <EOL> for modulePath in modulePaths : <EOL> name = inventory . getModuleName ( modulePath ) <EOL> if name : <EOL> clean_module ( name ) <EOL> clean_cur_path ( modulePath , name ) </s>
