Return-Path: Delivered-To: apmail-gump-commits-archive@www.apache.org Received: (qmail 26693 invoked from network); 10 Jul 2005 13:01:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Jul 2005 13:01:05 -0000 Received: (qmail 12927 invoked by uid 500); 10 Jul 2005 13:01:05 -0000 Mailing-List: contact commits-help@gump.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@gump.apache.org Delivered-To: mailing list commits@gump.apache.org Received: (qmail 12910 invoked by uid 99); 10 Jul 2005 13:01:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jul 2005 06:01:04 -0700 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 10 Jul 2005 06:01:02 -0700 Received: (qmail 26688 invoked by uid 65534); 10 Jul 2005 13:01:02 -0000 Message-ID: <20050710130100.26686.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@gump.apache.org From: leosimons@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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")