|
From: <ba...@us...> - 2009-04-01 16:18:04
|
Revision: 1170
http://omc.svn.sourceforge.net/omc/?rev=1170&view=rev
Author: bartw
Date: 2009-04-01 16:17:49 +0000 (Wed, 01 Apr 2009)
Log Message:
-----------
added version to caption
Modified Paths:
--------------
pybase/trunk/OMC_InitdService.py
Modified: pybase/trunk/OMC_InitdService.py
===================================================================
--- pybase/trunk/OMC_InitdService.py 2009-03-30 13:56:02 UTC (rev 1169)
+++ pybase/trunk/OMC_InitdService.py 2009-04-01 16:17:49 UTC (rev 1170)
@@ -81,13 +81,14 @@
#------------------------------------------------------------------------------
-def _get_rpm_install_date(fullpath):
+def _get_rpm_install_date_and_version(fullpath):
try:
l=Popen([r'/bin/rpm', '-qf', '--queryformat', \
- '%{INSTALLTIME}', fullpath], \
+ '%{INSTALLTIME} %{VERSION}', fullpath], \
stdout=PIPE).communicate()[0]
if len(l):
- return pywbem.CIMDateTime.fromtimestamp(long(l))
+ l = l.split()
+ return (pywbem.CIMDateTime.fromtimestamp(long(l[0])), l[1])
except:
pass
return None
@@ -149,14 +150,17 @@
if line.startswith('#') and 'Short-Description:' in line:
caption = line[line.find(':')+1:]
break
+
+ idt_and_ver = _get_rpm_install_date_and_version(fullpath)
+ if idt_and_ver is not None:
+ idt, ver = idt_and_ver
+ model['InstallDate'] = idt
+ caption+= ' version '+ver
+
if caption:
model['Caption'] = caption
model['Description'] = caption
- idt = _get_rpm_install_date(fullpath)
- if idt:
- model['InstallDate'] = idt
-
osts = []
cmd = fullpath + ' status'
st = call(cmd, shell=True)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|