[Checkins] SVN: zope.kgs/trunk/src/zope/kgs/ * Make logging setup better.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Jan 14 00:19:30 EST 2009


Log message for revision 94732:
  * Make logging setup better.
  
  * Improve output.
  
  * Neglect incorrect data in changes report.
  

Changed:
  U   zope.kgs/trunk/src/zope/kgs/README.txt
  U   zope.kgs/trunk/src/zope/kgs/change.py

-=-
Modified: zope.kgs/trunk/src/zope/kgs/README.txt
===================================================================
--- zope.kgs/trunk/src/zope/kgs/README.txt	2009-01-14 03:25:19 UTC (rev 94731)
+++ zope.kgs/trunk/src/zope/kgs/README.txt	2009-01-14 05:19:30 UTC (rev 94732)
@@ -370,13 +370,14 @@
   PIL
   ===
   <BLANKLINE>
+  No changes or information not found.
   <BLANKLINE>
   ============
   z3c.formdemo
   ============
   <BLANKLINE>
-  1.1.0 (None)
-  ------------
+  1.1.0 (unknown)
+  ---------------
   <BLANKLINE>
   - Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with
     non-object data. Specificically, this small application demonstrates using a
@@ -400,14 +401,14 @@
   zope.interface
   ==============
   <BLANKLINE>
-  3.4.1 (None)
-  ------------
+  3.4.1 (unknown)
+  ---------------
   <BLANKLINE>
   Fixed a setup bug that prevented installation from source on systems
   without setuptools.
   <BLANKLINE>
-  3.4.0 (None)
-  ------------
+  3.4.0 (unknown)
+  ---------------
   <BLANKLINE>
   Final release for 3.4.0.
   <BLANKLINE>
@@ -418,21 +419,22 @@
 the versions listed in the current KGS are considered.
 
   >>> change.main((cfgFileReal,))
-  ('PIL', '1.1.6')
-  ('z3c.formdemo', '1.1.0')
-  ('zope.component', '3.4.0')
-  ('zope.interface', '3.4.1')
+  Processing ('PIL', '1.1.6')
+  Processing ('z3c.formdemo', '1.1.0')
+  Processing ('zope.component', '3.4.0')
+  Processing ('zope.interface', '3.4.1')
   ===
   PIL
   ===
   <BLANKLINE>
+  No changes or information not found.
   <BLANKLINE>
   ============
   z3c.formdemo
   ============
   <BLANKLINE>
-  1.1.0 (None)
-  ------------
+  1.1.0 (unknown)
+  ---------------
   <BLANKLINE>
   - Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with
     non-object data. Specificically, this small application demonstrates using a
@@ -456,14 +458,14 @@
   zope.interface
   ==============
   <BLANKLINE>
-  3.4.1 (None)
-  ------------
+  3.4.1 (unknown)
+  ---------------
   <BLANKLINE>
   Fixed a setup bug that prevented installation from source on systems
   without setuptools.
   <BLANKLINE>
-  3.4.0 (None)
-  ------------
+  3.4.0 (unknown)
+  ---------------
   <BLANKLINE>
   Final release for 3.4.0.
   <BLANKLINE>

Modified: zope.kgs/trunk/src/zope/kgs/change.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/change.py	2009-01-14 03:25:19 UTC (rev 94731)
+++ zope.kgs/trunk/src/zope/kgs/change.py	2009-01-14 05:19:30 UTC (rev 94732)
@@ -79,8 +79,15 @@
             changes = []
             version = mo.group(2)
             release_date = mo.group(4)
-        elif changes is not None and decoration_line.match(line) is None:
-            changes.append(line)
+            continue
+        elif decoration_line.match(line) is not None:
+            continue
+        elif changes is None :
+            continue
+        elif line.startswith('Detailed Documentation'):
+            yield version, release_date, changes
+            break
+        changes.append(line)
 
     # include the last list of changes
     if version is not None and changes is not None:
@@ -154,14 +161,16 @@
         print >> output, name
         print >> output, '=' * len(name)
         print >> output
+        if not versions:
+            print >> output, 'No changes or information not found.'
         for version, release_date, text in versions:
-            s = '%s (%s)' % (version, release_date)
+            s = '%s (%s)' % (version, release_date or 'unknown')
             print >> output, s
             print >> output, '-' * len(s)
-            print >> output, '\n'
+            print >> output
             print >> output, text.strip()
-            print >> output, '\n'
-        print >> output, '\n'
+            print >> output
+        print >> output
 
 
 def main(args=None):
@@ -173,7 +182,8 @@
         sys.exit(1)
 
     logger.setLevel(1)
-    logger.addHandler(logging.StreamHandler(sys.stdout))
+    handler = logging.StreamHandler(sys.stdout)
+    logger.addHandler(handler)
 
     currentPackageConfigPath = os.path.abspath(args[0])
     origPackageConfigPath = None
@@ -182,3 +192,4 @@
 
     changes = generateChanges(currentPackageConfigPath, origPackageConfigPath)
     printChanges(changes, sys.stdout)
+    logger.removeHandler(handler)



More information about the Checkins mailing list