[Zope-Checkins] CVS: Zope/lib/python - zope.py:1.1.2.10
Chris McDonough
chrism@zope.com
Tue, 14 Jan 2003 22:39:36 -0500
Update of /cvs-repository/Zope/lib/python
In directory cvs.zope.org:/tmp/cvs-serv22900/lib/python
Modified Files:
Tag: chrism-install-branch
zope.py
Log Message:
Add command-line option override support to installer branch.
=== Zope/lib/python/zope.py 1.1.2.9 => 1.1.2.10 ===
--- Zope/lib/python/zope.py:1.1.2.9 Sat Jan 4 23:06:05 2003
+++ Zope/lib/python/zope.py Tue Jan 14 22:39:04 2003
@@ -58,17 +58,21 @@
if SOFTWARE_HOME not in sys.path:
sys.path.insert(0, SOFTWARE_HOME)
- from Zope.Startup import getSchemaKeys, ConfigurationError, start_zope
+ from Zope.Startup import getOptions, ConfigurationError, start_zope
config_location = 'zope.conf'
- overrides = {}
- schema_keys = getSchemaKeys()
+
longopts = [ "help", "config="]
+ shortopts = 'h'
+
+ start_shortopts, start_longopts = getOptions()
- for name in schema_keys:
+ for name in start_longopts:
longopts.append('%s=' % name)
try:
- opts, args = getopt.getopt(sys.argv[1:], "h", longopts)
+ optcopy = sys.argv[1:]
+ opts, args = getopt.getopt(optcopy, start_shortopts+shortopts,
+ start_longopts+longopts)
except getopt.GetoptError, v:
print v
usage()
@@ -77,15 +81,17 @@
if k in ('-h', '--help'):
usage()
sys.exit(0)
- elif k == '--config':
+ if k == '--config':
config_location = v
- else:
- if k.startswith('--'):
- k = k[2:]
- overrides[k] = v
-
+ i = 0
+ # remove --config= from optcopy
+ for item in optcopy:
+ if item.startswith('--config='):
+ break
+ i = i + 1
+ optcopy.pop(i)
try:
- start_zope(config_location, overrides)
+ start_zope(config_location, optcopy)
except SystemExit:
raise
except: