commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5572 - trunk/gnue-common/utils/helpers


From: jcater
Subject: r5572 - trunk/gnue-common/utils/helpers
Date: Mon, 29 Mar 2004 17:11:34 -0600 (CST)

Author: jcater
Date: 2004-03-29 17:11:33 -0600 (Mon, 29 Mar 2004)
New Revision: 5572

Modified:
   trunk/gnue-common/utils/helpers/tools.py
Log:
added technote support

Modified: trunk/gnue-common/utils/helpers/tools.py
===================================================================
--- trunk/gnue-common/utils/helpers/tools.py    2004-03-29 23:11:20 UTC (rev 
5571)
+++ trunk/gnue-common/utils/helpers/tools.py    2004-03-29 23:11:33 UTC (rev 
5572)
@@ -14,6 +14,7 @@
     self.install = INSTALL(tool)
     self.translations = TRANSLATIONS(tool)
     self.featureplan = FEATUREPLAN(tool)
+    self.technotes = TECHNOTES(tool)
     self.docs = DOCS(tool)
 
     # Import the src/ module, if possible
@@ -360,6 +361,46 @@
 #################################################
 #
 #
+class TECHNOTES:
+  def __init__(self, tool):
+
+    self.notes = []
+    self.tool = tool
+    self.path = path = os.path.join(SVN_BASE,'gnue-%s' % tool, 
'doc','technotes')
+    if os.path.exists(path):
+      for file in glob.glob(path+'/[0-9]*.txt'):
+        self.notes.append(os.path.split(file)[-1])
+    else:
+      print "WARNING: gnue-%s has no doc/technotes directory" % tool
+    self.notes.sort()
+
+  def getTechnote(self, note):
+    inp = open(self.path + '/' + note)
+    lines = inp.readlines()
+    inp.close()
+
+    in_header = True
+    text = []
+    props = { 'status': None,
+              'title': None}
+    for line in lines:
+      line = line[:-1]
+      if not line.strip() and in_header:
+        in_header = False
+      elif in_header:
+        try:
+          field, value = line.split(':',1)
+          props[field.lower()] = value.strip()
+        except ValueError:
+          print "WARNING: gnue-%s doc/technotes/%s has invalid header line:" % 
(tool, note)
+          print "   ", line
+      text.append(line)
+
+    return (props, string.join(text,'\n'))
+
+#################################################
+#
+#
 class ISO_CODES:
   def __init__(self):
     self.countries = {}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]