[Checkins] SVN: zope.kgs/trunk/s Ripping out intro page specific code, now that we have replaced it with
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Jan 27 07:44:24 EST 2009
Log message for revision 95156:
Ripping out intro page specific code, now that we have replaced it with
a general site generation mechanism.
Changed:
U zope.kgs/trunk/setup.py
U zope.kgs/trunk/src/zope/kgs/README.txt
D zope.kgs/trunk/src/zope/kgs/intro.py
U zope.kgs/trunk/src/zope/kgs/site.py
-=-
Modified: zope.kgs/trunk/setup.py
===================================================================
--- zope.kgs/trunk/setup.py 2009-01-27 12:43:38 UTC (rev 95155)
+++ zope.kgs/trunk/setup.py 2009-01-27 12:44:24 UTC (rev 95156)
@@ -61,7 +61,6 @@
'generate-versions = zope.kgs.version:main',
'generate-index = zope.kgs.ppix:main',
'generate-links = zope.kgs.link:main',
- 'generate-intro = zope.kgs.intro:main',
'generate-site = zope.kgs.site:main',
'list-latest = zope.kgs.latest:main',
'list-changes = zope.kgs.change:main',
Modified: zope.kgs/trunk/src/zope/kgs/README.txt
===================================================================
--- zope.kgs/trunk/src/zope/kgs/README.txt 2009-01-27 12:43:38 UTC (rev 95155)
+++ zope.kgs/trunk/src/zope/kgs/README.txt 2009-01-27 12:44:24 UTC (rev 95156)
@@ -500,100 +500,7 @@
<BLANKLINE>
<BLANKLINE>
-Introduction Page
------------------
-Once all the files have been created, one can generate an introduction page
-that explains how the files can be used. It also lists all the files by
-distribution. In order for this script to work, you need the following
-directory layout:
-
- >>> kgsDir = tempfile.mkdtemp()
-
- >>> open(os.path.join(kgsDir, 'controlled-packages.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'buildout.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'versions.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'links.html'), 'w').write(' ')
- >>> os.mkdir(os.path.join(kgsDir, 'minimal'))
-
- >>> open(os.path.join(kgsDir, 'controlled-packages-1.0.0.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'buildout-1.0.0.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'versions-1.0.0.cfg'), 'w').write(' ')
- >>> os.mkdir(os.path.join(kgsDir, 'minimal-1.0.0'))
-
- >>> open(os.path.join(kgsDir, 'controlled-packages-1.1.0.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'buildout-1.1.0.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'versions-1.1.0.cfg'), 'w').write(' ')
- >>> open(os.path.join(kgsDir, 'links-1.1.0.html'), 'w').write(' ')
- >>> os.mkdir(os.path.join(kgsDir, 'minimal-1.1.0'))
-
- >>> open(os.path.join(kgsDir, 'index.html'), 'w').write(' ')
-
-Let's now generate the page:
-
- >>> introPage = os.path.join(kgsDir, 'intro.html')
-
- >>> from zope.kgs import intro
- >>> intro.main(['-d',kgsDir])
-
- >>> print open(introPage, 'r').read()
- <!DOCTYPE ...
- <html ...>
- ...
- <body>
- <h1 id="header">Introduction to the KGS</h1>
- <div id="left-hand-navigation">
- <!-- Main Menu -->
- <div id="menu">
- <ul class="level-one">
- <li>
- <a href="#">Version 1.0.0</a>
- <ul class="level-two" style="display: none;">
- <li>
- <a href="controlled-packages-1.0.0.cfg">Controlled Packages</a>
- </li>
- <li>
- <a href="buildout-1.0.0.cfg">Buildout Configuration</a>
- </li>
- <li>
- <a href="versions-1.0.0.cfg">Versions</a>
- </li>
- <li>
- <a href="minimal-1.0.0">Minimal Index</a>
- </li>
- <li>
- <a href="index.html">Index</a>
- </li>
- </ul>
- </li>
- <li>
- <a href="#">Version 1.1.0</a>
- <ul class="level-two" style="display: none;">
- <li>
- <a href="controlled-packages-1.1.0.cfg">Controlled Packages</a>
- </li>
- <li>
- <a href="buildout-1.1.0.cfg">Buildout Configuration</a>
- </li>
- <li>
- <a href="versions-1.1.0.cfg">Versions</a>
- </li>
- <li>
- <a href="links-1.1.0.html">Package Links</a>
- </li>
- <li>
- <a href="minimal-1.1.0">Minimal Index</a>
- </li>
- <li>
- <a href="index.html">Index</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>...
-
-
The Site Generator
------------------
@@ -619,7 +526,8 @@
['3.4.0b2', 'cf-timestamp', 'index.html', 'resources']
>>> sorted(os.listdir(os.path.join(siteDir, '3.4.0b2')))
- ['CHANGES.html', 'buildout.cfg', 'controlled-packages.cfg', 'index',
+ ['ANNOUNCEMENT.html', 'CHANGES.html',
+ 'buildout.cfg', 'controlled-packages.cfg', 'index',
'links.html', 'minimal', 'versions.cfg']
>>> sorted(os.listdir(os.path.join(siteDir, '3.4.0b2', 'minimal')))
Deleted: zope.kgs/trunk/src/zope/kgs/intro.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/intro.py 2009-01-27 12:43:38 UTC (rev 95155)
+++ zope.kgs/trunk/src/zope/kgs/intro.py 2009-01-27 12:44:24 UTC (rev 95156)
@@ -1,96 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 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 an Introduction HTML page for the KGS.
-
-Usage: %s output-intro-path
-
-* ``output-intro-path``
-
- The path of the file under which the generated intro file is stored.
-"""
-import logging
-import os
-import optparse
-import sys
-import zope.pagetemplate.pagetemplatefile
-
-FEATURES = [
- ('controlled-packages-%(version)s.cfg', u'Controlled Packages'),
- ('buildout-%(version)s.cfg', u'Buildout Configuration'),
- ('versions-%(version)s.cfg', u'Versions'),
- ('links-%(version)s.html', u'Package Links'),
- ('minimal-%(version)s', u'Minimal Index'),
- ('index.html', u'Index'),
- ]
-
-TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'templates', 'intro.pt')
-
-class IntroPage(zope.pagetemplate.pagetemplatefile.PageTemplateFile):
-
- def __init__(self, kgsDir):
- super(IntroPage, self).__init__(TEMPLATE_PATH)
- self.kgsDir = kgsDir
-
- def update(self):
- kgsFileNames = os.listdir(self.kgsDir)
- vnums = [fn[20:-4] for fn in kgsFileNames
- if fn.startswith('controlled-packages-')]
- vnums.sort()
- self.versions = []
- for vnum in vnums:
- features = []
- for (templ, title) in FEATURES:
- featureFileName = templ %{'version': vnum}
- if featureFileName in kgsFileNames:
- features.append({'url': featureFileName, 'title': title})
- self.versions.append({'name': vnum, 'features': features})
-
-
- def pt_getContext(self, args=(), options=None, **ignore):
- rval = {'args': args,
- 'nothing': None,
- 'options': options,
- 'self': self
- }
- rval.update(self.pt_getEngine().getBaseNames())
- return rval
-
-
-parser = optparse.OptionParser(
- usage="%prog [options] -d DIR",
- description="This script regenerates the intro page for a kgs configuration")
-
-parser.add_option("-d","--dir", action="store",
- type="string", dest="outputDir", metavar="DIR",
- help="The directory where the kgs configuration is located.")
-
-def main(args=None):
- logging.basicConfig(level=logging.INFO)
-
- if args is None:
- args = sys.argv[1:]
- if not args:
- args = ['-h']
-
- options, args = parser.parse_args(args)
- if not options.outputDir:
- logging.error("You must specify the location of the kgs configuration "
- "the -d option.")
- sys.exit(1)
-
- page = IntroPage(options.outputDir)
- page.update()
- outputFile = os.path.join(options.outputDir, 'intro.html')
- logging.info("Generating %s" % outputFile)
- open(outputFile, 'w').write(page())
Modified: zope.kgs/trunk/src/zope/kgs/site.py
===================================================================
--- zope.kgs/trunk/src/zope/kgs/site.py 2009-01-27 12:43:38 UTC (rev 95155)
+++ zope.kgs/trunk/src/zope/kgs/site.py 2009-01-27 12:44:24 UTC (rev 95156)
@@ -31,7 +31,7 @@
import shutil
import sys
import time
-from zope.kgs import version, buildout, ppix, link, intro, kgs, template
+from zope.kgs import version, buildout, ppix, link, kgs, template
TIMESTAMP_FILENAME = 'cf-timestamp'
@@ -119,9 +119,9 @@
last_update = float(open(timestampPath, 'r').read())
last_modified = os.stat(kgsPath)[-2]
if last_update > last_modified:
- logger.info("Site is up to date. Use --force "
- "on the command line to force a rebuild.")
if not force:
+ logger.info("Site is up to date. Use --force "
+ "on the command line to force a rebuild.")
return
else:
logger.info("Site is up to date, but a rebuild has been forced.")
More information about the Checkins
mailing list