<s> from subprocess import call , PIPE <EOL> from django . core . management . base import BaseCommand <EOL> import image_diet . settings as settings <EOL> class Command ( BaseCommand ) : <EOL> help = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def handle ( self , * args , ** options ) : <EOL> tools = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> not_found = [ ] <EOL> for tool in tools : <EOL> setting_name = "<STR_LIT>" + tool . upper ( ) <EOL> if getattr ( settings , setting_name ) : <EOL> retcode = call ( "<STR_LIT>" % tool , shell = True , stdout = PIPE ) <EOL> if retcode == <NUM_LIT:0> : <EOL> self . stdout . write ( '<STR_LIT>' % tool ) <EOL> else : <EOL> self . stdout . write ( '<STR_LIT>' % tool ) <EOL> not_found . append ( tool ) <EOL> else : <EOL> self . stdout . write ( '<STR_LIT>' % tool ) <EOL> if len ( not_found ) : <EOL> off_settings = [ "<STR_LIT>" % tool . upper ( ) for tool <EOL> in not_found ] <EOL> self . stdout . write ( "<STR_LIT:\n>" ) <EOL> self . stdout . write ( "<STR_LIT>" ) <EOL> self . stdout . write ( "<STR_LIT:\n>" . join ( off_settings ) ) <EOL> self . stdout . write ( "<STR_LIT:\n>" ) </s>
