[Checkins] SVN: zc.mirrorcheeseshopslashsimple/trunk/ Let's use the zope.release code to parse the KGS config file. This way extensions are

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Nov 10 14:27:08 EST 2007


Log message for revision 81729:
  Let's use the zope.release code to parse the KGS config file. This way extensions are 
  handled correctly. This added a dependency on zope.release to the package, but I think 
  this is ok. I tested everything and it works just fine.
  
  

Changed:
  _U  zc.mirrorcheeseshopslashsimple/trunk/
  U   zc.mirrorcheeseshopslashsimple/trunk/buildout.cfg
  U   zc.mirrorcheeseshopslashsimple/trunk/setup.py
  U   zc.mirrorcheeseshopslashsimple/trunk/src/zc/mirrorcheeseshopslashsimple.py

-=-

Property changes on: zc.mirrorcheeseshopslashsimple/trunk
___________________________________________________________________
Name: svn:externals
   + zope.release svn://svn.zope.org/repos/main/zope.release/trunk


Modified: zc.mirrorcheeseshopslashsimple/trunk/buildout.cfg
===================================================================
--- zc.mirrorcheeseshopslashsimple/trunk/buildout.cfg	2007-11-10 18:57:30 UTC (rev 81728)
+++ zc.mirrorcheeseshopslashsimple/trunk/buildout.cfg	2007-11-10 19:27:08 UTC (rev 81729)
@@ -1,6 +1,6 @@
 [buildout]
 parts = py
-develop = .
+develop = . zope.release
 
 [py]
 recipe = zc.recipe.egg

Modified: zc.mirrorcheeseshopslashsimple/trunk/setup.py
===================================================================
--- zc.mirrorcheeseshopslashsimple/trunk/setup.py	2007-11-10 18:57:30 UTC (rev 81728)
+++ zc.mirrorcheeseshopslashsimple/trunk/setup.py	2007-11-10 19:27:08 UTC (rev 81729)
@@ -4,7 +4,7 @@
     name='zc.mirrorcheeseshopslashsimple',
     version='0.2',
     package_dir = {'': 'src'},
-    install_requires = ['zc.lockfile'],
+    install_requires = ['zc.lockfile', 'zope.release'],
     entry_points = dict(console_scripts=[
         'update-simple-mirror = zc.mirrorcheeseshopslashsimple:update',
         'generate-controlled-pages = \

Modified: zc.mirrorcheeseshopslashsimple/trunk/src/zc/mirrorcheeseshopslashsimple.py
===================================================================
--- zc.mirrorcheeseshopslashsimple/trunk/src/zc/mirrorcheeseshopslashsimple.py	2007-11-10 18:57:30 UTC (rev 81728)
+++ zc.mirrorcheeseshopslashsimple/trunk/src/zc/mirrorcheeseshopslashsimple.py	2007-11-10 19:27:08 UTC (rev 81729)
@@ -15,6 +15,7 @@
 import ConfigParser
 import os, sys, time, urllib, urllib2, xmlrpclib
 import zc.lockfile
+import zope.release.kgs
 
 lock_file_path = 'pypy-poll-access.lock'
 poll_time_path = 'pypy-poll-timestamp'
@@ -172,8 +173,7 @@
         if last_update > last_modified:
             return
 
-    config = ConfigParser.RawConfigParser()
-    config.read(cpath)
+    kgs = zope.release.kgs.KGS(cpath)
 
     server = xmlrpclib.Server('http://cheeseshop.python.org/pypi')
 
@@ -182,23 +182,23 @@
 
     link_templ = '<a href="%(url)s#md5=%(md5_digest)s">%(filename)s</a><br/>'
 
-    for package in config.sections():
-        print package
-        package_path = os.path.join(dest, package)
+    for package in kgs.packages:
+        print package.name
+        package_path = os.path.join(dest, package.name)
         links = []
-        for version in config.get(package, 'versions').split():
-            dist_links = server.package_urls(package, version)
+        for version in package.versions:
+            dist_links = server.package_urls(package.name, version)
             for link in dist_links:
                 links.append(link_templ %link)
         if links:
             if not os.path.exists(package_path):
                 os.mkdir(package_path)
             open(os.path.join(package_path, 'index.html'), 'w').write(
-                templ %{'package': package, 'links': '\n'.join(links)})
+                templ %{'package': package.name, 'links': '\n'.join(links)})
         else:
             # A small fallback, in case PyPI does not maintain the release
             # files.
-            get_page(dest, package, True)
+            get_page(dest, package.name, True)
 
     # Save the last generation date-time.
     open(tspath, 'w').write(str(time.time()))



More information about the Checkins mailing list