[Checkins] SVN: zope.kgs/trunk/src/zope/kgs/ Added support for release files. Yipee.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Jan 27 08:55:03 EST 2009
Log message for revision 95191:
Added support for release files. Yipee.
Changed:
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
U zope.kgs/trunk/src/zope/kgs/templates/master.pt
-=-
Modified: zope.kgs/trunk/src/zope/kgs/README.txt
===================================================================
--- zope.kgs/trunk/src/zope/kgs/README.txt 2009-01-27 13:46:23 UTC (rev 95190)
+++ zope.kgs/trunk/src/zope/kgs/README.txt 2009-01-27 13:55:02 UTC (rev 95191)
@@ -22,6 +22,10 @@
... date = 2009-01-01
... changelog = CHANGES.txt
... announcement = ANNOUNCEMENT.txt
+ ... files =
+ ... zope-dev-1.2.0.tgz
+ ... zope-dev-1.2.0.zip
+ ... zope-dev-1.2.0.exe
...
... [packageA]
... versions = 1.0.0
@@ -39,8 +43,8 @@
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. Since this section references two external files,
-we should quickly create those.
+such as the name of the KGS. Since this section references several external
+files, we should quickly create those.
>>> import os
>>> dir = os.path.dirname(cfgFile)
@@ -67,6 +71,9 @@
... The announcement text!
... ''')
+ >>> open(os.path.join(dir, 'zope-dev-1.2.0.tgz'), 'w').write('tgz')
+ >>> open(os.path.join(dir, 'zope-dev-1.2.0.exe'), 'w').write('exe')
+
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
@@ -523,7 +530,7 @@
>>> from pprint import pprint
>>> pprint(sorted(os.listdir(siteDir)))
- ['3.4.0b2', 'cf-timestamp', 'index.html', 'resources']
+ ['3.4.0b2', 'cf-timestamp', 'index.html', 'intro.html', 'resources']
>>> sorted(os.listdir(os.path.join(siteDir, '3.4.0b2')))
['ANNOUNCEMENT.html', 'CHANGES.html',
@@ -579,6 +586,12 @@
>>> myKGS.announcement
'.../ANNOUNCEMENT.txt'
+The same is true for other release-related files:
+
+ >>> myKGS.files
+ ('.../zope-dev-1.2.0.tgz',
+ '.../zope-dev-1.2.0.exe')
+
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 13:46:23 UTC (rev 95190)
+++ zope.kgs/trunk/src/zope/kgs/kgs.py 2009-01-27 13:55:02 UTC (rev 95191)
@@ -100,6 +100,7 @@
date = None
changelog = None
announcement = None
+ files = ()
packages = ()
def __init__(self, path):
@@ -111,15 +112,28 @@
result = _open(basePath, self.path, [])
if MAIN_SECTION in result:
section = result[MAIN_SECTION]
+ # Get name and version.
self.name = section.get('name', self.name)
self.version = section.get('version', self.version)
+ # Get the changelog.
self.changelog = _getAbsolutePath(
section, basePath, 'changelog', self.changelog)
+ # Get the announcement.
self.announcement = _getAbsolutePath(
section, basePath, 'announcement', self.announcement)
+ # Get the date.
dateStr = section.get('date')
if dateStr:
self.date = dateutil.parser.parse(dateStr).date()
+ # Get the release files.
+ files = section.get('files')
+ if files:
+ files = files.split()
+ for path in files:
+ if not os.path.isabs(path):
+ path = os.path.join(basePath, path)
+ if path and os.path.exists(path):
+ self.files += (path,)
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 13:46:23 UTC (rev 95190)
+++ zope.kgs/trunk/src/zope/kgs/site.py 2009-01-27 13:55:02 UTC (rev 95191)
@@ -79,6 +79,15 @@
if filename in os.listdir(path):
features.append({'url': '%s/%s' % (set.version, filename),
'title': title})
+
+ files = []
+ for filepath in set.files:
+ filename = os.path.split(filepath)[-1]
+ files.append({
+ 'url': set.version + '/' + filename,
+ 'name': filename
+ })
+
versionData = {
'name': set.version,
'date': set.date and str(set.date) or None,
@@ -89,6 +98,7 @@
'announcement': {
'url':_getRenderedFilename(set.version, set.announcement),
'html': _getRenderedTxt(set.announcement)},
+ 'files': files,
}
versions.append(versionData)
@@ -124,7 +134,8 @@
"on the command line to force a rebuild.")
return
else:
- logger.info("Site is up to date, but a rebuild has been forced.")
+ logger.info("Site is up to date, but a rebuild has been "
+ "forced.")
# Save the last generation date-time.
# Note: We want to do this operation first, since it might take longer to
@@ -141,13 +152,15 @@
else:
os.mkdir(versionDir)
- # Copy the KGS config file, changelog and announcement file to the version
- # directory
+ # Copy the KGS config file, changelog, announcement, and release files to
+ # the version directory
shutil.move(kgsPath, versionDir)
if set.changelog:
shutil.move(set.changelog, versionDir)
if set.announcement:
shutil.move(set.announcement, versionDir)
+ for filepath in set.files:
+ shutil.move(filepath, versionDir)
# Recreate the KGS Path
kgsPath = os.path.join(versionDir, 'controlled-packages.cfg')
Modified: zope.kgs/trunk/src/zope/kgs/templates/master.pt
===================================================================
--- zope.kgs/trunk/src/zope/kgs/templates/master.pt 2009-01-27 13:46:23 UTC (rev 95190)
+++ zope.kgs/trunk/src/zope/kgs/templates/master.pt 2009-01-27 13:55:02 UTC (rev 95191)
@@ -63,6 +63,11 @@
<a href="#"
tal:attributes="href string:${siteRoot}${version/changelog/url}">Changelog</a>
</li>
+ <li tal:repeat="file version/files">
+ <a href="#"
+ tal:attributes="href string:${siteRoot}${file/url}"
+ tal:content="file/name">kgs-1.0.0.tgz</a>
+ </li>
<li tal:repeat="feature version/features">
<a href="#"
tal:attributes="href string:${siteRoot}${feature/url}"
More information about the Checkins
mailing list