<s> from __future__ import print_function , unicode_literals <EOL> import sys <EOL> from weblab import __version__ as weblab_version <EOL> from weblab . admin . script . creation import weblab_create , Creation <EOL> assert Creation != None <EOL> from weblab . admin . script . run import weblab_start , weblab_stop <EOL> from weblab . admin . script . monitor import weblab_monitor <EOL> from weblab . admin . script . upgrade import weblab_upgrade <EOL> from weblab . admin . script . locations import weblab_locations <EOL> from weblab . admin . script . httpd_config_generate import weblab_httpd_config_generate <EOL> SORTED_COMMANDS = [ ] <EOL> SORTED_COMMANDS . append ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> SORTED_COMMANDS . append ( ( '<STR_LIT:start>' , '<STR_LIT>' ) ) <EOL> SORTED_COMMANDS . append ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> SORTED_COMMANDS . append ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> SORTED_COMMANDS . append ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> SORTED_COMMANDS . append ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> SORTED_COMMANDS . append ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> COMMANDS = dict ( SORTED_COMMANDS ) <EOL> HIDDEN_COMMANDS = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def weblab ( ) : <EOL> if len ( sys . argv ) == <NUM_LIT:2> and sys . argv [ <NUM_LIT:1> ] in HIDDEN_COMMANDS : <EOL> if sys . argv [ <NUM_LIT:1> ] in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> print ( weblab_version ) <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> else : <EOL> print ( "<STR_LIT>" % sys . argv [ <NUM_LIT:1> ] , file = sys . stderr ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> if len ( sys . argv ) in ( <NUM_LIT:1> , <NUM_LIT:2> ) or sys . argv [ <NUM_LIT:1> ] not in COMMANDS : <EOL> command_list = "<STR_LIT>" <EOL> max_size = max ( ( len ( command ) for command in COMMANDS ) ) <EOL> for command , help_text in SORTED_COMMANDS : <EOL> filled_command = command + '<STR_LIT:U+0020>' * ( max_size - len ( command ) ) <EOL> command_list += "<STR_LIT>" % ( filled_command , help_text ) <EOL> print ( "<STR_LIT>" % ( sys . argv [ <NUM_LIT:0> ] , command_list ) , file = sys . stderr ) <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> main_command = sys . argv [ <NUM_LIT:1> ] <EOL> if main_command == '<STR_LIT>' : <EOL> weblab_create ( sys . argv [ <NUM_LIT:2> ] ) <EOL> return <EOL> if main_command == '<STR_LIT:start>' : <EOL> weblab_start ( sys . argv [ <NUM_LIT:2> ] ) <EOL> elif main_command == '<STR_LIT>' : <EOL> weblab_stop ( sys . argv [ <NUM_LIT:2> ] ) <EOL> elif main_command == '<STR_LIT>' : <EOL> weblab_monitor ( sys . argv [ <NUM_LIT:2> ] ) <EOL> elif main_command == '<STR_LIT>' : <EOL> weblab_upgrade ( sys . argv [ <NUM_LIT:2> ] ) <EOL> elif main_command == '<STR_LIT>' : <EOL> weblab_locations ( sys . argv [ <NUM_LIT:2> ] ) <EOL> elif main_command == '<STR_LIT>' : <EOL> weblab_httpd_config_generate ( sys . argv [ <NUM_LIT:2> ] ) <EOL> elif main_command == '<STR_LIT>' : <EOL> print ( weblab_version ) <EOL> else : <EOL> print ( "<STR_LIT>" % sys . argv [ <NUM_LIT:1> ] , file = sys . stderr ) <EOL> exit ( <NUM_LIT:2> ) </s>
