Assorted PEP8 cleanups in evennia_launcher.py
This commit is contained in:
parent
4b29b4e3fe
commit
886830b773
1 changed files with 161 additions and 97 deletions
|
|
@ -130,8 +130,8 @@ WARNING_RUNSERVER = \
|
||||||
|
|
||||||
ERROR_SETTINGS = \
|
ERROR_SETTINGS = \
|
||||||
"""
|
"""
|
||||||
There was an error importing Evennia's config file {settingspath}. There is usually
|
There was an error importing Evennia's config file {settingspath}.
|
||||||
one of three reasons for this:
|
There is usually one of three reasons for this:
|
||||||
1) You are not running this command from your game directory.
|
1) You are not running this command from your game directory.
|
||||||
Change directory to your game directory and try again (or
|
Change directory to your game directory and try again (or
|
||||||
create a new game directory using evennia --init <dirname>)
|
create a new game directory using evennia --init <dirname>)
|
||||||
|
|
@ -229,8 +229,8 @@ HELP_ENTRY = \
|
||||||
Reload with (5) to update the server with your changes without
|
Reload with (5) to update the server with your changes without
|
||||||
disconnecting any players.
|
disconnecting any players.
|
||||||
|
|
||||||
Note: Reload and stop are sometimes poorly supported in Windows. If you have
|
Note: Reload and stop are sometimes poorly supported in Windows. If you
|
||||||
issues, log into the game to stop or restart the server instead.
|
have issues, log into the game to stop or restart the server instead.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
MENU = \
|
MENU = \
|
||||||
|
|
@ -331,6 +331,7 @@ ERROR_NODJANGO = \
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
def evennia_version():
|
def evennia_version():
|
||||||
"""
|
"""
|
||||||
Get the Evennia version info from the main package.
|
Get the Evennia version info from the main package.
|
||||||
|
|
@ -343,7 +344,10 @@ def evennia_version():
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
version = "%s (rev %s)" % (version, check_output("git rev-parse --short HEAD", shell=True, cwd=EVENNIA_ROOT, stderr=STDOUT).strip())
|
rev = check_output(
|
||||||
|
"git rev-parse --short HEAD",
|
||||||
|
shell=True, cwd=EVENNIA_ROOT, stderr=STDOUT).strip()
|
||||||
|
version = "%s (rev %s)" % (version, rev)
|
||||||
except (IOError, CalledProcessError):
|
except (IOError, CalledProcessError):
|
||||||
pass
|
pass
|
||||||
return version
|
return version
|
||||||
|
|
@ -372,7 +376,8 @@ def check_main_evennia_dependencies():
|
||||||
import twisted
|
import twisted
|
||||||
tversion = twisted.version.short()
|
tversion = twisted.version.short()
|
||||||
if tversion < TWISTED_MIN:
|
if tversion < TWISTED_MIN:
|
||||||
print ERROR_TWISTED_VERSION.format(tversion=tversion, twisted_min=TWISTED_MIN)
|
print ERROR_TWISTED_VERSION.format(
|
||||||
|
tversion=tversion, twisted_min=TWISTED_MIN)
|
||||||
error = True
|
error = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print ERROR_NOTWISTED
|
print ERROR_NOTWISTED
|
||||||
|
|
@ -383,12 +388,15 @@ def check_main_evennia_dependencies():
|
||||||
# only the main version (1.5, not 1.5.4.0)
|
# only the main version (1.5, not 1.5.4.0)
|
||||||
dversion_main = ".".join(dversion.split(".")[:2])
|
dversion_main = ".".join(dversion.split(".")[:2])
|
||||||
if dversion < DJANGO_MIN:
|
if dversion < DJANGO_MIN:
|
||||||
print ERROR_DJANGO_MIN.format(dversion=dversion_main, django_min=DJANGO_MIN)
|
print ERROR_DJANGO_MIN.format(
|
||||||
|
dversion=dversion_main, django_min=DJANGO_MIN)
|
||||||
error = True
|
error = True
|
||||||
elif DJANGO_MIN <= dversion < DJANGO_REC:
|
elif DJANGO_MIN <= dversion < DJANGO_REC:
|
||||||
print NOTE_DJANGO_MIN.format(dversion=dversion_main, django_rec=DJANGO_REC)
|
print NOTE_DJANGO_MIN.format(
|
||||||
|
dversion=dversion_main, django_rec=DJANGO_REC)
|
||||||
elif DJANGO_REC < dversion_main:
|
elif DJANGO_REC < dversion_main:
|
||||||
print NOTE_DJANGO_NEW.format(dversion=dversion_main, django_rec=DJANGO_REC)
|
print NOTE_DJANGO_NEW.format(
|
||||||
|
dversion=dversion_main, django_rec=DJANGO_REC)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print ERROR_NODJANGO
|
print ERROR_NODJANGO
|
||||||
error = True
|
error = True
|
||||||
|
|
@ -449,7 +457,8 @@ def create_settings_file():
|
||||||
settings_string = f.read()
|
settings_string = f.read()
|
||||||
|
|
||||||
# tweak the settings
|
# tweak the settings
|
||||||
setting_dict = {"settings_default": os.path.join(EVENNIA_LIB, "settings_default.py"),
|
setting_dict = {
|
||||||
|
"settings_default": os.path.join(EVENNIA_LIB, "settings_default.py"),
|
||||||
"servername": "\"%s\"" % GAMEDIR.rsplit(os.path.sep, 1)[1].capitalize(),
|
"servername": "\"%s\"" % GAMEDIR.rsplit(os.path.sep, 1)[1].capitalize(),
|
||||||
"secret_key": "\'%s\'" % create_secret_key()}
|
"secret_key": "\'%s\'" % create_secret_key()}
|
||||||
|
|
||||||
|
|
@ -486,7 +495,9 @@ def create_superuser():
|
||||||
Create the superuser player
|
Create the superuser player
|
||||||
|
|
||||||
"""
|
"""
|
||||||
print "\nCreate a superuser below. The superuser is Player #1, the 'owner' account of the server.\n"
|
print(
|
||||||
|
"\nCreate a superuser below. The superuser is Player #1, the 'owner' "
|
||||||
|
"account of the server.\n")
|
||||||
django.core.management.call_command("createsuperuser", interactive=True)
|
django.core.management.call_command("createsuperuser", interactive=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -527,8 +538,8 @@ def check_database():
|
||||||
other = other_superuser[0]
|
other = other_superuser[0]
|
||||||
other_id = other.id
|
other_id = other.id
|
||||||
other_key = other.username
|
other_key = other.username
|
||||||
print WARNING_MOVING_SUPERUSER.format(other_key=other_key,
|
print WARNING_MOVING_SUPERUSER.format(
|
||||||
other_id=other_id)
|
other_key=other_key, other_id=other_id)
|
||||||
res = ""
|
res = ""
|
||||||
while res.upper() != "Y":
|
while res.upper() != "Y":
|
||||||
# ask for permission
|
# ask for permission
|
||||||
|
|
@ -595,7 +606,8 @@ def del_pid(pidfile):
|
||||||
os.remove(pidfile)
|
os.remove(pidfile)
|
||||||
|
|
||||||
|
|
||||||
def kill(pidfile, signal=SIG, succmsg="", errmsg="", restart_file=SERVER_RESTART, restart=False):
|
def kill(pidfile, signal=SIG, succmsg="", errmsg="",
|
||||||
|
restart_file=SERVER_RESTART, restart=False):
|
||||||
"""
|
"""
|
||||||
Send a kill signal to a process based on PID. A customized
|
Send a kill signal to a process based on PID. A customized
|
||||||
success/error message will be returned. If clean=True, the system
|
success/error message will be returned. If clean=True, the system
|
||||||
|
|
@ -616,7 +628,8 @@ def kill(pidfile, signal=SIG, succmsg="", errmsg="", restart_file=SERVER_RESTART
|
||||||
os.remove(pidfile)
|
os.remove(pidfile)
|
||||||
# set restart/norestart flag
|
# set restart/norestart flag
|
||||||
if restart:
|
if restart:
|
||||||
django.core.management.call_command('collectstatic', interactive=False, verbosity=0)
|
django.core.management.call_command(
|
||||||
|
'collectstatic', interactive=False, verbosity=0)
|
||||||
with open(restart_file, 'w') as f:
|
with open(restart_file, 'w') as f:
|
||||||
f.write("reload")
|
f.write("reload")
|
||||||
else:
|
else:
|
||||||
|
|
@ -645,12 +658,13 @@ def show_version_info(about=False):
|
||||||
version_info (str): A complete version info string.
|
version_info (str): A complete version info string.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import os, sys
|
import os
|
||||||
|
import sys
|
||||||
import twisted
|
import twisted
|
||||||
import django
|
import django
|
||||||
|
|
||||||
return VERSION_INFO.format(version=EVENNIA_VERSION,
|
return VERSION_INFO.format(
|
||||||
about=ABOUT_INFO if about else "",
|
version=EVENNIA_VERSION, about=ABOUT_INFO if about else "",
|
||||||
os=os.name, python=sys.version.split()[0],
|
os=os.name, python=sys.version.split()[0],
|
||||||
twisted=twisted.version.short(),
|
twisted=twisted.version.short(),
|
||||||
django=django.get_version())
|
django=django.get_version())
|
||||||
|
|
@ -687,22 +701,31 @@ def error_check_python_modules():
|
||||||
imp(path, split=False)
|
imp(path, split=False)
|
||||||
# cmdsets
|
# cmdsets
|
||||||
|
|
||||||
deprstring = "settings.%s should be renamed to %s. If defaults are used, " \
|
deprstring = ("settings.%s should be renamed to %s. If defaults are used, "
|
||||||
"their path/classname must be updated (see evennia/settings_default.py)."
|
"their path/classname must be updated "
|
||||||
|
"(see evennia/settings_default.py).")
|
||||||
if hasattr(settings, "CMDSET_DEFAULT"):
|
if hasattr(settings, "CMDSET_DEFAULT"):
|
||||||
raise DeprecationWarning(deprstring % ("CMDSET_DEFAULT", "CMDSET_CHARACTER"))
|
raise DeprecationWarning(deprstring % (
|
||||||
|
"CMDSET_DEFAULT", "CMDSET_CHARACTER"))
|
||||||
if hasattr(settings, "CMDSET_OOC"):
|
if hasattr(settings, "CMDSET_OOC"):
|
||||||
raise DeprecationWarning(deprstring % ("CMDSET_OOC", "CMDSET_PLAYER"))
|
raise DeprecationWarning(deprstring % ("CMDSET_OOC", "CMDSET_PLAYER"))
|
||||||
if settings.WEBSERVER_ENABLED and not isinstance(settings.WEBSERVER_PORTS[0], tuple):
|
if settings.WEBSERVER_ENABLED and not isinstance(settings.WEBSERVER_PORTS[0], tuple):
|
||||||
raise DeprecationWarning("settings.WEBSERVER_PORTS must be on the form [(proxyport, serverport), ...]")
|
raise DeprecationWarning(
|
||||||
|
"settings.WEBSERVER_PORTS must be on the form "
|
||||||
|
"[(proxyport, serverport), ...]")
|
||||||
if hasattr(settings, "BASE_COMM_TYPECLASS"):
|
if hasattr(settings, "BASE_COMM_TYPECLASS"):
|
||||||
raise DeprecationWarning(deprstring % ("BASE_COMM_TYPECLASS", "BASE_CHANNEL_TYPECLASS"))
|
raise DeprecationWarning(deprstring % (
|
||||||
|
"BASE_COMM_TYPECLASS", "BASE_CHANNEL_TYPECLASS"))
|
||||||
if hasattr(settings, "COMM_TYPECLASS_PATHS"):
|
if hasattr(settings, "COMM_TYPECLASS_PATHS"):
|
||||||
raise DeprecationWarning(deprstring % ("COMM_TYPECLASS_PATHS", "CHANNEL_TYPECLASS_PATHS"))
|
raise DeprecationWarning(deprstring % (
|
||||||
|
"COMM_TYPECLASS_PATHS", "CHANNEL_TYPECLASS_PATHS"))
|
||||||
if hasattr(settings, "CHARACTER_DEFAULT_HOME"):
|
if hasattr(settings, "CHARACTER_DEFAULT_HOME"):
|
||||||
raise DeprecationWarning("settings.CHARACTER_DEFAULT_HOME should be renamed to DEFAULT_HOME. " \
|
raise DeprecationWarning(
|
||||||
"See also settings.START_LOCATION (see evennia/settings_default.py).")
|
"settings.CHARACTER_DEFAULT_HOME should be renamed to "
|
||||||
deprstring = "settings.%s is now merged into settings.TYPECLASS_PATHS. Update your settings file."
|
"DEFAULT_HOME. See also settings.START_LOCATION "
|
||||||
|
"(see evennia/settings_default.py).")
|
||||||
|
deprstring = ("settings.%s is now merged into settings.TYPECLASS_PATHS. "
|
||||||
|
"Update your settings file.")
|
||||||
if hasattr(settings, "OBJECT_TYPECLASS_PATHS"):
|
if hasattr(settings, "OBJECT_TYPECLASS_PATHS"):
|
||||||
raise DeprecationWarning(deprstring % "OBJECT_TYPECLASS_PATHS")
|
raise DeprecationWarning(deprstring % "OBJECT_TYPECLASS_PATHS")
|
||||||
if hasattr(settings, "SCRIPT_TYPECLASS_PATHS"):
|
if hasattr(settings, "SCRIPT_TYPECLASS_PATHS"):
|
||||||
|
|
@ -712,12 +735,13 @@ def error_check_python_modules():
|
||||||
if hasattr(settings, "CHANNEL_TYPECLASS_PATHS"):
|
if hasattr(settings, "CHANNEL_TYPECLASS_PATHS"):
|
||||||
raise DeprecationWarning(deprstring % "CHANNEL_TYPECLASS_PATHS")
|
raise DeprecationWarning(deprstring % "CHANNEL_TYPECLASS_PATHS")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from evennia.commands import cmdsethandler
|
from evennia.commands import cmdsethandler
|
||||||
if not cmdsethandler.import_cmdset(settings.CMDSET_UNLOGGEDIN, None): print "Warning: CMDSET_UNLOGGED failed to load!"
|
if not cmdsethandler.import_cmdset(settings.CMDSET_UNLOGGEDIN, None):
|
||||||
if not cmdsethandler.import_cmdset(settings.CMDSET_CHARACTER, None): print "Warning: CMDSET_CHARACTER failed to load"
|
print("Warning: CMDSET_UNLOGGED failed to load!")
|
||||||
if not cmdsethandler.import_cmdset(settings.CMDSET_PLAYER, None): print "Warning: CMDSET_PLAYER failed to load"
|
if not cmdsethandler.import_cmdset(settings.CMDSET_CHARACTER, None):
|
||||||
|
print("Warning: CMDSET_CHARACTER failed to load")
|
||||||
|
if not cmdsethandler.import_cmdset(settings.CMDSET_PLAYER, None):
|
||||||
|
print("Warning: CMDSET_PLAYER failed to load")
|
||||||
# typeclasses
|
# typeclasses
|
||||||
imp(settings.BASE_PLAYER_TYPECLASS)
|
imp(settings.BASE_PLAYER_TYPECLASS)
|
||||||
imp(settings.BASE_OBJECT_TYPECLASS)
|
imp(settings.BASE_OBJECT_TYPECLASS)
|
||||||
|
|
@ -828,16 +852,18 @@ def init_game_directory(path, check_db=True):
|
||||||
|
|
||||||
# note that we hope the twistd package won't change here, since we
|
# note that we hope the twistd package won't change here, since we
|
||||||
# try to get to the executable by relative path.
|
# try to get to the executable by relative path.
|
||||||
twistd_path = os.path.abspath(os.path.join(twistd_dir,
|
twistd_path = os.path.abspath(
|
||||||
os.pardir, os.pardir, os.pardir, os.pardir,
|
os.path.join(twistd_dir, os.pardir, os.pardir, os.pardir,
|
||||||
'scripts', 'twistd.py'))
|
os.pardir, 'scripts', 'twistd.py'))
|
||||||
|
|
||||||
with open(batpath, 'w') as bat_file:
|
with open(batpath, 'w') as bat_file:
|
||||||
# build a custom bat file for windows
|
# build a custom bat file for windows
|
||||||
bat_file.write("@\"%s\" \"%s\" %%*" % (sys.executable, twistd_path))
|
bat_file.write("@\"%s\" \"%s\" %%*" % (
|
||||||
|
sys.executable, twistd_path))
|
||||||
|
|
||||||
print INFO_WINDOWS_BATFILE.format(twistd_path=twistd_path)
|
print INFO_WINDOWS_BATFILE.format(twistd_path=twistd_path)
|
||||||
|
|
||||||
|
|
||||||
def run_dummyrunner(number_of_dummies):
|
def run_dummyrunner(number_of_dummies):
|
||||||
"""
|
"""
|
||||||
Start an instance of the dummyrunner
|
Start an instance of the dummyrunner
|
||||||
|
|
@ -861,6 +887,7 @@ def run_dummyrunner(number_of_dummies):
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def list_settings(keys):
|
def list_settings(keys):
|
||||||
"""
|
"""
|
||||||
Display the server settings. We only display the Evennia specific
|
Display the server settings. We only display the Evennia specific
|
||||||
|
|
@ -885,7 +912,8 @@ def list_settings(keys):
|
||||||
# a specific key
|
# a specific key
|
||||||
table = evtable.EvTable(width=131)
|
table = evtable.EvTable(width=131)
|
||||||
keys = [key.upper() for key in keys]
|
keys = [key.upper() for key in keys]
|
||||||
confs = dict((key,var) for key, var in evsettings.__dict__.items() if key in keys)
|
confs = dict((key, var) for key, var in evsettings.__dict__.items()
|
||||||
|
if key in keys)
|
||||||
for key, val in confs.items():
|
for key, val in confs.items():
|
||||||
table.add_row(key, str(val))
|
table.add_row(key, str(val))
|
||||||
print table
|
print table
|
||||||
|
|
@ -988,47 +1016,65 @@ def server_operation(mode, service, interactive, profiler):
|
||||||
if interactive:
|
if interactive:
|
||||||
cmdstr.append('--iportal')
|
cmdstr.append('--iportal')
|
||||||
cmdstr.append('--noserver')
|
cmdstr.append('--noserver')
|
||||||
django.core.management.call_command('collectstatic', verbosity=1, interactive=False)
|
django.core.management.call_command(
|
||||||
else: # all
|
'collectstatic', verbosity=1, interactive=False)
|
||||||
|
else:
|
||||||
|
# all
|
||||||
# for convenience we don't start logging of
|
# for convenience we don't start logging of
|
||||||
# portal, only of server with this command.
|
# portal, only of server with this command.
|
||||||
if profiler:
|
if profiler:
|
||||||
cmdstr.append('--pserver') # this is the common case
|
# this is the common case
|
||||||
|
cmdstr.append('--pserver')
|
||||||
if interactive:
|
if interactive:
|
||||||
cmdstr.append('--iserver')
|
cmdstr.append('--iserver')
|
||||||
django.core.management.call_command('collectstatic', verbosity=1, interactive=False)
|
django.core.management.call_command(
|
||||||
cmdstr.extend([GAMEDIR, TWISTED_BINARY, SERVER_LOGFILE, PORTAL_LOGFILE, HTTP_LOGFILE])
|
'collectstatic', verbosity=1, interactive=False)
|
||||||
|
cmdstr.extend([
|
||||||
|
GAMEDIR, TWISTED_BINARY, SERVER_LOGFILE,
|
||||||
|
PORTAL_LOGFILE, HTTP_LOGFILE])
|
||||||
# start the server
|
# start the server
|
||||||
Popen(cmdstr, env=getenv())
|
Popen(cmdstr, env=getenv())
|
||||||
|
|
||||||
elif mode == 'reload':
|
elif mode == 'reload':
|
||||||
# restarting services
|
# restarting services
|
||||||
if os.name == 'nt':
|
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
|
return
|
||||||
if service == 'server':
|
if service == 'server':
|
||||||
kill(SERVER_PIDFILE, SIG, "Server reloaded.", errmsg % 'Server', SERVER_RESTART, restart=True)
|
kill(SERVER_PIDFILE, SIG, "Server reloaded.",
|
||||||
|
errmsg % 'Server', SERVER_RESTART, restart=True)
|
||||||
elif service == 'portal':
|
elif service == 'portal':
|
||||||
print """
|
print(
|
||||||
Note: Portal usually doesnt't need to be reloaded unless you are debugging in interactive mode.
|
"Note: Portal usually doesnt't need to be reloaded unless you "
|
||||||
If Portal was running in default Daemon mode, it cannot be restarted. In that case you have
|
"are debugging in interactive mode. If Portal was running in "
|
||||||
to restart it manually with 'evennia.py start portal'
|
"default Daemon mode, it cannot be restarted. In that case "
|
||||||
"""
|
"you have to restart it manually with 'evennia.py "
|
||||||
kill(PORTAL_PIDFILE, SIG, "Portal reloaded (or stopped, if it was in daemon mode).", errmsg % 'Portal', PORTAL_RESTART, restart=True)
|
"start portal'")
|
||||||
else: # all
|
kill(PORTAL_PIDFILE, SIG,
|
||||||
|
"Portal reloaded (or stopped, if it was in daemon mode).",
|
||||||
|
errmsg % 'Portal', PORTAL_RESTART, restart=True)
|
||||||
|
else:
|
||||||
|
# all
|
||||||
# default mode, only restart server
|
# default mode, only restart server
|
||||||
kill(SERVER_PIDFILE, SIG, "Server reload.", errmsg % 'Server', SERVER_RESTART, restart=True)
|
kill(SERVER_PIDFILE, SIG,
|
||||||
|
"Server reload.",
|
||||||
|
errmsg % 'Server', SERVER_RESTART, restart=True)
|
||||||
|
|
||||||
elif mode == 'stop':
|
elif mode == 'stop':
|
||||||
# stop processes, avoiding reload
|
# stop processes, avoiding reload
|
||||||
if service == 'server':
|
if service == 'server':
|
||||||
kill(SERVER_PIDFILE, SIG, "Server stopped.", errmsg % 'Server', SERVER_RESTART)
|
kill(SERVER_PIDFILE, SIG,
|
||||||
|
"Server stopped.", errmsg % 'Server', SERVER_RESTART)
|
||||||
elif service == 'portal':
|
elif service == 'portal':
|
||||||
kill(PORTAL_PIDFILE, SIG, "Portal stopped.", errmsg % 'Portal', PORTAL_RESTART)
|
kill(PORTAL_PIDFILE, SIG,
|
||||||
|
"Portal stopped.", errmsg % 'Portal', PORTAL_RESTART)
|
||||||
else:
|
else:
|
||||||
kill(PORTAL_PIDFILE, SIG, "Portal stopped.", errmsg % 'Portal', PORTAL_RESTART)
|
kill(PORTAL_PIDFILE, SIG,
|
||||||
kill(SERVER_PIDFILE, SIG, "Server stopped.", errmsg % 'Server', SERVER_RESTART)
|
"Portal stopped.", errmsg % 'Portal', PORTAL_RESTART)
|
||||||
|
kill(SERVER_PIDFILE, SIG,
|
||||||
|
"Server stopped.", errmsg % 'Server', SERVER_RESTART)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -1040,28 +1086,44 @@ def main():
|
||||||
# set up argument parser
|
# set up argument parser
|
||||||
|
|
||||||
parser = ArgumentParser(description=CMDLINE_HELP)
|
parser = ArgumentParser(description=CMDLINE_HELP)
|
||||||
parser.add_argument('-v', '--version', action='store_true',
|
parser.add_argument(
|
||||||
|
'-v', '--version', action='store_true',
|
||||||
dest='show_version', default=False,
|
dest='show_version', default=False,
|
||||||
help="Show version info.")
|
help="Show version info.")
|
||||||
parser.add_argument('-i', '--interactive', action='store_true',
|
parser.add_argument(
|
||||||
|
'-i', '--interactive', action='store_true',
|
||||||
dest='interactive', default=False,
|
dest='interactive', default=False,
|
||||||
help="Start given processes in interactive mode.")
|
help="Start given processes in interactive mode.")
|
||||||
parser.add_argument('--init', action='store', dest="init", metavar="name",
|
parser.add_argument(
|
||||||
|
'--init', action='store', dest="init", metavar="name",
|
||||||
help="Creates a new game directory 'name' at the current location.")
|
help="Creates a new game directory 'name' at the current location.")
|
||||||
parser.add_argument('-l', nargs='+', action='store', dest='listsetting', metavar="key",
|
parser.add_argument(
|
||||||
help="List values for server settings. Use 'all' to list all available keys.")
|
'-l', nargs='+', action='store', dest='listsetting', metavar="key",
|
||||||
parser.add_argument('--profiler', action='store_true', dest='profiler', default=False,
|
help=("List values for server settings. Use 'all' to list all "
|
||||||
|
"available keys."))
|
||||||
|
parser.add_argument(
|
||||||
|
'--profiler', action='store_true', dest='profiler', default=False,
|
||||||
help="Start given server component under the Python profiler.")
|
help="Start given server component under the Python profiler.")
|
||||||
parser.add_argument('--dummyrunner', nargs=1, action='store', dest='dummyrunner', metavar="N",
|
parser.add_argument(
|
||||||
|
'--dummyrunner', nargs=1, action='store', dest='dummyrunner',
|
||||||
|
metavar="N",
|
||||||
help="Tests a running server by connecting N dummy players to it.")
|
help="Tests a running server by connecting N dummy players to it.")
|
||||||
parser.add_argument('--settings', nargs=1, action='store', dest='altsettings', default=None, metavar="filename.py",
|
parser.add_argument(
|
||||||
help="Start evennia with alternative settings file in gamedir/server/conf/.")
|
'--settings', nargs=1, action='store', dest='altsettings',
|
||||||
parser.add_argument("option", nargs='?', default="noop",
|
default=None, metavar="filename.py",
|
||||||
|
help=("Start evennia with alternative settings file in "
|
||||||
|
"gamedir/server/conf/."))
|
||||||
|
parser.add_argument(
|
||||||
|
"option", nargs='?', default="noop",
|
||||||
help="Operational mode: 'start', 'stop', 'restart' or 'menu'.")
|
help="Operational mode: 'start', 'stop', 'restart' or 'menu'.")
|
||||||
parser.add_argument("service", metavar="component", nargs='?', default="all",
|
parser.add_argument(
|
||||||
help="Server component to operate on: 'server', 'portal' or 'all' (default).")
|
"service", metavar="component", nargs='?', default="all",
|
||||||
parser.epilog = "Example django-admin commands: 'migrate', 'flush', 'shell' and 'dbshell'. " \
|
help=("Server component to operate on: "
|
||||||
"See the django documentation for more django-admin commands."
|
"'server', 'portal' or 'all' (default)."))
|
||||||
|
parser.epilog = (
|
||||||
|
"Example django-admin commands: "
|
||||||
|
"'migrate', 'flush', 'shell' and 'dbshell'. "
|
||||||
|
"See the django documentation for more django-admin commands.")
|
||||||
|
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
|
|
||||||
|
|
@ -1078,7 +1140,8 @@ def main():
|
||||||
elif args.init:
|
elif args.init:
|
||||||
# initialization of game directory
|
# initialization of game directory
|
||||||
create_game_directory(args.init)
|
create_game_directory(args.init)
|
||||||
print CREATED_NEW_GAMEDIR.format(gamedir=args.init,
|
print CREATED_NEW_GAMEDIR.format(
|
||||||
|
gamedir=args.init,
|
||||||
settings_path=os.path.join(args.init, SETTINGS_PATH))
|
settings_path=os.path.join(args.init, SETTINGS_PATH))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
@ -1093,7 +1156,8 @@ def main():
|
||||||
global SETTINGSFILE, SETTINGS_DOTPATH
|
global SETTINGSFILE, SETTINGS_DOTPATH
|
||||||
SETTINGSFILE = sfile
|
SETTINGSFILE = sfile
|
||||||
SETTINGS_DOTPATH = "server.conf.%s" % sfile.rstrip(".py")
|
SETTINGS_DOTPATH = "server.conf.%s" % sfile.rstrip(".py")
|
||||||
print "Using settings file '%s' (%s)." % (SETTINGSFILE, SETTINGS_DOTPATH)
|
print "Using settings file '%s' (%s)." % (
|
||||||
|
SETTINGSFILE, SETTINGS_DOTPATH)
|
||||||
|
|
||||||
if args.dummyrunner:
|
if args.dummyrunner:
|
||||||
# launch the dummy runner
|
# launch the dummy runner
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue