[livecoding] r135 committed - - reloader.py: Fixed script version numbering in UPDATE mode. The scr...

1 view
Skip to first unread message

livec...@googlecode.com

unread,
Feb 12, 2010, 7:43:05 PM2/12/10
to py-livecod...@googlegroups.com
Revision: 135
Author: richard.m.tew
Date: Fri Feb 12 16:38:23 2010
Log: - reloader.py: Fixed script version numbering in UPDATE mode. The
script version numbering system was designed within the use of the
OVERWRITE mode. This meant that newly loaded scripts would be put in place
of their old version, with a version number one higher. However, in UPDATE
mode the contents of the new script are copied into the old script. The
version number wasn't bumped, and so the unit test was failing.
http://code.google.com/p/livecoding/source/detail?r=135

Modified:
/trunk/reloader.py

=======================================
--- /trunk/reloader.py Thu Feb 11 18:29:38 2010
+++ /trunk/reloader.py Fri Feb 12 16:38:23 2010
@@ -171,7 +171,7 @@
filePath = oldScriptFile.filePath
namespacePath = oldScriptFile.namespacePath

- logger.debug("CreateNewScript namespace='%s', file='%s'",
namespacePath, filePath)
+ logger.debug("CreateNewScript namespace='%s', file='%s',
oldVersion=%d", namespacePath, filePath, oldScriptFile.version)

# Read in and compile the modified script file.
scriptDirectory = self.FindDirectory(filePath)
@@ -218,10 +218,12 @@
self.RemoveLeakedAttributes(newScriptFile)
elif self.mode == MODE_UPDATE:
self.UpdateModuleAttributes(oldScriptFile, newScriptFile,
namespace, overwritableAttributes=self.leakedAttributes)
+ oldScriptFile.version += 1

# Remove as leaks the attributes the new version contributed.
self.RemoveLeakedAttributes(newScriptFile)

+ # overwritableAttributes: why is this passed in?
def UpdateModuleAttributes(self, scriptFile, newScriptFile, namespace,
overwritableAttributes=set()):
logger.debug("UpdateModuleAttributes")

@@ -290,6 +292,7 @@

scriptFile.AddContributedAttributes(contributedAttributes)
newScriptFile.SetContributedAttributes(contributedAttributes)
+ # self.leakedAttributes |= leakedAttributes

def UpdateClass(self, value, newValue, globals_):
if value is None or value is NonExistentValue:

Reply all
Reply to author
Forward
0 new messages