[cig-commits] r13787 - in seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness: . bin lib lib/chino
leif at geodynamics.org
leif at geodynamics.org
Mon Dec 22 12:38:25 PST 2008
Author: leif
Date: 2008-12-22 12:38:25 -0800 (Mon, 22 Dec 2008)
New Revision: 13787
Added:
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/blank
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/config.py
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/template.py
Removed:
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino/
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/config.py
Modified:
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/bin/chino
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py
Log:
Allow users to run 'chino' without installing it (1 of 2).
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/bin/chino
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/bin/chino 2008-12-22 18:48:50 UTC (rev 13786)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/bin/chino 2008-12-22 20:38:25 UTC (rev 13787)
@@ -1,9 +1,15 @@
#!/usr/bin/env python
+import os, sys
+from os.path import dirname, isdir, join
+
+lib = join(dirname(__file__), "lib")
+if isdir(lib):
+ sys.path.insert(1, lib)
+
from chino.harness import Harness
from chino.config import Config
from chino.template import copyTemplate
-import os, sys
def printUsage():
print "usage: chino [ACTION] [options]"
Copied: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino (from rev 13414, seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino)
Copied: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/blank (from rev 13786, seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino/blank)
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/blank (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/blank 2008-12-22 20:38:25 UTC (rev 13787)
@@ -0,0 +1 @@
+link ../../../3D/blank
\ No newline at end of file
Deleted: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/config.py
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino/config.py 2008-11-26 23:47:52 UTC (rev 13414)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/config.py 2008-12-22 20:38:25 UTC (rev 13787)
@@ -1,43 +0,0 @@
-
-from ConfigParser import ConfigParser, NoOptionError
-
-
-class Config(object):
-
- filename = "chino.cfg"
-
- #@classmethod
- def fromFile(cls):
- parser = ConfigParser()
- parser.readfp(open(cls.filename))
-
- modelDir = parser.get("general", "model-dir")
- fc = parser.get("make", "FC")
- try:
- fcflags_f90 = parser.get("make", "FCFLAGS_f90")
- except NoOptionError:
- fcflags_f90 = ""
-
- return Config(modelDir = modelDir, fc = fc, fcflags_f90 = fcflags_f90)
- fromFile = classmethod(fromFile)
-
- #@classmethod
- def configure(cls):
- s = open(cls.filename, "w")
- print >>s
- print >>s, "[general]"
- print >>s, "model-dir = mymodel ; path to model directory"
- print >>s
- print >>s, "[make]"
- print >>s, "FC = f90 ; Fortran-90 compiler command"
- print >>s
- print >>s, "# flag to recognize .f90 files as source (if needed); e.g.:"
- print >>s, "#FCFLAGS_f90 = -qsuffix=f=f90"
- print >>s, "#FCFLAGS_f90 = -Tf"
- print >>s
- s.close()
- return cls.fromFile()
- configure = classmethod(configure)
-
- def __init__(self, **kwds):
- self.__dict__.update(kwds)
Copied: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/config.py (from rev 13786, seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino/config.py)
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/config.py (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/config.py 2008-12-22 20:38:25 UTC (rev 13787)
@@ -0,0 +1,43 @@
+
+from ConfigParser import ConfigParser, NoOptionError
+
+
+class Config(object):
+
+ filename = "chino.cfg"
+
+ #@classmethod
+ def fromFile(cls):
+ parser = ConfigParser()
+ parser.readfp(open(cls.filename))
+
+ modelDir = parser.get("general", "model-dir")
+ fc = parser.get("make", "FC")
+ try:
+ fcflags_f90 = parser.get("make", "FCFLAGS_f90")
+ except NoOptionError:
+ fcflags_f90 = ""
+
+ return Config(modelDir = modelDir, fc = fc, fcflags_f90 = fcflags_f90)
+ fromFile = classmethod(fromFile)
+
+ #@classmethod
+ def create(cls, name):
+ s = open(cls.filename, "w")
+ print >>s
+ print >>s, "[general]"
+ print >>s, "model-dir = %s ; path to model directory" % name
+ print >>s
+ print >>s, "[make]"
+ print >>s, "FC = f90 ; Fortran-90 compiler command"
+ print >>s
+ print >>s, "# flag to recognize .f90 files as source (if needed); e.g.:"
+ print >>s, "#FCFLAGS_f90 = -qsuffix=f=f90"
+ print >>s, "#FCFLAGS_f90 = -Tf"
+ print >>s
+ s.close()
+ return cls.fromFile()
+ create = classmethod(create)
+
+ def __init__(self, **kwds):
+ self.__dict__.update(kwds)
Copied: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/template.py (from rev 13786, seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino/template.py)
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/template.py (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/lib/chino/template.py 2008-12-22 20:38:25 UTC (rev 13787)
@@ -0,0 +1,13 @@
+
+templateFiles = [
+ "blank/1D_ref/my_1D_ref_model.f90",
+ "blank/crust/my_crustal_model.f90",
+ "blank/my_mantle_model.f90",
+ ]
+
+def copyTemplate(name):
+ from shutil import copytree
+ from os.path import dirname, join
+ templateDir = join(dirname(__file__), "blank")
+ copytree(templateDir, name)
+ return
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py 2008-12-22 18:48:50 UTC (rev 13786)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py 2008-12-22 20:38:25 UTC (rev 13787)
@@ -1,6 +1,12 @@
from distutils.core import setup
+import sys
+from os.path import dirname, isdir, join
+lib = join(dirname(__file__), "lib")
+if isdir(lib):
+ sys.path.insert(1, lib)
+
from chino.harness import harnessSourceFiles, harnessHeaderFiles
from chino.template import templateFiles
data = []
@@ -16,5 +22,6 @@
author_email = 'leif at geodynamics.org',
packages = ['chino'],
package_data = {'chino': data},
+ package_dir = {'': 'lib'},
scripts = ['bin/chino'],
)
More information about the CIG-COMMITS
mailing list