gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r210006 - in /gump/branches/Gump3/pygump/python/gump: engine/objectifier.py model/__init__.py model/util.py test/testEngineWalker.py test/testModel.py test/testPluginBuilder.py test/testPluginDirBuilder.py
Date Sun, 10 Jul 2005 13:00:58 GMT
Author: leosimons
Date: Sun Jul 10 06:00:54 2005
New Revision: 210006

URL: http://svn.apache.org/viewcvs?rev=210006&view=rev
Log:
My previous commit broke the rule that the gump.model should be completely passive. Move the
responsibility for creating the working directory for the workspace to the objectifier, and
make the model passive again. In addition, make the working directory for the workspace already
include the workspace name and update the rest of the codebase to reflect that change. This
means most of the codebase now stores stuff inside the workspace subdirectory instead of in
the main 'work'. That is not always feasible, eg when we create directories or other things
before the workspace name is known.

Modified:
    gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
    gump/branches/Gump3/pygump/python/gump/model/__init__.py
    gump/branches/Gump3/pygump/python/gump/model/util.py
    gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py
    gump/branches/Gump3/pygump/python/gump/test/testModel.py
    gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py
    gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py

Modified: gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/engine/objectifier.py?rev=210006&r1=210005&r2=210006&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/engine/objectifier.py (original)
+++ gump/branches/Gump3/pygump/python/gump/engine/objectifier.py Sun Jul 10 06:00:54 2005
@@ -57,7 +57,13 @@
 ### Creation
 ###
 def _create_workspace(workspace_definition, workdir):
-    return Workspace(workspace_definition.getAttribute('name'), workdir)
+    name = workspace_definition.getAttribute('name')
+    assert isinstance(name, basestring)
+    
+    wd = os.path.join(workdir, name)
+    if not os.path.exists(wd):
+        os.makedirs(wd)
+    return Workspace(name, wd)
 
 
 def _create_repository(workspace, repository_definition):

Modified: gump/branches/Gump3/pygump/python/gump/model/__init__.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/model/__init__.py?rev=210006&r1=210005&r2=210006&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/model/__init__.py (original)
+++ gump/branches/Gump3/pygump/python/gump/model/__init__.py Sun Jul 10 06:00:54 2005
@@ -67,10 +67,7 @@
     def __init__(self, name, workdir):
         assert isinstance(name, basestring)
         assert isinstance(workdir, basestring)
-        if not os.path.isdir(workdir):
-            if os.path.exists(workdir):
-                raise Error, "Workspace %s working directory '%s' can't be created because
a file is in the way!" % (name, workdir)
-            os.makedirs(workdir)
+        assert os.path.isdir(workdir)
     
         self.name = name
         self.workdir = workdir

Modified: gump/branches/Gump3/pygump/python/gump/model/util.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/model/util.py?rev=210006&r1=210005&r2=210006&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/model/util.py (original)
+++ gump/branches/Gump3/pygump/python/gump/model/util.py Sun Jul 10 06:00:54 2005
@@ -51,7 +51,9 @@
 
 def get_workspace_directory(workspace):
     """Determine the base directory for a workspace."""
-    return abspath(join(workspace.workdir,workspace.name))
+    # the below join() now happens in objectifier._create_workspace!
+    #return abspath(join(workspace.workdir,workspace.name))
+    return abspath(workspace.workdir)
 
 def mark_failure(model_element, cause):
     """Mark a model element as "failed"."""

Modified: gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py?rev=210006&r1=210005&r2=210006&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py Sun Jul 10 06:00:54 2005
@@ -40,6 +40,9 @@
 
 class WalkerTestCase(MockTestCase):
     def setUp(self):
+        if not os.path.exists("bla"):
+            os.makedirs("bla")
+            
         self.log = self.mock()
         self.log.stubs().method("debug")
 

Modified: gump/branches/Gump3/pygump/python/gump/test/testModel.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testModel.py?rev=210006&r1=210005&r2=210006&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testModel.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testModel.py Sun Jul 10 06:00:54 2005
@@ -47,6 +47,10 @@
 from gump.model import Classdir
 
 class ModelTestCase(TestCase):
+    def setUp(self):
+        if not os.path.exists("bla"):
+            os.makedirs("bla")
+        
     def tearDown(self):
         if os.path.exists("bla"):
             import shutil

Modified: gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py?rev=210006&r1=210005&r2=210006&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py Sun Jul 10 06:00:54 2005
@@ -39,9 +39,12 @@
 class BuilderTestCase(MockTestCase):
     def test_do_script(self):
         basedir = abspath(mkdtemp())
+        plugin = False
+        w = None
         try:
-            w = Workspace("w", basedir)
-            mkdir(join(basedir,w.name))
+            wd = join(basedir,"w")
+            mkdir(wd)
+            w = Workspace("w", wd)
             r = Repository(w,"r")
             mkdir(join(basedir,w.name,r.name))
             m = Module(r,"m")

Modified: gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py?rev=210006&r1=210005&r2=210006&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py Sun Jul 10 06:00:54
2005
@@ -38,8 +38,9 @@
     def test_do_rmdir(self):
         basedir = abspath(mkdtemp())
         try:
-            w = Workspace("w", basedir)
-            mkdir(join(basedir,w.name))
+            wd = join(basedir,"w")
+            mkdir(wd)
+            w = Workspace("w", wd)
             r = Repository(w,"r")
             mkdir(join(basedir,w.name,r.name))
             m = Module(r,"m")
@@ -85,8 +86,9 @@
     def test_do_mkdir(self):
         basedir = abspath(mkdtemp())
         try:
-            w = Workspace("w", basedir)
-            mkdir(join(basedir,w.name))
+            wd = join(basedir,"w")
+            mkdir(wd)
+            w = Workspace("w", wd)
             r = Repository(w,"r")
             mkdir(join(basedir,w.name,r.name))
             m = Module(r,"m")



Mime
View raw message