<s> import sys <EOL> import config <EOL> import json <EOL> from manager import BupManager <EOL> manager = BupManager ( config . read ( sys . argv [ <NUM_LIT:1> ] ) ) <EOL> while True : <EOL> try : <EOL> cmd = raw_input ( ) <EOL> except EOFError , e : <EOL> cmd = '<STR_LIT>' <EOL> res = { <EOL> "<STR_LIT:success>" : True , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> def onerror ( err , ctx ) : <EOL> res [ "<STR_LIT>" ] += err + "<STR_LIT:\n>" <EOL> callbacks = { <EOL> "<STR_LIT>" : onerror <EOL> } <EOL> if cmd == '<STR_LIT>' : <EOL> sys . exit ( ) <EOL> if cmd == '<STR_LIT>' : <EOL> res [ "<STR_LIT:success>" ] = manager . mount_parents ( callbacks ) <EOL> res [ "<STR_LIT>" ] = manager . bup . get_dir ( ) <EOL> if cmd == '<STR_LIT>' : <EOL> res [ "<STR_LIT:success>" ] = manager . unmount_parents ( callbacks ) <EOL> sys . stdout . write ( json . dumps ( res ) + "<STR_LIT:\n>" ) <EOL> sys . stdout . flush ( ) </s>
