appy.shared: added the possibility to generate a Cortex (see www.guardis.com) application definition for an Appy application.

This commit is contained in:
Gaetan Delannay 2012-02-14 12:52:36 +01:00
parent 57c481f05e
commit 69fb172f03
3 changed files with 102 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import sys, os.path
from optparse import OptionParser
from appy.gen.generator import GeneratorError, ZopeGenerator
from appy.shared.utils import LinesCounter
from appy.shared.packaging import Debianizer
from appy.shared.packaging import Debianizer, Cortexer
import appy.version
# ------------------------------------------------------------------------------
@ -34,6 +34,9 @@ S_OPTION = 'Sorts all i18n labels. If you use this option, among the ' \
'set of translation files.'
D_OPTION = 'Generates a Debian package for this app. The Debian package will ' \
'be generated at the same level as the root application folder.'
X_OPTION = 'Generates a Cortex application definition for this app, in a ' \
'folder "cortex.admin" that will be generated at the same level ' \
'as the root application folder.'
class GeneratorScript:
'''usage: %prog [options] app
@ -68,6 +71,8 @@ class GeneratorScript:
dest='i18nSort', default=False, help=S_OPTION)
optParser.add_option("-d", "--debian", action='store_true',
dest='debian', default=False, help=D_OPTION)
optParser.add_option("-x", "--cortex", action='store_true',
dest='cortex', default=False, help=X_OPTION)
(options, args) = optParser.parse_args()
try:
self.manageArgs(optParser, options, args)
@ -87,6 +92,9 @@ class GeneratorScript:
f.close()
version = version[:version.find('build')-1]
Debianizer(app, appDir, appVersion=version).run()
# Generates a Cortex application definition if required
if options.cortex:
Cortexer(args[0]).run()
except GeneratorError, ge:
sys.stderr.write(str(ge))
sys.stderr.write('\n')

View file

@ -121,7 +121,7 @@ class ZopeInstanceCreator:
os.mkdir('etc')
f = file('etc/zope.conf', 'w')
f.write(zopeConf % (self.instancePath, '%s/var' % self.instancePath,
'%s/log' % self.instancePath, ''))
'%s/log' % self.instancePath, '8080', ''))
f.close()
# Create other folders
for name in ('Extensions', 'log', 'Products', 'var'): os.mkdir(name)