diff --git a/game/evennia.py b/game/evennia.py index 5af08023c5..c5c4a130d1 100755 --- a/game/evennia.py +++ b/game/evennia.py @@ -20,11 +20,11 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'game.settings' if not os.path.exists('settings.py'): # make sure we have a settings.py file. - print _(" No settings.py file found. launching manage.py ...") + print " No settings.py file found. launching manage.py ..." import game.manage - print _(""" + print """ ... A new settings file was created. Edit this file to configure Evennia as desired by copy&pasting options from src/settings_default.py. @@ -44,16 +44,14 @@ if not os.path.exists('settings.py'): and repeat the above manage.py steps to start with a fresh database. - When you are set up, run evennia.py again to start the server.""") + When you are set up, run evennia.py again to start the server.""" sys.exit() -# i18n -from django.utils.translation import ugettext as _ # signal processing SIG = signal.SIGINT HELPENTRY = \ -_(""" +""" (version %s) This program launches Evennia with various options. You can access all @@ -86,10 +84,10 @@ server (option 5) to make it available to users. Reload and stop is not well supported in Windows. If you have issues, log into the game to stop or restart the server instead. -""") +""" MENU = \ -_(""" +""" +---------------------------------------------------------------------------+ | | | Welcome to the Evennia launcher! | @@ -123,7 +121,7 @@ _(""" | h) Help | | q) Quit | +---------------------------------------------------------------------------+ -""") +""" # @@ -158,7 +156,7 @@ try: except ObjectDB.DoesNotExist: pass # this is fine at this point except DatabaseError: - print _(""" + print """ Your database does not seem to be set up correctly. Please run: @@ -172,7 +170,7 @@ except DatabaseError: python manage.py migrate When you have a database set up, rerun evennia.py. - """) + """ sys.exit() # Add this to the environmental variable for the 'twistd' command. @@ -189,13 +187,13 @@ if os.name == 'nt': # Test for for win32api import win32api except ImportError: - print _(""" + print """ ERROR: Unable to import win32api, which Twisted requires to run. You may download it from: http://sourceforge.net/projects/pywin32 or - http://starship.python.net/crew/mhammond/win32/Downloads.html""") + http://starship.python.net/crew/mhammond/win32/Downloads.html""" sys.exit() if not os.path.exists('twistd.bat'): @@ -213,7 +211,7 @@ if os.name == 'nt': bat_file = open('twistd.bat','w') bat_file.write("@\"%s\" \"%s\" %%*" % (sys.executable, twistd_path)) bat_file.close() - print _(""" + print """ INFO: Since you are running Windows, a file 'twistd.bat' was created for you. This is a simple batch file that tries to call the twisted executable. Evennia determined this to be: @@ -226,7 +224,7 @@ if os.name == 'nt': This procedure is only done once. Run evennia.py again when you are ready to start the server. - """) % {'twistd_path': twistd_path} + """ % {'twistd_path': twistd_path} sys.exit() TWISTED_BINARY = 'twistd.bat' @@ -263,7 +261,7 @@ def kill(pidfile, signal=SIG, succmsg="", errmsg="", restart_file=SERVER_RESTART if pid: if os.name == 'nt': if sys.version < "2.7": - print _("Windows requires Python 2.7 or higher for this operation.") + print "Windows requires Python 2.7 or higher for this operation." return os.remove(pidfile) # set restart/norestart flag @@ -273,7 +271,7 @@ def kill(pidfile, signal=SIG, succmsg="", errmsg="", restart_file=SERVER_RESTART try: os.kill(int(pid), signal) except OSError: - print _("Process %(pid)s could not be signalled. The PID file '%(pidfile)s' seems stale. Try removing it.") % {'pid': pid, 'pidfile': pidfile} + print "Process %(pid)s could not be signalled. The PID file '%(pidfile)s' seems stale. Try removing it." % {'pid': pid, 'pidfile': pidfile} return print "Evennia:", succmsg return @@ -290,23 +288,23 @@ def run_menu(): # menu loop print MENU - inp = raw_input(_(" option > ")) + inp = raw_input(" option > ") # quitting and help if inp.lower() == 'q': sys.exit() elif inp.lower() == 'h': print HELPENTRY % EVENNIA_VERSION - raw_input(_("press to continue ...")) + raw_input("press to continue ...") continue # options try: inp = int(inp) except ValueError: - print _("Not a valid option.") + print "Not a valid option." continue - errmsg = _("The %s does not seem to be running.") + errmsg = "The %s does not seem to be running." if inp < 5: if inp == 1: pass # default operation @@ -320,24 +318,24 @@ def run_menu(): elif inp < 10: if inp == 5: if os.name == 'nt': - print _("This operation is not supported under Windows. Log into the game to restart/reload the server.") + print "This operation is not supported under Windows. Log into the game to restart/reload the server." return - kill(SERVER_PIDFILE, SIG, _("Server reloaded."), errmsg % "Server") + kill(SERVER_PIDFILE, SIG, "Server reloaded.", errmsg % "Server") elif inp == 6: if os.name == 'nt': - print _("This operation is not supported under Windows.") + print "This operation is not supported under Windows." return - kill(PORTAL_PIDFILE, SIG, _("Portal reloaded (or stopped if in daemon mode)."), errmsg % "Portal") + kill(PORTAL_PIDFILE, SIG, "Portal reloaded (or stopped if in daemon mode).", errmsg % "Portal") elif inp == 7: - kill(SERVER_PIDFILE, SIG, _("Stopped Portal."), errmsg % "Portal", PORTAL_RESTART, restart=False) - kill(PORTAL_PIDFILE, SIG, _("Stopped Server."), errmsg % "Server", restart=False) + kill(SERVER_PIDFILE, SIG, "Stopped Portal.", errmsg % "Portal", PORTAL_RESTART, restart=False) + kill(PORTAL_PIDFILE, SIG, "Stopped Server.", errmsg % "Server", restart=False) elif inp == 8: - kill(PORTAL_PIDFILE, SIG, _("Stopped Server."), errmsg % "Server", restart=False) + kill(PORTAL_PIDFILE, SIG, "Stopped Server.", errmsg % "Server", restart=False) elif inp == 9: - kill(SERVER_PIDFILE, SIG, _("Stopped Portal."), errmsg % "Portal", PORTAL_RESTART, restart=False) - return + kill(SERVER_PIDFILE, SIG, "Stopped Portal.", errmsg % "Portal", PORTAL_RESTART, restart=False) + return else: - print _("Not a valid option.") + print "Not a valid option." return None @@ -352,7 +350,7 @@ def handle_args(options, mode, service): inter = options.interactive cmdstr = ["python", "runner.py"] - errmsg = _("The %s does not seem to be running.") + errmsg = "The %s does not seem to be running." if mode == 'start': @@ -377,28 +375,30 @@ def handle_args(options, mode, service): elif mode == 'reload': # restarting services if os.name == 'nt': - print _("Restarting from command line is not supported under Windows. Log into the game to restart.") + print "Restarting from command line is not supported under Windows. Log into the game to restart." return if service == 'server': - kill(SERVER_PIDFILE, SIG, _("Server reloaded."), errmsg % 'Server') + kill(SERVER_PIDFILE, SIG, "Server reloaded.", errmsg % 'Server') elif service == 'portal': - print _("Note: Portal usually don't need to be reloaded unless you are debugging in interactive mode.") - print _("If Portal was running in default Daemon mode, it cannot be restarted. In that case you have ") - print _("to restart it manually with 'evennia.py start portal'") - kill(PORTAL_PIDFILE, SIG, _("Portal reloaded (or stopped, if it was in daemon mode)."), errmsg % 'Portal', PORTAL_RESTART) + print """ + Note: Portal usually don't need to be reloaded unless you are debugging in interactive mode. + If Portal was running in default Daemon mode, it cannot be restarted. In that case you have + to restart it manually with 'evennia.py start portal' + """ + kill(PORTAL_PIDFILE, SIG, "Portal reloaded (or stopped, if it was in daemon mode).", errmsg % 'Portal', PORTAL_RESTART) else: # all # default mode, only restart server - kill(SERVER_PIDFILE, SIG, _("Server reload."), errmsg % 'Server') + kill(SERVER_PIDFILE, SIG, "Server reload.", errmsg % 'Server') elif mode == 'stop': # stop processes, avoiding reload if service == 'server': - kill(SERVER_PIDFILE, SIG, _("Server stopped."), errmsg % 'Server', restart=False) + kill(SERVER_PIDFILE, SIG, "Server stopped.", errmsg % 'Server', restart=False) elif service == 'portal': - kill(PORTAL_PIDFILE, SIG, _("Portal stopped."), errmsg % 'Portal', PORTAL_RESTART, restart=False) + kill(PORTAL_PIDFILE, SIG, "Portal stopped.", errmsg % 'Portal', PORTAL_RESTART, restart=False) else: - kill(PORTAL_PIDFILE, SIG, _("Portal stopped."), errmsg % 'Portal', PORTAL_RESTART, restart=False) - kill(SERVER_PIDFILE, SIG, _("Server stopped."), errmsg % 'Server', restart=False) + kill(PORTAL_PIDFILE, SIG, "Portal stopped.", errmsg % 'Portal', PORTAL_RESTART, restart=False) + kill(SERVER_PIDFILE, SIG, "Server stopped.", errmsg % 'Server', restart=False) return None def error_check_python_modules(): @@ -443,9 +443,9 @@ def main(): """ parser = OptionParser(usage="%prog [-i] [menu|start|reload|stop [server|portal|all]]", - description=_("""This is the main Evennia launcher. It handles the Portal and Server, the two services making up Evennia. Default is to operate on both services. Use --interactive together with start to launch services as 'interactive'. Note that when launching 'all' services with the --interactive flag, both services will be started, but only Server will actually be started in interactive mode. This is simply because this is the most commonly useful state. To activate interactive mode also for Portal, launch the two services explicitly as two separate calls to this program. You can also use the menu.""")) + description="""This is the main Evennia launcher. It handles the Portal and Server, the two services making up Evennia. Default is to operate on both services. Use --interactive together with start to launch services as 'interactive'. Note that when launching 'all' services with the --interactive flag, both services will be started, but only Server will actually be started in interactive mode. This is simply because this is the most commonly useful state. To activate interactive mode also for Portal, launch the two services explicitly as two separate calls to this program. You can also use the menu.""") - parser.add_option('-i', '--interactive', action='store_true', dest='interactive', default=False, help=_("Start given processes in interactive mode (log to stdout, don't start as a daemon).")) + parser.add_option('-i', '--interactive', action='store_true', dest='interactive', default=False, help="Start given processes in interactive mode (log to stdout, don't start as a daemon).") options, args = parser.parse_args() inter = options.interactive @@ -460,10 +460,10 @@ def main(): service = args[1] if mode not in ['menu', 'start', 'reload', 'stop']: - print _("mode should be none or one of 'menu', 'start', 'reload' or 'stop'.") + print "mode should be none or one of 'menu', 'start', 'reload' or 'stop'." sys.exit() if service not in ['server', 'portal', 'all']: - print _("service should be none or 'server', 'portal' or 'all'.") + print "service should be none or 'server', 'portal' or 'all'." sys.exit() if mode == 'menu': @@ -478,7 +478,7 @@ def main(): Popen(cmdstr) if __name__ == '__main__': - + # start Evennia from src.utils.utils import check_evennia_dependencies if check_evennia_dependencies(): main()