[Checkins] SVN: zope.kgs/trunk/src/zope/kgs/ Allow the user to filter by package name.

Marius Gedminas marius at pov.lt
Tue Aug 26 23:51:23 EDT 2008


Log message for revision 90373:
  Allow the user to filter by package name.
  
  

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

-=-
Modified: zope.kgs/trunk/src/zope/kgs/README.txt
===================================================================
--- zope.kgs/trunk/src/zope/kgs/README.txt	2008-08-27 03:50:57 UTC (rev 90372)
+++ zope.kgs/trunk/src/zope/kgs/README.txt	2008-08-27 03:51:22 UTC (rev 90373)
@@ -323,7 +323,15 @@
   >>> latest.main(('-m', cfgFileReal))
   z3c.formdemo: 1.1.1, 1.1.2
 
+Sometimes you're only interested in changes that apply to a single package,
+and you won't want to wait for the script to query all of the others
 
+  >>> latest.main(('-m', cfgFileReal, 'zope.app.server'))
+
+  >>> latest.main(('-m', cfgFileReal, 'z3c.formdemo'))
+  z3c.formdemo: 1.1.1, 1.1.2
+
+
 Introduction Page
 -----------------
 

Modified: zope.kgs/trunk/src/zope/kgs/latest.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/latest.py	2008-08-27 03:50:57 UTC (rev 90372)
+++ zope.kgs/trunk/src/zope/kgs/latest.py	2008-08-27 03:51:22 UTC (rev 90373)
@@ -14,7 +14,7 @@
 """For each package in the KGS, find all versions later than the last one
 listed in the KGS for that package.
 
-Usage: %s [-m] package-cfg-path
+Usage: %s [-m] package-cfg-path [packagename ...]
 
 * -m
 
@@ -23,6 +23,12 @@
 * ``package-cfg-path``
 
   This is the path to the controlled packages configuration file.
+
+* ``packagename``
+
+  If you're interested in only some of the KGS packages, you can limit the
+  output to those by listing their names on the command line.
+
 """
 import lxml.etree
 import os
@@ -53,10 +59,13 @@
     return versions
 
 
-def generateList(packageConfigPath, minorOnly):
+def generateList(packageConfigPath, minorOnly, packages=()):
     kgs = zope.kgs.kgs.KGS(packageConfigPath)
 
     for package in kgs.packages:
+        if packages and package.name not in packages:
+            continue
+
         kgsVersion = pkg_resources.parse_version(package.versions[-1])
         serverVersions = getAllVersions(package.name)
 
@@ -78,7 +87,7 @@
     if args is None:
         args = sys.argv[1:]
 
-    if len(args) < 1:
+    if len(args) < 1 or args[0] in ('-h', '--help'):
         print __file__.__doc__ % sys.argv[0]
         sys.exit(1)
 
@@ -89,4 +98,4 @@
 
     packageConfigPath = os.path.abspath(args[0])
 
-    generateList(packageConfigPath, minorOnly)
+    generateList(packageConfigPath, minorOnly, args[1:])



More information about the Checkins mailing list