[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7051 - trunk/gnue-common/utils
From: |
kilo |
Subject: |
[gnue] r7051 - trunk/gnue-common/utils |
Date: |
Mon, 21 Feb 2005 08:17:03 -0600 (CST) |
Author: kilo
Date: 2005-02-21 08:17:02 -0600 (Mon, 21 Feb 2005)
New Revision: 7051
Added:
trunk/gnue-common/utils/generate-gnue-config.py
Log:
New tool to generate sample.gnue.conf.
Must be run with gcvs to produce current conf entries.
Added: trunk/gnue-common/utils/generate-gnue-config.py
===================================================================
--- trunk/gnue-common/utils/generate-gnue-config.py 2005-02-21 14:13:54 UTC
(rev 7050)
+++ trunk/gnue-common/utils/generate-gnue-config.py 2005-02-21 14:17:02 UTC
(rev 7051)
@@ -0,0 +1,124 @@
+#!usr/bin/python
+
+#
+# Copyright 2001-2005 Free Software Foundation
+#
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+
+"""
+Valid configuration options that apply to all GNUe tools
+(appears under [common] section in gnue.conf or
+can appear in each individual tool section)
+"""
+
+import string
+from gnue.common.utils.FileUtils import dyn_import
+from gnue.common.utils.TextUtils import lineWrap, ALIGN_LEFT
+
+tools = [
+ ('common', 'GCConfig', 'Common Configuration Options for GNUe'),
+ ('forms' , 'GFConfig', 'Configuration Options for GNUe Forms
Client'),
+ ('reports', 'base.GRConfig', 'Configuration Options for GNUe
Reports'),
+ ('navigator', 'GNConfig', 'Configuration Options for GNUe
Navigator'),
+ ('appserver', 'geasConfiguration', 'Configuration Options for GNUe
Application Server'),
+ ('designer', 'base.Config', 'Configuration Options for GNUe
Designer')
+ ]
+
+class GenerateConf:
+ def __init__(self):
+ self._file = open('sample.gnue.conf', 'w')
+
+ def printFileHeader(self):
+ self._file.write('# Options for GNUe\n')
+ self._file.write('#\n')
+ self._file.write('# Copyright 2001-2005 Free Software Foundation\n')
+ self._file.write('#\n')
+ self._file.write('# This file is part of GNU Enterprise\n')
+ self._file.write('#\n')
+ self._file.write('# GNU Enterprise is free software; you can
redistribute it\n')
+ self._file.write('# and/or modify it under the terms of the GNU
General Public\n')
+ self._file.write('# License as published by the Free Software
Foundation; either\n')
+ self._file.write('# version 2, or (at your option) any later
version.\n')
+ self._file.write('#\n')
+ self._file.write('# GNU Enterprise is distributed in the hope that it
will be\n')
+ self._file.write('# useful, but WITHOUT ANY WARRANTY; without even the
implied\n')
+ self._file.write('# warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR\n')
+ self._file.write('# PURPOSE. See the GNU General Public License for
more details.\n')
+ self._file.write('#\n')
+ self._file.write('# You should have received a copy of the GNU General
Public\n')
+ self._file.write('# License along with program; see the file COPYING.
If not,\n')
+ self._file.write('# write to the Free Software Foundation, Inc., 59
Temple Place\n')
+ self._file.write('# - Suite 330, Boston, MA 02111-1307, USA.\n')
+ self._file.write('#\n')
+ self._file.write('#\n')
+ self._file.write('# Note: pointers to files and dirs are relative to
the installation\n')
+ self._file.write('# location of GNUe\n')
+
+
+ def printSectionHeader(self, tool, header):
+ contour = ''
+ for i in range(0,78):
+ contour += '#'
+ self._file.write('\n\n%s\n' % contour)
+ self._file.write('%s\n' % string.join(('# ', string.rjust('#',
78-len(header)-2)), header))
+ self._file.write('%s\n' % contour)
+ self._file.write('[%s]\n' % tool)
+
+
+ def printDescr(self, entry):
+ descrStrings = string.split(\
+ lineWrap(entry['Description'], 76, preserveNewlines=True, \
+ alignment=ALIGN_LEFT, eol=False),\
+ '\n')
+ for dStr in descrStrings:
+ self._file.write('# %s\n' % dStr)
+
+
+ def printOption(self, entry):
+ if entry.has_key('Options'):
+ self._file.write('# Valid options / examples:\n')
+ for option in entry['Options']:
+ self._file.write('# %s\n' % option)
+
+
+ def printDefault(self, entry):
+ self._file.write(';%s = %s\n\n' % (entry['Name'],
repr(entry['Default'])))
+
+
+ def Run(self):
+ self.printFileHeader()
+ for tool, path, header in tools:
+ importPath = string.join(('gnue', tool, path), '.')
+
+ try:
+ config = dyn_import(importPath)
+
+ self.printSectionHeader(tool, header)
+ for entry in config.ConfigOptions:
+ self.printDescr(entry)
+ self.printOption(entry)
+ self.printDefault(entry)
+ except ImportError:
+ print 'Can not import %s!' % header
+
+
+if __name__ == '__main__':
+ gc = GenerateConf()
+ gc.Run()
Property changes on: trunk/gnue-common/utils/generate-gnue-config.py
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7051 - trunk/gnue-common/utils,
kilo <=