<s> """<STR_LIT>""" <EOL> from dtf . module import Module <EOL> import dtf . adb as DtfAdb <EOL> import dtf . logging as log <EOL> import dtf . properties as prop <EOL> import dtf . core . utils as utils <EOL> from dtf . constants import DTF_CLIENT <EOL> from argparse import ArgumentParser <EOL> from os . path import isfile <EOL> DTF_CLIENT_PATH = ( "<STR_LIT>" % <EOL> utils . get_pydtf_dir ( ) ) <EOL> DEFAULT_PATH = '<STR_LIT>' <EOL> class client ( Module ) : <EOL> """<STR_LIT>""" <EOL> adb = DtfAdb . DtfAdb ( ) <EOL> @ classmethod <EOL> def usage ( cls ) : <EOL> """<STR_LIT>""" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return <NUM_LIT:0> <EOL> def do_install ( self ) : <EOL> """<STR_LIT>""" <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> self . adb . wait_for_device ( ) <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> self . adb . uninstall ( DTF_CLIENT ) <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> self . adb . install ( DTF_CLIENT_PATH ) <EOL> cmd = "<STR_LIT>" <EOL> self . adb . shell_command ( cmd ) <EOL> busybox_path = "<STR_LIT>" % DTF_CLIENT <EOL> prop . set_prop ( '<STR_LIT>' , '<STR_LIT>' , busybox_path ) <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> def do_status ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . adb . is_installed ( DTF_CLIENT ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> else : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> def do_remove ( self ) : <EOL> """<STR_LIT>""" <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> self . adb . wait_for_device ( ) <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> self . adb . uninstall ( DTF_CLIENT ) <EOL> prop . del_prop ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> def do_upload ( self , args ) : <EOL> """<STR_LIT>""" <EOL> parser = ArgumentParser ( prog = '<STR_LIT>' , <EOL> description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , metavar = "<STR_LIT>" , dest = '<STR_LIT>' , <EOL> default = DEFAULT_PATH , help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , type = str , <EOL> help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( args ) <EOL> file_name = args . file_name <EOL> upload_path = args . upload_path <EOL> if not isfile ( file_name ) : <EOL> log . e ( self . name , "<STR_LIT>" % file_name ) <EOL> return - <NUM_LIT:1> <EOL> log . i ( self . name , "<STR_LIT>" ) <EOL> self . adb . wait_for_device ( ) <EOL> if not self . adb . is_installed ( DTF_CLIENT ) : <EOL> log . e ( self . name , "<STR_LIT>" ) <EOL> return - <NUM_LIT:1> <EOL> self . adb . push ( file_name , upload_path ) <EOL> upload_file_name = "<STR_LIT>" % ( upload_path , file_name ) <EOL> dtf_upload_path = "<STR_LIT>" % DTF_CLIENT <EOL> cmd = ( "<STR_LIT>" % <EOL> ( DTF_CLIENT , upload_file_name , dtf_upload_path ) ) <EOL> self . adb . shell_command ( cmd ) <EOL> return <NUM_LIT:0> <EOL> def execute ( self , args ) : <EOL> """<STR_LIT>""" <EOL> self . name = self . __self__ <EOL> rtn = <NUM_LIT:0> <EOL> if len ( args ) < <NUM_LIT:1> : <EOL> return self . usage ( ) <EOL> sub_cmd = args . pop ( <NUM_LIT:0> ) <EOL> if sub_cmd == '<STR_LIT>' : <EOL> rtn = self . do_install ( ) <EOL> elif sub_cmd == '<STR_LIT:status>' : <EOL> rtn = self . do_status ( ) <EOL> elif sub_cmd == '<STR_LIT>' : <EOL> rtn = self . do_remove ( ) <EOL> elif sub_cmd == '<STR_LIT>' : <EOL> rtn = self . do_upload ( args ) <EOL> else : <EOL> print "<STR_LIT>" % sub_cmd <EOL> rtn = self . usage ( ) <EOL> return rtn </s>
