You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by le...@apache.org on 2005/01/01 17:55:19 UTC
svn commit: r123847 - in gump/branches/Dec04MajorCleanup/pygump: . python/gump/engine python/gump/test
Author: leosimons
Date: Sat Jan 1 08:55:18 2005
New Revision: 123847
URL: http://svn.apache.org/viewcvs?view=rev&rev=123847
Log:
rename workspace component to modeller, some cleanups, some fixes on the modeller
Added:
gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/modeller.py
- copied, changed from r123846, gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/workspace.py
Removed:
gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/workspace.py
Modified:
gump/branches/Dec04MajorCleanup/pygump/main.py
gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/__init__.py
gump/branches/Dec04MajorCleanup/pygump/python/gump/test/testDynagumper.py
Modified: gump/branches/Dec04MajorCleanup/pygump/main.py
Url: http://svn.apache.org/viewcvs/gump/branches/Dec04MajorCleanup/pygump/main.py?view=diff&rev=123847&p1=gump/branches/Dec04MajorCleanup/pygump/main.py&r1=123846&p2=gump/branches/Dec04MajorCleanup/pygump/main.py&r2=123847
==============================================================================
--- gump/branches/Dec04MajorCleanup/pygump/main.py (original)
+++ gump/branches/Dec04MajorCleanup/pygump/main.py Sat Jan 1 08:55:18 2005
@@ -362,6 +362,8 @@
options.starttime = time.strftime('%d %b %Y %H:%M:%S', time.localtime())
options.starttimeutc = time.strftime('%d %b %Y %H:%M:%S', time.gmtime())
+ options.version = GUMP_VERSION
+
# create logger
log = _Logger(options.logdir)
try:
@@ -369,7 +371,7 @@
log.level = DEBUG
# print some basic debug info...
- log.info("Pyump version %s starting..." % (GUMP_VERSION) )
+ log.info("Pyump version %s starting..." % (options.version) )
log.info(" (the detailed log is written to %s)" % (log.filename) )
log.debug(' - hostname : ' + options.hostname)
log.debug(' - homedir : ' + options.homedir)
Modified: gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/__init__.py
Url: http://svn.apache.org/viewcvs/gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/__init__.py?view=diff&rev=123847&p1=gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/__init__.py&r1=123846&p2=gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/__init__.py&r2=123847
==============================================================================
--- gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/__init__.py (original)
+++ gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/__init__.py Sat Jan 1 08:55:18 2005
@@ -38,15 +38,11 @@
__copyright__ = "Copyright (c) 2004-2005 The Apache Software Foundation"
__license__ = "http://www.apache.org/licenses/LICENSE-2.0"
-import logging
import os
from xml import dom
from xml.dom import minidom
-from gump.engine.workspace import WorkspaceLoader, WorkspaceObjectifier
-from gump.engine.vfs import VFS
-
def main(settings):
"""
Controls the big pygump beast. This function is called from the main.main()
@@ -60,6 +56,9 @@
- settings -- everything the engine needs to know about the environment.
"""
+ # ooh...ah...fancy :-D
+ _banner(settings.version)
+
# get engine config
config = get_config(settings)
@@ -69,12 +68,12 @@
vfsdir = os.path.join(config.paths_work, "vfs-cache" )
if not os.path.isdir(vfsdir):
os.mkdir(vfsdir);
- vfs = get_vfs(config.paths_home, vfsdir)
- workspace_loader = get_workspace_loader(vfs, log)
- workspace_objectifier = get_workspace_objectifier()
+ vfs = get_vfs(config.paths_metadata, vfsdir)
+ modeller_loader = get_modeller_loader(vfs, log)
+ modeller_objectifier = get_modeller_objectifier()
# create engine
- engine = Engine(config, log, db, workspace_loader, workspace_objectifier)
+ engine = Engine(config, log, db, modeller_loader, modeller_objectifier)
# run it
engine.initialize()
@@ -141,6 +140,7 @@
return config
def get_logger(level, name):
+ import logging
logging.basicConfig()
log = logging.getLogger(name)
log.setLevel(level)
@@ -152,13 +152,16 @@
return db
def get_vfs(filesystem_root, cache_dir):
+ from gump.engine.vfs import VFS
return VFS(filesystem_root, cache_dir)
-def get_workspace_loader(vfs, log):
- return WorkspaceLoader(vfs, log)
-
-def get_workspace_objectifier():
- return WorkspaceObjectifier
+def get_modeller_loader(vfs, log):
+ from gump.engine.modeller import Loader
+ return Loader(vfs, log)
+
+def get_modeller_objectifier():
+ from gump.engine.modeller import Objectifier
+ return Objectifier()
###
### Classes
Copied: gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/modeller.py (from r123846, gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/workspace.py)
Url: http://svn.apache.org/viewcvs/gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/modeller.py?view=diff&rev=123847&p1=gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/workspace.py&r1=123846&p2=gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/modeller.py&r2=123847
==============================================================================
--- gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/workspace.py (original)
+++ gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/modeller.py Sat Jan 1 08:55:18 2005
@@ -25,12 +25,12 @@
from xml import dom
from xml.dom import minidom
-from gump.model import Workspace # TODO
+from gump.model import Workspace
-class WorkspaceError(Exception):
+class ModellerError(Exception):
pass
-class WorkspaceLoader:
+class Loader:
"""
Parses XML, resolves HREFs, creates a big DOM tree.
"""
@@ -104,16 +104,18 @@
# copy attributes from the new node to the target node
new_attributes = new_node.attributes
- length = new_attributes.length
- i = 0
- while i < length:
- attribute = new_attributes.item(i)
- target_node.setAttributeNode(attribute)
+ if new_attributes:
+ length = len(new_attributes)
+ i = 0
+ while i < length:
+ attribute = new_attributes.item(i)
+ target_node.setAttributeNode(attribute)
# copy elements from the new node to the target node
new_elements = new_node.childNodes
- for child in new_elements:
- target_node.appendChild( child )
+ if new_elements:
+ for child in new_elements:
+ target_node.appendChild( child )
return target_node
@@ -140,27 +142,27 @@
if not parent:
# TODO provide more info
- raise WorkspaceError, "Unresolvable HREF found outside a <project/> or <module/>: %s." % (node)
+ raise ModellerError, "Unresolvable HREF found outside a <project/> or <module/>: %s." % (node)
# remove that project or module from its parent
node_to_remove_element_from = parent.parentNode
if not node_to_remove_element_from:
# TODO provide more info
- raise WorkspaceError, "Rogue <project/> or <module/> (without a parent): %s." % (parent)
+ raise ModellerError, "Rogue <project/> or <module/> (without a parent): %s." % (parent)
node_to_remove_element_from.removeChild(parent)
# but save it off for error reporting
dropped_nodes.append(parent)
-class WorkspaceObjectifier:
+class Objectifier:
"""
Turns DOM workspace into Pythonified workspace.
"""
- def get_workspace(self, config, dom):
- workspace = self._create_workspace(dom, config)
- workspace.profile = self._create_profile(dom)
+ def get_workspace(self, dom):
+ workspace = self._create_workspace(dom)
raise RuntimeError, "not implemented!" # TODO
def _create_workspace(self, dom):
- workspace = Workspace()
\ No newline at end of file
+ root = dom.getElementsByTagName('workspace').item(0)
+ workspace = Workspace(root.getAttribute('name'))
\ No newline at end of file
Deleted: /gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/workspace.py
Url: http://svn.apache.org/viewcvs/gump/branches/Dec04MajorCleanup/pygump/python/gump/engine/workspace.py?view=auto&rev=123846
==============================================================================
Modified: gump/branches/Dec04MajorCleanup/pygump/python/gump/test/testDynagumper.py
Url: http://svn.apache.org/viewcvs/gump/branches/Dec04MajorCleanup/pygump/python/gump/test/testDynagumper.py?view=diff&rev=123847&p1=gump/branches/Dec04MajorCleanup/pygump/python/gump/test/testDynagumper.py&r1=123846&p2=gump/branches/Dec04MajorCleanup/pygump/python/gump/test/testDynagumper.py&r2=123847
==============================================================================
--- gump/branches/Dec04MajorCleanup/pygump/python/gump/test/testDynagumper.py (original)
+++ gump/branches/Dec04MajorCleanup/pygump/python/gump/test/testDynagumper.py Sat Jan 1 08:55:18 2005
@@ -22,7 +22,7 @@
from gump.test.mockobjects import *
-from gump.actor.dynagumper import *
+from gump.plugins.dynagumper import *
mock = MockObjects()