Log message for revision 82417:
  added
  

Changed:
  A   Zope/trunk/inst/generate_externals.py

-=-
Added: Zope/trunk/inst/generate_externals.py
===================================================================
--- Zope/trunk/inst/generate_externals.py                               (rev 0)
+++ Zope/trunk/inst/generate_externals.py       2007-12-24 04:39:41 UTC (rev 
82417)
@@ -0,0 +1,70 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+
+
+""" Generate svn:external files (with help of the KGS)
+    Written by Andreas Jung, 2007
+"""
+
+# Requires some local files that contain the current
+# list of externals on a per-directory basis:
+#
+# svn propget svn:externals lib/python/ >inst/lib_python.txt
+# svn propget svn:externals lib/python/zope >inst/lib_python_zope.txt
+# svn propget svn:externals lib/python/zope/app >inst/lib_python_zope_app.txt
+
+import sys
+import urllib2
+from ConfigParser import ConfigParser, NoOptionError
+
+error = sys.stderr
+
+# download current KGS index
+kgs_url = 'http://download.zope.org/zope3.4/versions.cfg'
+open('kgs.ini', 'w').write(urllib2.urlopen(kgs_url).read())
+CP = ConfigParser()
+CP.read('kgs.ini')
+
+for name, prefix in (('lib_python', None), 
+                     ('lib_python_zope', 'zope'), 
+                     ('lib_python_zope_app', 'zope.app')):
+
+    outname = name + '.ext'
+    print >>error, 'Generating externals file %s' % outname
+
+    fp = open(outname, 'w')
+    for line in open(name + '.txt'):
+        line = line.strip()
+        if not line: continue
+        module, url = line.split(' ', 1)
+        module = module.strip()
+        url = url.strip()
+
+        # generate full module name as it appear in the KGS idnex
+        full_mod_name = module
+        if prefix:
+            full_mod_name = '%s.%s' % (prefix, module)
+
+        try:
+            tag = CP.get('versions', full_mod_name)
+            n = '/'.join(full_mod_name.split('.'))
+            url = 'svn://svn.zope.org/repos/main/%s/tags/%s/src/%s' % 
(full_mod_name, tag, n)
+            ok = True
+        except NoOptionError:
+            ok = False
+            print >>error, 'WARN: KGS incomplete - %s not found' % 
full_mod_name
+
+        if not ok:
+            print >>fp, '# warning: KGS incomplete, using old URL for %s' % 
module
+        print >>fp, '%-20s %s' % (module, url)                
+    fp.close()

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to