Changed all src/ and ev references to evennia

This commit is contained in:
Griatch 2015-01-07 15:36:32 +01:00
parent 3ff937a6fd
commit ad3f19896c
118 changed files with 565 additions and 661 deletions

View file

@ -14,8 +14,8 @@ user.
"""
import re
from src.utils import utils
from src.utils.utils import to_str, to_unicode
from evennia.utils import utils
from evennia.utils.utils import to_str, to_unicode
# ANSI definitions

View file

@ -90,7 +90,7 @@ It seems the bottom of the box is a bit loose.
# close the @drop command since it's the end of the file)
-------------------------
An example batch file is game/gamesrc/commands/examples/batch_example.ev.
An example batch file is contribs/examples/batch_example.ev.
==========================================================================
@ -144,8 +144,8 @@ Example batch.py file
import traceback
from django.config import settings
from src.utils import create
from game.gamesrc.typeclasses import basetypes
from evennia.utils import create
from types import basetypes
GOLD = 10
@ -171,7 +171,7 @@ import traceback
import sys
#from traceback import format_exc
from django.conf import settings
from src.utils import utils
from evennia.utils import utils
#from game import settings as settings_module
ENCODINGS = settings.ENCODINGS
@ -199,7 +199,7 @@ def read_batchfile(pythonpath, file_ending='.py'):
"""
# open the file
if pythonpath and not (pythonpath.startswith('src.') or pythonpath.startswith('game.')
if pythonpath and not (pythonpath.startswith('evennia.') or pythonpath.startswith('game.')
or pythonpath.startswith('contrib.')):
abspaths = []
for basepath in settings.BASE_BATCHPROCESS_PATHS:

View file

@ -24,8 +24,8 @@ Models covered:
from django.conf import settings
from django.db import IntegrityError
from django.utils import timezone
from src.utils import logger
from src.utils.utils import make_iter, class_from_module, dbid_to_obj
from evennia.utils import logger
from evennia.utils.utils import make_iter, class_from_module, dbid_to_obj
# delayed imports
_User = None
@ -73,7 +73,7 @@ def create_object(typeclass=None, key=None, location=None,
"""
global _ObjectDB
if not _ObjectDB:
from src.objects.models import ObjectDB as _ObjectDB
from evennia.objects.models import ObjectDB as _ObjectDB
typeclass = typeclass if typeclass else settings.BASE_OBJECT_TYPECLASS
@ -138,7 +138,7 @@ def create_script(typeclass, key=None, obj=None, player=None, locks=None,
same key to all scripts of the same type). Set obj
to tie this script to a particular object.
See src.scripts.manager for methods to manipulate existing
See evennia.scripts.manager for methods to manipulate existing
scripts in the database.
report_to is an obtional object to receive error messages.
@ -148,7 +148,7 @@ def create_script(typeclass, key=None, obj=None, player=None, locks=None,
"""
global _ScriptDB
if not _ScriptDB:
from src.scripts.models import ScriptDB as _ScriptDB
from evennia.scripts.models import ScriptDB as _ScriptDB
typeclass = typeclass if typeclass else settings.BASE_SCRIPT_TYPECLASS
@ -200,7 +200,7 @@ def create_help_entry(key, entrytext, category="General", locks=None):
"""
global _HelpEntry
if not _HelpEntry:
from src.help.models import HelpEntry as _HelpEntry
from evennia.help.models import HelpEntry as _HelpEntry
try:
new_help = _HelpEntry()
@ -250,7 +250,7 @@ def create_message(senderobj, message, channels=None,
"""
global _Msg
if not _Msg:
from src.comms.models import Msg as _Msg
from evennia.comms.models import Msg as _Msg
if not message:
# we don't allow empty messages.
return
@ -342,7 +342,7 @@ def create_player(key, email, password,
"""
global _PlayerDB
if not _PlayerDB:
from src.players.models import PlayerDB as _PlayerDB
from evennia.players.models import PlayerDB as _PlayerDB
typeclass = typeclass if typeclass else settings.BASE_PLAYER_TYPECLASS

View file

@ -28,9 +28,9 @@ except ImportError:
from django.db import transaction
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
from src.server.models import ServerConfig
from src.utils.utils import to_str, uses_database
from src.utils import logger
from evennia.server.models import ServerConfig
from evennia.utils.utils import to_str, uses_database
from evennievenniautils import logger
__all__ = ("to_pickle", "from_pickle", "do_pickle", "do_unpickle")

View file

@ -52,7 +52,7 @@ os.environ["DJANGO_SETTINGS_MODULE"] = "game.settings"
# del settings2
from django.conf import settings
from src.utils import utils
from evennia.utils import utils
HELPTEXT = """
@ -299,7 +299,7 @@ if __name__ == '__main__':
action_modpath = settings.DUMMYRUNNER_ACTIONS_MODULE
except AttributeError:
# use default
action_modpath = "src.utils.dummyrunner.dummyrunner_actions"
action_modpath = "evennia.utils.dummyrunner.dummyrunner_actions"
actions = utils.variable_from_module(action_modpath, "ACTIONS")
print "Connecting %i dummy client(s) to port %i using a %i second timestep ... " % (nclients, port, timestep)

View file

@ -11,7 +11,7 @@ import time
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
os.environ['DJANGO_SETTINGS_MODULE'] = 'game.settings'
import ev
from src.utils.idmapper import base as _idmapper
from evennia.utils.idmapper import base as _idmapper
LOGFILE = "logs/memoryusage.log"
INTERVAL = 30 # log every 30 seconds

View file

@ -31,7 +31,7 @@ if __name__ == "__main__":
setup_string = \
"""
from src.objects.models import ObjectDB
from evennia.objects.models import ObjectDB
g = ObjectDB.objects.get(db_key="Griatch")
"""
exec_string = \

View file

@ -131,9 +131,9 @@ form will raise an error.
import re
import copy
from src.utils.evtable import EvCell, EvTable
from src.utils.utils import all_from_module, to_str, to_unicode
from src.utils.ansi import ANSIString
from evennia.utils.evtable import EvCell, EvTable
from evennia.utils.utils import all_from_module, to_str, to_unicode
from evennia.utils.ansi import ANSIString
# non-valid form-identifying characters (which can thus be
# used as separators between forms without being detected
@ -410,7 +410,7 @@ class EvForm(object):
def _test():
"test evform"
form = EvForm("src.utils.evform_test")
form = EvForm("evennia.utils.evform_test")
# add data to each tagged form cell
form.map(cells={1: "{gTom the Bouncer{n",

View file

@ -103,8 +103,8 @@ eventual colour outside
#from textwrap import wrap
from textwrap import TextWrapper
from copy import deepcopy, copy
from src.utils.utils import to_unicode
from src.utils.ansi import ANSIString
from evennia.utils.utils import to_unicode
from evennia.utils.ansi import ANSIString
def make_iter(obj):
"Makes sure that the object is always iterable."

View file

@ -8,8 +8,8 @@ total runtime of the server and the current uptime.
from time import time
from django.conf import settings
from src.scripts.scripts import Script
from src.utils.create import create_script
from evennia.scripts.scripts import Script
from evennia.utils.create import create_script
GAMETIME_SCRIPT_NAME = "sys_game_time"
@ -75,12 +75,12 @@ class GameTime(Script):
def save():
"Force save of time. This is called by server when shutting down/reloading."
from src.scripts.models import ScriptDB
from evennia.scripts.models import ScriptDB
try:
script = ScriptDB.objects.get(db_key=GAMETIME_SCRIPT_NAME)
script.at_repeat()
except Exception:
from src.utils import logger
from evennia.utils import logger
logger.log_trace()
def _format(seconds, *divisors) :

View file

@ -15,8 +15,8 @@ from twisted.internet.reactor import callFromThread
from django.core.exceptions import ObjectDoesNotExist, FieldError
from django.db.models.base import Model, ModelBase
from django.db.models.signals import post_save, pre_delete, post_syncdb
from src.utils import logger
from src.utils.utils import dbref, get_evennia_pids, to_str
from evennia.utils import logger
from evennia.utils.utils import dbref, get_evennia_pids, to_str
from manager import SharedMemoryManager

View file

@ -45,7 +45,7 @@ should be returned. The inlinefunc should never cause a traceback.
import re
from django.conf import settings
from src.utils import utils
from evennia.utils import utils
# inline functions

View file

@ -43,7 +43,7 @@ from django.forms import CharField, Textarea
from django.forms.util import flatatt
from django.utils.html import format_html
from src.utils.dbserialize import from_pickle, to_pickle
from evennia.utils.dbserialize import from_pickle, to_pickle
try:
from django.utils.encoding import force_text
@ -276,4 +276,4 @@ try:
except ImportError:
pass
else:
add_introspection_rules([], [r"^src\.utils\.picklefield\.PickledObjectField"])
add_introspection_rules([], [r"^evennia\.utils\.picklefield\.PickledObjectField"])

View file

@ -40,7 +40,7 @@ import textwrap
import itertools
import unicodedata
from src.utils.ansi import parse_ansi
from evennia.utils.ansi import parse_ansi
py3k = sys.version_info[0] >= 3
if py3k:

View file

@ -5,7 +5,7 @@ search methods for the various database tables.
It is intended to be used e.g. as
> from src.utils import search
> from evennia.utils import search
> match = search.objects(...)
Note that this is not intended to be a complete listing of all search
@ -17,9 +17,9 @@ Also remember that all commands in this file return lists (also if
there is only one match) unless noted otherwise.
Example: To reach the search method 'get_object_with_player'
in src/objects/managers.py:
in evennia/objects/managers.py:
> from src.objects.models import ObjectDB
> from evennia.objects.models import ObjectDB
> match = Object.objects.get_object_with_player(...)

View file

@ -9,7 +9,7 @@ The main function is spawn(*prototype), where the prototype
is a dictionary like this:
GOBLIN = {
"typeclass": "game.gamesrc.objects.objects.Monster",
"typeclass": "types.objects.Monster",
"key": "goblin grunt",
"health": lambda: randint(20,30),
"resists": ["cold", "poison"],
@ -75,8 +75,8 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'game.settings'
from django.conf import settings
from random import randint
from src.objects.models import ObjectDB
from src.utils.utils import make_iter, all_from_module, dbid_to_obj
from evennia.objects.models import ObjectDB
from evennia.utils.utils import make_iter, all_from_module, dbid_to_obj
_CREATE_OBJECT_KWARGS = ("key", "location", "home", "destination")

View file

@ -118,4 +118,4 @@ class ANSIStringTestCase(TestCase):
"""
target = ANSIString('{gtest{n')
result = u'\x1b[1m\x1b[32mTest\x1b[0m'
self.checker(target.capitalize(), result, u'Test')
self.checker(target.capitalize(), result, u'Test')

View file

@ -316,8 +316,8 @@ def get_evennia_version():
def pypath_to_realpath(python_path, file_ending='.py'):
"""
Converts a path on dot python form (e.g. 'src.objects.models') to
a system path ($BASE_PATH/src/objects/models.py). Calculates all
Converts a path on dot python form (e.g. 'evennia.objects.models') to
a system path ($BASE_PATH/evennia/objects/models.py). Calculates all
paths as absoulte paths starting from the evennia main directory.
Since it seems to be a common mistake to include the file ending
@ -523,7 +523,7 @@ def server_services():
since services are launced in memory, this function will
only return any results if called from inside the game.
"""
from src.server.sessionhandler import SESSIONS
from evennia.server.sessionhandler import SESSIONS
if hasattr(SESSIONS, "server") and hasattr(SESSIONS.server, "services"):
server = SESSIONS.server.services.namedServices
else:
@ -577,9 +577,9 @@ def clean_object_caches(obj):
"""
global _TYPECLASSMODELS, _OBJECTMODELS
if not _TYPECLASSMODELS:
from src.typeclasses import models as _TYPECLASSMODELS
from evennia.typeclasses import models as _TYPECLASSMODELS
#if not _OBJECTMODELS:
# from src.objects import models as _OBJECTMODELS
# from evennia.objects import models as _OBJECTMODELS
#print "recaching:", obj
if not obj:
@ -751,8 +751,8 @@ def mod_import(module):
Args:
module - this can be either a Python path (dot-notation like
src.objects.models), an absolute path
(e.g. /home/eve/evennia/src/objects.models.py)
evennia.objects.models), an absolute path
(e.g. /home/eve/evennia/evennia/objects.models.py)
or an already import module object (e.g. models)
Returns:
an imported module. If the input argument was already a model,
@ -1067,7 +1067,7 @@ def string_partial_matching(alternatives, inp, ret_index=True):
def format_table(table, extra_space=1):
"""
Note: src.utils.prettytable is more powerful than this, but this
Note: evennia.utils.prettytable is more powerful than this, but this
function can be useful when the number of columns and rows are
unknown and must be calculated on the fly.
@ -1202,5 +1202,5 @@ def strip_control_sequences(string):
"""
global _STRIP_ANSI
if not _STRIP_ANSI:
from src.utils.ansi import strip_raw_ansi as _STRIP_ANSI
from evennia.utils.ansi import strip_raw_ansi as _STRIP_ANSI
return _RE_CONTROL_CHAR.sub('', _STRIP_ANSI(string))