[cig-commits] r14165 - seismo/3D/SPECFEM3D_GLOBE/branches/pluggable

leif at geodynamics.org leif at geodynamics.org
Thu Feb 26 18:05:51 PST 2009


Author: leif
Date: 2009-02-26 18:05:50 -0800 (Thu, 26 Feb 2009)
New Revision: 14165

Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/prepare-model.py
Log:
MODEL can now point to a '.tgz' file.


Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/prepare-model.py
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/prepare-model.py	2009-02-27 01:49:14 UTC (rev 14164)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/prepare-model.py	2009-02-27 02:05:50 UTC (rev 14165)
@@ -4,7 +4,7 @@
 import os, sys
 
 
-class CopiedFromPortal:
+class MovedFromPortal:
 
     def __init__(self, model):
         self.model = model
@@ -109,19 +109,22 @@
 
 def prepareModel():
     import tarfile
+    from os.path import isdir
 
-    model = "model.tgz"
+    model = os.environ.get('MODEL')
+    assert model, "MODEL environment variable is not set"
+    
+    if isdir(model):
+        modelDir = model
+        model = "model.tgz"
+        tgzOut = tarfile.open(model, 'w:gz')
+        tgzOut.dereference = True # follow symlinks
+        tgzOut.add(modelDir)
+        tgzOut.close()
 
-    modelDir = os.environ.get('MODEL')
-    assert modelDir, "MODEL environment variable is not set"
-    tgzOut = tarfile.open(model, 'w:gz')
-    tgzOut.dereference = True # follow symlinks
-    tgzOut.add(modelDir)
-    tgzOut.close()
+    MovedFromPortal(model).prepareModel()
 
-    CopiedFromPortal(model).prepareModel()
 
-
 try:
     prepareModel()
 except Exception, e:



More information about the CIG-COMMITS mailing list