Refactored the devel/bin structure to hopefully make the system work better on Windows.

This commit is contained in:
Griatch 2015-02-02 20:14:28 +01:00
parent 6323ba965b
commit f780f469b1
12 changed files with 32 additions and 21 deletions

11
bin/unix/evennia Executable file
View file

@ -0,0 +1,11 @@
#! /usr/bin/python2.7
"""
Linux launcher
"""
import os, sys
sys.path.insert(0, os.path.abspath(os.getcwd()))
from evennia.server.evennia_launcher import main
main()

1
bin/windows/evennia.bat Normal file
View file

@ -0,0 +1 @@
@"python" "evennia.py" %*

11
bin/windows/evennia.py Executable file
View file

@ -0,0 +1,11 @@
#! /usr/bin/python2.7
"""
Linux launcher
"""
import os, sys
sys.path.insert(0, os.path.abspath(os.getcwd()))
from evennia.server.evennia_launcher import main
main()

19
bin/evennia → evennia/server/evennia_launcher.py Executable file → Normal file
View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
"""
EVENNIA SERVER STARTUP SCRIPT
EVENNIA SERVER LAUNCHER SCRIPT
This is the start point for running Evennia.
@ -22,15 +22,15 @@ import django
SIG = signal.SIGINT
# Set up the main python paths to Evennia
EVENNIA_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
EVENNIA_BIN = os.path.join(EVENNIA_ROOT, "bin")
EVENNIA_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import evennia
EVENNIA_LIB = os.path.join(os.path.dirname(os.path.abspath(evennia.__file__)))
EVENNIA_RUNNER = os.path.join(EVENNIA_BIN, "evennia_runner.py")
EVENNIA_SERVER = os.path.join(EVENNIA_LIB, "server")
EVENNIA_RUNNER = os.path.join(EVENNIA_SERVER, "evennia_runner.py")
EVENNIA_TEMPLATE = os.path.join(EVENNIA_LIB, "game_template")
EVENNIA_BINTESTING = os.path.join(EVENNIA_BIN, "testing")
EVENNIA_DUMMYRUNNER = os.path.join(EVENNIA_BINTESTING, "dummyrunner.py")
EVENNIA_TESTING = os.path.join(EVENNIA_SERVER, "testing")
EVENNIA_DUMMYRUNNER = os.path.join(EVENNIA_TESTING, "dummyrunner.py")
TWISTED_BINARY = "twistd"
@ -59,11 +59,6 @@ TWISTED_MIN = '12.0'
DJANGO_MIN = '1.7'
DJANGO_REC = '1.7'
# add Evennia root to PYTHONPATH note that bin/evennia.py is
# automatically added to sys.modules and will be imported first, which
# is not what we want. So we remove it manually and set the path so
# the root/evennia package is found first instead.
del sys.modules["evennia"]
sys.path[0] = EVENNIA_ROOT
#------------------------------------------------------------
@ -656,7 +651,7 @@ def init_game_directory(path, check_db=True):
print ERROR_WINDOWS_WIN32API
sys.exit()
if not os.path.exists(os.path.join(EVENNIA_BIN, TWISTED_BINARY)):
if not os.path.exists(os.path.join(EVENNIA_SERVER, TWISTED_BINARY)):
# Test for executable twisted batch file. This calls the
# twistd.py executable that is usually not found on the
# path in Windows. It's not enough to locate

View file

@ -26,17 +26,10 @@ def get_scripts():
Determine which executable scripts should be added. For Windows,
this means creating a .bat file.
"""
execlist = []
if os.name == "nt":
# Windows
with open(os.path.join("bin", "evennia.bat"), "w") as bat_file:
bat_file.write("@\"%s\" \"%s\" %%*" % (sys.executable, "evennia"))
execlist.extend(["bin/evennia.bat", "bin/evennia"])
return [os.path.join("bin", "windows", "evennia.bat"), os.path.join("bin", "windows", "evennia.py")]
else:
# Linux, Mac
execlist.append("bin/evennia")
execlist.append("bin/evennia_runner.py")
return execlist
return [os.path.join("bin", "unix", "evennia")]
def get_version():