Added correct test of the evennia module import in launcher.
This commit is contained in:
parent
096c9a6276
commit
6a8e57b2a1
2 changed files with 30 additions and 12 deletions
|
|
@ -1,2 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
|
|
@ -91,6 +91,12 @@ CREATED_NEW_GAMEDIR = \
|
||||||
to start the server.
|
to start the server.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
ERROR_NO_GAMEDIR = \
|
||||||
|
"""
|
||||||
|
No Evennia settings file was found. You must run this command from
|
||||||
|
inside a valid game directory first created with --init.
|
||||||
|
"""
|
||||||
|
|
||||||
WARNING_RUNSERVER = \
|
WARNING_RUNSERVER = \
|
||||||
"""
|
"""
|
||||||
WARNING: There is no need to run the Django development
|
WARNING: There is no need to run the Django development
|
||||||
|
|
@ -323,6 +329,28 @@ def check_main_evennia_dependencies():
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def set_gamedir(path):
|
||||||
|
"""
|
||||||
|
Set GAMEDIR based on path, by figuring out where the setting file
|
||||||
|
is inside the directory tree.
|
||||||
|
"""
|
||||||
|
|
||||||
|
global GAMEDIR
|
||||||
|
if os.path.exists(os.path.join(path, SETTINGS_PATH)):
|
||||||
|
# path at root of game dir
|
||||||
|
GAMEDIR = os.path.abspath(path)
|
||||||
|
elif os.path.exists(os.path.join(path, os.path.pardir, SETTINGS_PATH)):
|
||||||
|
# path given to somewhere else in gamedir
|
||||||
|
GAMEDIR = os.path.dirname(os.path.dirname(path))
|
||||||
|
elif os.path.exists(os.path.join(path, os.path.pardir, os.path.pardir, SETTINGS_PATH)):
|
||||||
|
# path given to somwhere two levels down
|
||||||
|
GAMEDIR = os.path.dirname(os.path.dirname(os.path.dirname(path)))
|
||||||
|
else:
|
||||||
|
# Assume path given to root game dir
|
||||||
|
print ERROR_NO_GAMEDIR
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def evennia_version():
|
def evennia_version():
|
||||||
"""
|
"""
|
||||||
Get the Evennia version info from the main package.
|
Get the Evennia version info from the main package.
|
||||||
|
|
@ -395,16 +423,8 @@ def init_game_directory(path):
|
||||||
the game directory and also sets PYTHONPATH as well as the
|
the game directory and also sets PYTHONPATH as well as the
|
||||||
django path.
|
django path.
|
||||||
"""
|
"""
|
||||||
global GAMEDIR
|
# set the GAMEDIR path
|
||||||
if os.path.exists(os.path.join(path, SETTINGFILE)):
|
set_gamedir(path)
|
||||||
# path given to server/conf/
|
|
||||||
GAMEDIR = os.path.dirname(os.path.dirname(os.path.dirname(path)))
|
|
||||||
elif os.path.exists(os.path.join(path, os.path.sep, SETTINGS_PATH)):
|
|
||||||
# path given to somewhere else in gamedir
|
|
||||||
GAMEDIR = os.path.dirname(os.path.dirname(path))
|
|
||||||
else:
|
|
||||||
# Assume path given to root game dir
|
|
||||||
GAMEDIR = path
|
|
||||||
|
|
||||||
# Add gamedir to python path
|
# Add gamedir to python path
|
||||||
sys.path.insert(0, GAMEDIR)
|
sys.path.insert(0, GAMEDIR)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue