Removed 'with' statement; it's available in Python2.5, but one needs to use the future import to do that, so easiest to remove it. Resolves issue 230.
This commit is contained in:
parent
7058b9f210
commit
c49fbd7d99
4 changed files with 13 additions and 9 deletions
|
|
@ -12,7 +12,7 @@ menu. Run the script with the -h flag to see usage information.
|
||||||
import os
|
import os
|
||||||
import sys, signal
|
import sys, signal
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from subprocess import Popen, call
|
from subprocess import Popen
|
||||||
|
|
||||||
# Set the Python path up so we can get to settings.py from here.
|
# Set the Python path up so we can get to settings.py from here.
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
@ -22,6 +22,7 @@ if not os.path.exists('settings.py'):
|
||||||
# make sure we have a settings.py file.
|
# 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 ..."
|
||||||
|
|
||||||
|
# this triggers the settings file creation.
|
||||||
import game.manage
|
import game.manage
|
||||||
|
|
||||||
print """
|
print """
|
||||||
|
|
@ -448,7 +449,6 @@ def main():
|
||||||
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()
|
options, args = parser.parse_args()
|
||||||
inter = options.interactive
|
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
mode = "menu"
|
mode = "menu"
|
||||||
|
|
@ -460,10 +460,10 @@ def main():
|
||||||
service = args[1]
|
service = args[1]
|
||||||
|
|
||||||
if mode not in ['menu', 'start', 'reload', 'stop']:
|
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, 'menu', 'start', 'reload' or 'stop'."
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if service not in ['server', 'portal', 'all']:
|
if service not in ['server', 'portal', 'all']:
|
||||||
print "service should be none or 'server', 'portal' or 'all'."
|
print "service should be none, 'server', 'portal' or 'all'."
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if mode == 'menu':
|
if mode == 'menu':
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,9 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
# Get Evennia version
|
# Get Evennia version
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
with open(os.pardir + os.sep + 'VERSION') as f:
|
f = open(os.pardir + os.sep + 'VERSION', 'r''')
|
||||||
VERSION = "%s-r%s" % (f.read().strip(), os.popen("hg id -i").read().strip())
|
VERSION = "%s-r%s" % (f.read().strip(), os.popen("hg id -i").read().strip())
|
||||||
|
f.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
VERSION = "Unknown version"
|
VERSION = "Unknown version"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,12 @@ class AmpClientFactory(protocol.ReconnectingClientFactory):
|
||||||
"""
|
"""
|
||||||
Called when the AMP connection to the MUD server is lost.
|
Called when the AMP connection to the MUD server is lost.
|
||||||
"""
|
"""
|
||||||
if not hasattr(self, "server_restart_mode"):
|
if hasattr(self, "server_restart_mode"):
|
||||||
|
self.maxDelay = 1
|
||||||
|
else:
|
||||||
# Don't translate this; avoiding loading django on portal side.
|
# Don't translate this; avoiding loading django on portal side.
|
||||||
self.portal.sessions.announce_all(" Portal lost connection to Server.")
|
self.maxDelay = 10
|
||||||
|
self.portal.sessions.announce_all(" ... Portal lost connection to Server.")
|
||||||
protocol.ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
protocol.ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
||||||
|
|
||||||
def clientConnectionFailed(self, connector, reason):
|
def clientConnectionFailed(self, connector, reason):
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ General helper functions that don't fit neatly under any given category.
|
||||||
They provide some useful string and conversion methods that might
|
They provide some useful string and conversion methods that might
|
||||||
be of use when designing your own game.
|
be of use when designing your own game.
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from inspect import ismodule
|
from inspect import ismodule
|
||||||
import os, sys, imp, types, math
|
import os, sys, imp, types, math
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue