<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> from textwrap import dedent <EOL> from optparse import OptionParser <EOL> PROJECT = <NUM_LIT:0> <EOL> VENDOR = <NUM_LIT:1> <EOL> ENV_BRANCH = { <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> } <EOL> GIT_PULL = "<STR_LIT>" <EOL> GIT_SYNC = "<STR_LIT>" <EOL> GIT_SUBMODULE = "<STR_LIT>" <EOL> EXEC = '<STR_LIT>' <EOL> CHDIR = '<STR_LIT>' <EOL> def update_site ( env , debug ) : <EOL> """<STR_LIT>""" <EOL> error_updating = False <EOL> here = os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:..>' ) ) <EOL> project_branch = { '<STR_LIT>' : ENV_BRANCH [ env ] [ PROJECT ] } <EOL> commands = [ <EOL> ( CHDIR , here ) , <EOL> ( EXEC , GIT_PULL % project_branch ) , <EOL> ( EXEC , GIT_SYNC ) , <EOL> ( EXEC , GIT_SUBMODULE ) , <EOL> ] <EOL> commands += [ <EOL> ( EXEC , '<STR_LIT>' ) , <EOL> ( EXEC , '<STR_LIT>' ) , <EOL> ( EXEC , '<STR_LIT>' ) , <EOL> ( EXEC , '<STR_LIT>' ) , <EOL> ] <EOL> for cmd , cmd_args in commands : <EOL> if CHDIR == cmd : <EOL> if debug : <EOL> sys . stdout . write ( "<STR_LIT>" % cmd_args ) <EOL> os . chdir ( cmd_args ) <EOL> elif EXEC == cmd : <EOL> if debug : <EOL> sys . stdout . write ( "<STR_LIT>" % cmd_args ) <EOL> if not <NUM_LIT:0> == os . system ( cmd_args ) : <EOL> error_updating = True <EOL> break <EOL> else : <EOL> raise Exception ( "<STR_LIT>" % cmd ) <EOL> if error_updating : <EOL> sys . stderr . write ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def main ( ) : <EOL> """<STR_LIT>""" <EOL> debug = False <EOL> usage = dedent ( """<STR_LIT>""" . rstrip ( ) ) <EOL> options = OptionParser ( usage = usage ) <EOL> e_help = "<STR_LIT>" % '<STR_LIT:|>' . join ( ENV_BRANCH . keys ( ) ) <EOL> options . add_option ( "<STR_LIT>" , "<STR_LIT>" , help = e_help ) <EOL> options . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> help = "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" ) <EOL> ( opts , _ ) = options . parse_args ( ) <EOL> if opts . verbose : <EOL> debug = True <EOL> if opts . environment in ENV_BRANCH . keys ( ) : <EOL> update_site ( opts . environment , debug ) <EOL> else : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> options . print_help ( sys . stderr ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
