[cig-commits] r6268 - cs/pythia/trunk/pyre/applications
leif at geodynamics.org
leif at geodynamics.org
Thu Mar 15 15:09:09 PDT 2007
Author: leif
Date: 2007-03-15 15:09:09 -0700 (Thu, 15 Mar 2007)
New Revision: 6268
Modified:
cs/pythia/trunk/pyre/applications/Executive.py
cs/pythia/trunk/pyre/applications/Shell.py
Log:
Initial, rough implementation of "--version".
Modified: cs/pythia/trunk/pyre/applications/Executive.py
===================================================================
--- cs/pythia/trunk/pyre/applications/Executive.py 2007-03-15 20:45:19 UTC (rev 6267)
+++ cs/pythia/trunk/pyre/applications/Executive.py 2007-03-15 22:09:09 UTC (rev 6268)
@@ -168,6 +168,21 @@
return
+ def version(self):
+ from merlin import get_provider, Requirement
+ try:
+ req = self.requires()
+ except ImportError:
+ print "Please consider writing version info for this application."
+ return
+ req = Requirement.parse(req)
+ provider = get_provider(req)
+ # NYI: make this pretty
+ for line in provider.get_metadata_lines("PKG-INFO"):
+ print line
+ return
+
+
def __init__(self):
self.arg0 = self.name
self._requires = None
Modified: cs/pythia/trunk/pyre/applications/Shell.py
===================================================================
--- cs/pythia/trunk/pyre/applications/Shell.py 2007-03-15 20:45:19 UTC (rev 6267)
+++ cs/pythia/trunk/pyre/applications/Shell.py 2007-03-15 22:09:09 UTC (rev 6268)
@@ -24,6 +24,9 @@
class Shell(Configurable):
+ import pyre.inventory
+ version = pyre.inventory.bool("version")
+
import pyre.hooks
excepthook = pyre.hooks.facility("excepthook", family="excepthook",
default=defaultExceptHook)
@@ -113,6 +116,8 @@
action = action and getattr(app, action)
if action:
action()
+ elif self.version:
+ app.version()
elif app._helpRequested:
app.help()
else:
More information about the cig-commits
mailing list