[Checkins] SVN: zope.kgs/trunk/s * Beginnings of date support in KGS.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Jan 27 06:25:39 EST 2009
Log message for revision 95119:
* Beginnings of date support in KGS.
* Document recent additions to KGS.
Changed:
U zope.kgs/trunk/setup.py
U zope.kgs/trunk/src/zope/kgs/README.txt
U zope.kgs/trunk/src/zope/kgs/kgs.py
U zope.kgs/trunk/src/zope/kgs/site.py
-=-
Modified: zope.kgs/trunk/setup.py
===================================================================
--- zope.kgs/trunk/setup.py 2009-01-27 11:22:03 UTC (rev 95118)
+++ zope.kgs/trunk/setup.py 2009-01-27 11:25:38 UTC (rev 95119)
@@ -49,6 +49,8 @@
test=['zope.testing'],
),
install_requires=[
+ 'dateutil',
+ 'docutils',
'lxml',
'setuptools',
'zc.buildout',
Modified: zope.kgs/trunk/src/zope/kgs/README.txt
===================================================================
--- zope.kgs/trunk/src/zope/kgs/README.txt 2009-01-27 11:22:03 UTC (rev 95118)
+++ zope.kgs/trunk/src/zope/kgs/README.txt 2009-01-27 11:25:38 UTC (rev 95119)
@@ -19,7 +19,9 @@
... [KGS]
... name = zope-dev
... version = 1.2.0
+ ... date = 2009-01-01
... changelog = CHANGES.txt
+ ... announcement = ANNOUNCEMENT.txt
...
... [packageA]
... versions = 1.0.0
@@ -37,8 +39,34 @@
As you can see, this file uses an INI-style format. The "DEFAULT" section is
special, as it will insert the specified options into all other sections as
default. The "KGS" section specifies some global information about the KGS,
-such as the name of the KGS.
+such as the name of the KGS. Since this section references two external files,
+we should quickly create those.
+ >>> import os
+ >>> dir = os.path.dirname(cfgFile)
+
+ >>> open(os.path.join(dir, 'CHANGES.txt'), 'w').write('''\
+ ... =======
+ ... Changes
+ ... =======
+ ...
+ ... packageA
+ ... ========
+ ...
+ ... Version 1.0.0
+ ... -------------
+ ...
+ ... * Initial Release
+ ... ''')
+
+ >>> open(os.path.join(dir, 'ANNOUNCEMENT.txt'), 'w').write('''\
+ ... =======================
+ ... zope-dev 1.2.0 Released
+ ... =======================
+ ...
+ ... The announcement text!
+ ... ''')
+
All other sections refer to package names. Currently each package section
supports two options. The "versions" option lists all versions that are known
to work in the KGS. Those versions should *always* only be bug fixes to the
@@ -626,13 +654,23 @@
>>> myKGS
<KGS 'zope-dev'>
-The name and version of the KGS is available via:
+The name, version and date of the KGS is available via:
>>> myKGS.name
'zope-dev'
>>> myKGS.version
'1.2.0'
+ >>> myKGS.date
+ datetime.date(2009, 1, 1)
+When the changelog and/or announcement files are available, the KGS references
+the absolute path:
+
+ >>> myKGS.changelog
+ '.../CHANGES.txt'
+ >>> myKGS.announcement
+ '.../ANNOUNCEMENT.txt'
+
The packages are available under `packages`:
>>> myKGS.packages
Modified: zope.kgs/trunk/src/zope/kgs/kgs.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/kgs.py 2009-01-27 11:22:03 UTC (rev 95118)
+++ zope.kgs/trunk/src/zope/kgs/kgs.py 2009-01-27 11:25:38 UTC (rev 95119)
@@ -12,6 +12,8 @@
#
##############################################################################
"""KGS configuration file parser."""
+import datetime
+import dateutil.parser
import os.path
import urllib2
import ConfigParser
@@ -95,6 +97,7 @@
name = u'noname'
version = u'unknown'
+ date = None
changelog = None
announcement = None
packages = ()
@@ -114,6 +117,9 @@
section, basePath, 'changelog', self.changelog)
self.announcement = _getAbsolutePath(
section, basePath, 'announcement', self.announcement)
+ dateStr = section.get('date')
+ if dateStr:
+ self.date = dateutil.parser.parse(dateStr).date()
del result[MAIN_SECTION]
self.packages = []
sections = result.keys()
Modified: zope.kgs/trunk/src/zope/kgs/site.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/site.py 2009-01-27 11:22:03 UTC (rev 95118)
+++ zope.kgs/trunk/src/zope/kgs/site.py 2009-01-27 11:25:38 UTC (rev 95119)
@@ -78,6 +78,7 @@
'title': title})
versionData = {
'name': set.version,
+ 'date': set.date and str(set.date) or None,
'features': features,
'changelog': {
'url':_getRenderedFilename(set.version, set.changelog),
@@ -144,8 +145,14 @@
if set.announcement:
shutil.move(set.announcement, versionDir)
- # Let's now recreate some of the important variables.
+ # Recreate the KGS Path
kgsPath = os.path.join(versionDir, 'controlled-packages.cfg')
+
+ # Insert date into KGS, if it is not set.
+ if not set.date:
+ pass
+
+ # Recreate the KGS
set = kgs.KGS(kgsPath)
# Create the buildout config file
More information about the Checkins
mailing list