[zopeorg-checkins] CVS: NZO_SiteLayout/bin - zopectl.in:1.4
Tres Seaver
tseaver at zope.com
Mon Apr 29 17:57:54 EDT 2002
Update of /cvs-zopeorg/NZO_SiteLayout/bin
In directory cvs.zope.org:/tmp/cvs-serv18167/bin
Modified Files:
zopectl.in
Log Message:
- Update zopectl to use library.
=== NZO_SiteLayout/bin/zopectl.in 1.3 => 1.4 === (426/526 lines abridged)
"""
-
-def _MAKESTUB( method, doc ):
-
- def xstub( self, arg=None, method=method ):
- self._report( "Not implemented: %s" % method )
- if arg:
- self._report( 'arg: %s' % arg )
-
- xstub.func_doc = doc
- return xstub
-
-
-class _ZopeCtl:
- """
- Workhorse engine for controlling the appserver.
- """
- _config_file = BASE_DIR + '/etc/zope.conf'
- _env = None
- _opts = None
- _storage = None
-
-
- def __init__( self, reporter ):
- self._reporter = reporter
-
- #
- # Command implementation
- #
- def start( self, arg ):
- """
- Start the Zope appserver.
- """
- # XXX: We currently do this by using os.system to run z2.py;
- # a better implementation would just fork and start
- # Zope using config file info.
-
- self._setupEnvironment( with_stupid_log=1 )
-
- import sys
- cmdline = '%s %s/z2.py %s %s' % ( sys.executable
- , self._env[ 'ZOPE_HOME' ]
- , self._buildCommandLine()
- , arg
- )
-
- self._doSystem( 'Starting Zope', cmdline )
-
- def restart( self, arg ):
[-=- -=- -=- 426 lines omitted -=- -=- -=-]
- self._report()
- self._report( 'Storage Options:' )
- self._report()
- self._showDict( self._storage )
-
- def _showCommandLine( self ):
- self._report()
- self._report( '%-22s : %s' % ( 'z2.py command line'
- , self._buildCommandLine() ) )
- self._report()
-
- def _showFooter( self ):
- self._report()
+from ZopeCtl import ZopeCtl, normalizeDocstring
#
# Read-eval-print interpreter
@@ -525,7 +39,7 @@
"""
Work around insistence of 'Cmd.help' on printing docstrings with
full indentation; we fabricate a function which has the docstring
- it expects, using the one from _ZopeCtl as a starting poing;
+ it expects, using the one from ZopeCtl as a starting point;
the generated function is suitable for use as 'do_command' within
the Cmd-derived class.
"""
@@ -533,10 +47,7 @@
def xdo( self, args=None, command=command ):
getattr( self._engine, command )( args )
- doc = getattr( _ZopeCtl, command ).__doc__
- lines = doc.split( '\n' )
- lines = [ line.strip() for line in lines ]
- xdo.func_doc = '\n'.join( lines )
+ xdo.func_doc = normalizeDocstring( getattr( ZopeCtl, command ) )
return xdo
@@ -546,9 +57,9 @@
"""
Interactive command processor.
"""
- def __init__( self, prompt='zopectl> ', verbosity=1 ):
+ def __init__( self, prompt='zopectl> ', verbosity=1, base_dir=BASE_DIR ):
- self._engine = _ZopeCtl( self._report )
+ self._engine = ZopeCtl( self._report, base_dir )
self.prompt = prompt
self._verbosity = verbosity
More information about the zopeorg-checkins
mailing list