<s> import os <EOL> import sys <EOL> import shutil <EOL> import subprocess <EOL> from optparse import OptionParser <EOL> usage = """<STR_LIT>""" <EOL> parser = OptionParser ( usage = usage ) <EOL> parser . add_option ( "<STR_LIT:-c>" , "<STR_LIT>" , dest = "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> def main ( ) : <EOL> if "<STR_LIT>" not in os . environ : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> parser . print_usage ( ) <EOL> sys . exit ( - <NUM_LIT:1> ) <EOL> ( options , pos_args ) = parser . parse_args ( ) <EOL> virtualenv = os . environ [ "<STR_LIT>" ] <EOL> if options . clear : <EOL> subprocess . call ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , virtualenv ] ) <EOL> file_path = os . path . dirname ( __file__ ) <EOL> print "<STR_LIT>" <EOL> subprocess . call ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , virtualenv , "<STR_LIT>" , <EOL> os . path . join ( file_path , "<STR_LIT>" ) ] ) <EOL> if not options . base : <EOL> print "<STR_LIT>" <EOL> subprocess . call ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , virtualenv , "<STR_LIT>" , <EOL> os . path . join ( file_path , "<STR_LIT>" ) ] ) <EOL> parent_path = os . path . dirname ( os . path . dirname ( os . path . realpath ( __file__ ) ) ) <EOL> python_version = sys . version [ : <NUM_LIT:3> ] <EOL> site_packages = "<STR_LIT>" % ( virtualenv , python_version , ) <EOL> if os . path . exists ( site_packages ) : <EOL> path_file = "<STR_LIT>" % ( site_packages , ) <EOL> if os . path . exists ( path_file ) : <EOL> f = open ( path_file , '<STR_LIT>' ) <EOL> paths = f . readlines ( ) <EOL> if "<STR_LIT>" % ( parent_path , ) not in paths : <EOL> f . seek ( <NUM_LIT:0> ) <EOL> f . write ( "<STR_LIT>" % ( parent_path , "<STR_LIT:\n>" . join ( paths ) , ) ) <EOL> print "<STR_LIT>" % ( parent_path , ) <EOL> f . close ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) <EOL> sys . exit ( <NUM_LIT:0> ) </s>
