[cig-commits] r13788 - seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness
leif at geodynamics.org
leif at geodynamics.org
Mon Dec 22 12:43:19 PST 2008
Author: leif
Date: 2008-12-22 12:43:19 -0800 (Mon, 22 Dec 2008)
New Revision: 13788
Added:
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino
Removed:
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/bin/
Modified:
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py
Log:
Allow users to run 'chino' without installing it (2 of 2).
Copied: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino (from rev 13787, seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/bin/chino)
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/chino 2008-12-22 20:43:19 UTC (rev 13788)
@@ -0,0 +1,70 @@
+#!/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
+
+def printUsage():
+ print "usage: chino [ACTION] [options]"
+ print
+ print "actions:"
+ print " create NAME"
+ print " Creates a blank SPECFEM3D GLOBE model with"
+ print " the given name in the current directory."
+ print " Generates the config file '%s'." % Config.filename
+ print
+ print " test"
+ print " Builds and tests the current model."
+ print " (This is the default action.)"
+ print
+
+def usage():
+ printUsage()
+ sys.exit(1)
+
+def test():
+ try:
+ config = Config.fromFile()
+ except IOError:
+ printUsage()
+ sys.exit("chino: missing config file '%s'" % Config.filename)
+ harness = Harness(config)
+ harness.run()
+ return
+
+def main(argv):
+ if len(argv) < 2:
+ test()
+ elif argv[1] == "create":
+ if len(argv) != 3:
+ usage()
+ name = argv[2]
+ if os.sep in name:
+ sys.exit("chino: invalid name '%s'" % name)
+ copyTemplate(name)
+ print "chino: created '%s'" % name
+ Config.create(name)
+ print "chino: be sure to edit the generated config file '%s'" % Config.filename
+ elif argv[1] == "test":
+ if len(argv) != 2:
+ usage()
+ test()
+ else:
+ usage()
+ return
+
+def start(argv):
+ try:
+ main(argv)
+ except OSError, e:
+ sys.exit("chino: %s" % e)
+ return
+
+start(sys.argv)
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py 2008-12-22 20:38:25 UTC (rev 13787)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/harness/setup.py 2008-12-22 20:43:19 UTC (rev 13788)
@@ -23,5 +23,5 @@
packages = ['chino'],
package_data = {'chino': data},
package_dir = {'': 'lib'},
- scripts = ['bin/chino'],
+ scripts = ['chino'],
)
More information about the CIG-COMMITS
mailing list