[Checkins] SVN: zope.kgs/trunk/src/zope/kgs/ Cache implementation for descriptions developed by Shane and I a long
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Jan 13 11:25:13 EST 2009
Log message for revision 94726:
Cache implementation for descriptions developed by Shane and I a long
time ago.
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-13 14:40:59 UTC (rev 94725)
+++ zope.kgs/trunk/src/zope/kgs/README.txt 2009-01-13 16:25:13 UTC (rev 94726)
@@ -362,23 +362,27 @@
>>> from zope.kgs import change
>>> change.main((cfgFileReal, cfgFileRealOrig))
- ===
- PIL
- ===
- <BLANKLINE>
- <BLANKLINE>
- ============
- z3c.formdemo
- ============
- <BLANKLINE>
- 1.1.0 (None)
- ------------
- <BLANKLINE>
- - Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with
- non-object data. Specificically, this small application demonstrates using a
- Gadfly database using pure SQL calls without any ORM.
- <BLANKLINE>
- - Feature: New "Address Book" demo that demonstrates more complex use cases,
+ ('PIL', '1.1.6')
+ ('z3c.formdemo', '1.1.0')
+ ('zope.component', '3.4.0')
+ ('zope.interface', '3.4.1')
+ ===
+ PIL
+ ===
+ <BLANKLINE>
+ <BLANKLINE>
+ ============
+ z3c.formdemo
+ ============
+ <BLANKLINE>
+ 1.1.0 (None)
+ ------------
+ <BLANKLINE>
+ - Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with
+ non-object data. Specificically, this small application demonstrates using a
+ Gadfly database using pure SQL calls without any ORM.
+ <BLANKLINE>
+ - Feature: New "Address Book" demo that demonstrates more complex use cases,
such as subforms, composite widgets, and mappings/lists
<BLANKLINE>
<BLANKLINE>
@@ -414,23 +418,27 @@
the versions listed in the current KGS are considered.
>>> change.main((cfgFileReal,))
- ===
- PIL
- ===
- <BLANKLINE>
- <BLANKLINE>
- ============
- z3c.formdemo
- ============
- <BLANKLINE>
- 1.1.0 (None)
- ------------
- <BLANKLINE>
- - Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with
- non-object data. Specificically, this small application demonstrates using a
- Gadfly database using pure SQL calls without any ORM.
- <BLANKLINE>
- - Feature: New "Address Book" demo that demonstrates more complex use cases,
+ ('PIL', '1.1.6')
+ ('z3c.formdemo', '1.1.0')
+ ('zope.component', '3.4.0')
+ ('zope.interface', '3.4.1')
+ ===
+ PIL
+ ===
+ <BLANKLINE>
+ <BLANKLINE>
+ ============
+ z3c.formdemo
+ ============
+ <BLANKLINE>
+ 1.1.0 (None)
+ ------------
+ <BLANKLINE>
+ - Feature: New "SQL Message" demo shows how ``z3c.form`` can be used with
+ non-object data. Specificically, this small application demonstrates using a
+ Gadfly database using pure SQL calls without any ORM.
+ <BLANKLINE>
+ - Feature: New "Address Book" demo that demonstrates more complex use cases,
such as subforms, composite widgets, and mappings/lists
<BLANKLINE>
<BLANKLINE>
Modified: zope.kgs/trunk/src/zope/kgs/change.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/change.py 2009-01-13 14:40:59 UTC (rev 94725)
+++ zope.kgs/trunk/src/zope/kgs/change.py 2009-01-13 16:25:13 UTC (rev 94726)
@@ -27,6 +27,7 @@
"""
import os
+import pickle
import re
import sys
import xmlrpclib
@@ -35,6 +36,14 @@
SERVER_URL = "http://cheeseshop.python.org/pypi"
+def loadCache(fn):
+ if os.path.exists(fn):
+ return pickle.load(open(fn))
+ return {}
+
+def saveCache(fn, cache):
+ pickle.dump(cache, open(fn, 'w'))
+
# version_line finds a version number and an optional date
version_line = re.compile(
r"(version\s*|)([0-9.][0-9a-zA-Z.]*)(\s*[(]([0-9a-z?-]+)[)])?",
@@ -88,6 +97,7 @@
if first <= v <= last:
yield version, release_date, '\n'.join(changes)
+
def generateChanges(currentPath, origPath):
kgs = zope.kgs.kgs.KGS(currentPath)
server = xmlrpclib.Server(SERVER_URL)
@@ -100,16 +110,27 @@
changes = []
+ cache = loadCache('descriptions.dat')
+
for package in kgs.packages:
- data = server.release_data(package.name, package.versions[-1])
+ key = package.name, package.versions[-1]
+ print key
+ if key in cache:
+ description = cache[key]
+ else:
+ data = server.release_data(package.name, package.versions[-1])
+ cache[key] = description = data['description']
+ saveCache('descriptions.dat', cache)
+
firstVersion = origVersions.get(package.name, package.versions[0])
lastVersion = package.versions[-1]
versions = list(
- extractChanges(data['description'], firstVersion, lastVersion))
+ extractChanges(description, firstVersion, lastVersion))
changes.append((package.name, versions))
return changes
+
def printChanges(changes):
for name, versions in changes:
print '=' * len(name)
More information about the Checkins
mailing list