PK)€S8µjÞÞEGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: plone.recipe.zope2zeoserver Version: 0.11 Summary: ZC Buildout recipe for installing a Zope 2 ZEO server Home-page: http://svn.plone.org/svn/collective/buildout/plone.recipe.zope2zeoserver Author: Hanno Schlichting Author-email: plone@hannosch.info License: ZPL 2.1 Description: plone.recipe.zope2zeoserver =========================== This recipe creates and configures a Zope 2 ZEO server in parts. It also installs a control script, which is like zeoctl, in the bin/ directory. The name of the control script is the the name of the part in buildout. You can use it with a part like this:: [zeoserver] recipe = plone.recipe.zope2zeoserver zope2-location = /path/to/zope2/install zeo-address = 8100 Options ------- zope2-location The path where Zope 2 is installed. If you are also using the plone.recipe.zope2install recipe, and you have that configured as a part called 'zope2' prior to the zope2zeoserver part, you can use ${zope2:location} for this parameter. You must ensure the zope2zeoserver part is run *after* the zope2install one. zeopack The path to the zeopack.py backup script. A wrapper for this will be generated in bin/zeopack, which sets up the appropriate environment to run this. Defaults to "${zope2-location}/utilities/ZODBTools/zeopack.py". Set this option to an empty value if you do not want this script to be generated. zeo-conf A relative or absolute path to a zeo.conf file. If this is not given, a zeo.conf will be generated based on the the options below. The following options all affect the generated zope.conf. zeo-address Give a port for the ZEO server. Defaults to 8100. effective-user The name of the effective user for the ZEO process. Defaults to not setting an effective user. invalidation-queue-size The invalidation-queue-size used for the ZEO server. Defaults to 100. zeo-log The filename of the ZEO log file. Defaults to var/log/${partname}.log zeo-log-custom A custom section for the eventlog, to be able to use another event logger than `logfile`. `zeo-log` is still used to set the logfile value in the runner section. storage-number The number used to identify a storage. file-storage The filename where the ZODB data file will be stored. Defaults to var/filestorage/Data.fs. blob-storage The folder where the ZODB blob data files will be stored. socket-name The filename where ZEO will write its socket file. Defaults to var/zeo.zdsock. zeo-conf-additional Give additional lines to zeo.conf. Make sure you indent any lines after the one with the parameter. Reporting bugs or asking questions ---------------------------------- We have a shared bugtracker and help desk on Launchpad: https://bugs.launchpad.net/collective.buildout/ Change History ============== 0.11 ---- - made Python 2.3 compatible [fschulze] - added win32 specific scripts. [tarek] - added a `zeo-log-custom` option. [tarek] - added a test environement and a basic doctest to validate the recipe. [tarek] 0.10 ---- - Calculate the package working set outside of the recipe constructor. Closes https://bugs.launchpad.net/collective.buildout/+bug/180084 [rochael] 0.9 --- - Added `invalidation-queue-size` and `storage-number` options. [hannosch] - Merged rochael-blobsupport branch. Added support for ZODB 3.8 blob storage configuration. This adds the blob-storage option. This closes https://bugs.launchpad.net/collective.buildout/+bug/179115 and https://bugs.launchpad.net/collective.buildout/+bug/179117. [rochael, hannosch] - Renamed `zope-conf-additional` option to `zeo-conf-additional`. [rochael] 0.8 --- - Small documentation update. Added link to the bugtracker. [hannosch] - Have PID file's location default to `${buildout:directory}/var/${name}.pid`. Keeping the PID file in $INSTANCE_HOME gives trouble when buildout rebuilds the part. [nouri, mbenali] 0.7 --- - Change default location of zeo socket to var. [smcmahon] - Add option to set socket-name. [smcmahon] 0.6 --- - Move the documentation to a separate README.txt and read that from setup.py. [wichert] - Add a wrapper around zeopack which inserts default options for our ZEO server. [wichert] 0.5 --- - Added an option to set the effective-user. [optilude] 0.3 --- - Updated setup.py. [optilude] 0.2 --- - Similarly, there are some hardcoded dependencies on $INSTANCE_HOME/etc/. [optilude] - Documented options, cleaned up code, and added the ability to use a manual zeo.conf. [optilude] - Make this work, at least on OS X and probably unix-like system. It wouldn't surprise me if this needs adjustment for Windows in the same way that we do in plone.recipe.zope2instance. :-( [optilude] 0.1 --- - Initial implementation. [regebro, hannosch] Keywords: zope2 buildout Platform: UNKNOWN Classifier: License :: OSI Approved :: Zope Public License Classifier: Framework :: Buildout Classifier: Framework :: Zope2 Classifier: Programming Language :: Python PK)€S8ÖüBPÖÖEGG-INFO/SOURCES.txtCHANGES.txt README.txt bootstrap.py buildout.cfg setup.py src/plone/__init__.py src/plone.recipe.zope2zeoserver.egg-info/PKG-INFO src/plone.recipe.zope2zeoserver.egg-info/SOURCES.txt src/plone.recipe.zope2zeoserver.egg-info/dependency_links.txt src/plone.recipe.zope2zeoserver.egg-info/entry_points.txt src/plone.recipe.zope2zeoserver.egg-info/namespace_packages.txt src/plone.recipe.zope2zeoserver.egg-info/not-zip-safe src/plone.recipe.zope2zeoserver.egg-info/requires.txt src/plone.recipe.zope2zeoserver.egg-info/top_level.txt src/plone/recipe/__init__.py src/plone/recipe/zope2zeoserver/__init__.py src/plone/recipe/zope2zeoserver/ctl.py src/plone/recipe/zope2zeoserver/pack.py src/plone/recipe/zope2zeoserver/runzeo.bat src/plone/recipe/zope2zeoserver/zeoservice.py src/plone/recipe/zope2zeoserver/tests/__init__.py src/plone/recipe/zope2zeoserver/tests/test_docs.py src/plone/recipe/zope2zeoserver/tests/zeoserver-win32.txt src/plone/recipe/zope2zeoserver/tests/zeoserver.txt PK)€S8“×2EGG-INFO/dependency_links.txt PK)€S8Rzö‘<<EGG-INFO/entry_points.txt[zc.buildout] default = plone.recipe.zope2zeoserver:Recipe PK)€S8묤 EGG-INFO/namespace_packages.txtplone plone.recipe PK€S8“×2EGG-INFO/not-zip-safe PK)€S8”'â·$$EGG-INFO/requires.txtzc.buildout setuptools zc.recipe.eggPK)€S8­Aq?EGG-INFO/top_level.txtplone PK.S8š­¬#ôôplone/__init__.py# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) PK)€S8¶y“ƒƒplone/__init__.pyc;ò YîºGc@sMyedƒieƒWn/ej o#dklZeeeƒZnXdS(s pkg_resources(s extend_pathN(s __import__sdeclare_namespaces__name__s ImportErrorspkgutils extend_paths__path__(s__path__s extend_path((s3build/bdist.darwin-9.2.0-i386/egg/plone/__init__.pys?s PK.S8š­¬#ôôplone/recipe/__init__.py# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) PK)€S8-NŠŠplone/recipe/__init__.pyc;ò YîºGc@sMyedƒieƒWn/ej o#dklZeeeƒZnXdS(s pkg_resources(s extend_pathN(s __import__sdeclare_namespaces__name__s ImportErrorspkgutils extend_paths__path__(s__path__s extend_path((s:build/bdist.darwin-9.2.0-i386/egg/plone/recipe/__init__.pys?s PK.S8ª’Žcï:ï:'plone/recipe/zope2zeoserver/__init__.py############################################################################## # # Copyright (c) 2006-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. # ############################################################################## import sys, os, re, shutil import zc.buildout import zc.recipe.egg import logging join = os.path.join curdir = os.path.dirname(__file__) class Recipe: def __init__(self, buildout, name, options): self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options) self.buildout, self.options, self.name = buildout, options, name options['location'] = os.path.join( buildout['buildout']['parts-directory'], self.name, ) options['bin-directory'] = buildout['buildout']['bin-directory'] options['scripts'] = '' # suppress script generation. _, self.zodb_ws = self.egg.working_set() _ws_locations = None def ws_locations(self): if self._ws_locations is None: self._ws_locations = [d.location for d in self.zodb_ws] # account for zope2-location, if provided if self.options.get('zope2-location') is not None: software_home = os.path.join(self.options['zope2-location'], 'lib', 'python') assert os.path.isdir(software_home), invalid_z2_location_msg self._ws_locations.append(software_home) return self._ws_locations ws_locations = property(ws_locations) def install(self): options = self.options location = options['location'] # evil hack alert! # hopefully place ZODB in sys.path orig_sys_path = tuple(sys.path) sys.path[0:0] = self.ws_locations try: # if we can import ZEO, assume the depenencies (zdaemon, ZConfig, # etc...) are also present on 'path' import ZEO except ImportError: raise AssertionError(zodb_import_msg) if os.path.exists(location): shutil.rmtree(location) # What follows is a bit of a hack because the instance-setup mechanism # is a bit monolithic. We'll run mkzeoinst and then we'll # patch the result. A better approach might be to provide independent # instance-creation logic, but this raises lots of issues that # need to be stored out first. # this was taken from mkzeoinstance.py from ZEO.mkzeoinst import ZEOInstanceBuilder self.zodb3_home = os.path.dirname(os.path.dirname(ZEO.__file__)) params = { "package": "zeo", "PACKAGE": "ZEO", "zodb3_home": self.zodb3_home, "instance_home": location, "port": 8100, # will be overwritten later "python": options['executable'], } ZEOInstanceBuilder().create(location, params) try: # Save the working set: open(os.path.join(location, 'etc', '.eggs'), 'w').write( '\n'.join(self.ws_locations)) # Make a new zeo.conf based on options in buildout.cfg self.build_zeo_conf() # Patch extra paths into binaries self.patch_binaries() # Install extra scripts self.install_scripts() except: # clean up shutil.rmtree(location) raise # end evil hack and restore sys.path to it's glorious days del sys.path[0:len(self.ws_locations)] assert tuple(sys.path) == orig_sys_path return location def update(self): options = self.options location = options['location'] if os.path.exists(location): # See if we can stop. We need to see if the working set path # has changed. saved_path = os.path.join(location, 'etc', '.eggs') if os.path.isfile(saved_path): if (open(saved_path).read() != '\n'.join(self.ws_locations) ): # Something has changed. Blow away the instance. self.install() # Nothing has changed. return location else: self.install() return location def build_zeo_conf(self): """Create a zeo.conf file """ options = self.options location = options['location'] instance_home = location zeo_conf_path = options.get('zeo-conf', None) if zeo_conf_path is not None: zeo_conf = "%%include %s" % os.path.abspath(zeo_conf_path) else: zeo_address = options.get('zeo-address', '8100') zeo_conf_additional = options.get('zeo-conf-additional', '') storage_number = options.get('storage-number', '1') effective_user = options.get('effective-user', '') if effective_user: effective_user = 'user %s' % effective_user invalidation_queue_size = options.get('invalidation-queue-size', '100') base_dir = self.buildout['buildout']['directory'] socket_name = options.get('socket-name', '%s/var/zeo.zdsock' % base_dir) socket_dir = os.path.dirname(socket_name) if not os.path.exists(socket_dir): os.makedirs(socket_dir) z_log_name = os.path.sep.join(('var', 'log', self.name + '.log',)) zeo_log_custom = options.get('zeo-log-custom', None) # if zeo-log is given, we use it to set the runner # logfile value in any case z_log_filename = options.get('zeo-log', z_log_name) z_log_filename = os.path.join(base_dir, z_log_filename) z_log_dir = os.path.dirname(z_log_filename) if not os.path.exists(z_log_dir): os.makedirs(z_log_dir) # zeo-log-custom superseeds zeo-log if zeo_log_custom is None: z_log = z_log_file % {'filename': z_log_filename} else: z_log = zeo_log_custom file_storage = os.path.sep.join(('var', 'filestorage', 'Data.fs',)) file_storage = options.get('file-storage', file_storage) file_storage = os.path.join(base_dir, file_storage) file_storage_dir = os.path.dirname(file_storage) if not os.path.exists(file_storage_dir): os.makedirs(file_storage_dir) pid_file = options.get( 'pid-file', os.path.join(base_dir, 'var', self.name + '.pid')) # check whether we'll wrap a blob storage around our file storage blob_storage = options.get('blob-storage', None) if blob_storage is not None: storage_template = blob_storage_template else: storage_template = file_storage_template storage = storage_template % dict( storage_number = storage_number, file_storage = file_storage, blob_storage = blob_storage ) zeo_conf = zeo_conf_template % dict( instance_home = instance_home, effective_user = effective_user, invalidation_queue_size = invalidation_queue_size, socket_name = socket_name, z_log = z_log, z_log_filename = z_log_filename, storage = storage, zeo_address = zeo_address, pid_file = pid_file, zeo_conf_additional = zeo_conf_additional, ) zeo_conf_path = os.path.join(location, 'etc', 'zeo.conf') open(zeo_conf_path, 'w').write(zeo_conf) def patch_binaries(self): location = self.options['location'] # XXX We need to patch the windows specific batch scripts # and they need a different path seperator path = os.path.pathsep.join(self.ws_locations) for script_name in ('runzeo', 'zeoctl'): script_path = os.path.join(location, 'bin', script_name) script = open(script_path).read() script = script.replace('PYTHONPATH="$ZODB3_HOME"', 'PYTHONPATH="%s"' % path) f = open(script_path, 'w') f.write(script) f.close() def install_scripts(self): options = self.options location = options['location'] self.zeo_conf = options.get('zeo-conf', None) if self.zeo_conf is None: self.zeo_conf = os.path.join(location, 'etc', 'zeo.conf') _, ws = self.egg.working_set(['plone.recipe.zope2zeoserver']) initialization = """ import os; os.environ['PYTHONPATH'] = %r """.strip() % os.path.pathsep.join(self.ws_locations) zc.buildout.easy_install.scripts( [(self.name, 'plone.recipe.zope2zeoserver.ctl', 'main')], ws, options['executable'], options['bin-directory'], extra_paths = self.ws_locations, initialization = initialization, arguments = ('\n ["-C", %r]' '\n + sys.argv[1:]' % self.zeo_conf ), ) # zeopack.py zeopack = options.get('zeopack', None) if zeopack is not None: directory, filename = os.path.split(zeopack) if zeopack and os.path.exists(zeopack): zc.buildout.easy_install.scripts( [('zeopack', os.path.splitext(filename)[0], 'main')], {}, options['executable'], options['bin-directory'], extra_paths = self.ws_locations + [directory], ) else: zeo_address = options.get('zeo-address', '8100') parts = zeo_address.split(':') if len(parts) == 1: parts[0:0] = ['127.0.0.1'] zc.buildout.easy_install.scripts( [('zeopack', 'plone.recipe.zope2zeoserver.pack', 'main')], self.zodb_ws, options['executable'], options['bin-directory'], initialization='host = "%s"\nport = %s' % tuple(parts), arguments='host, port', ) if sys.platform == 'win32': self.install_win32_scripts() def install_win32_scripts(self): location = self.options['location'] # zeoservice.py zeo_service = open(join(curdir, 'zeoservice.py')).read() zope2_location = self.options.get('zope2-location', None) if zope2_location is None: zope2_location = join(location, 'parts', 'zope2') software_home = join(zope2_location, 'lib', 'python') arguments = {'PYTHON': self.options['executable'], 'SOFTWARE_HOME': software_home, 'zodb3_home': self.zodb3_home, 'ZOPE_HOME': zope2_location, 'INSTANCE_HOME': location, 'PACKAGE': 'zeo'} zeo_file = os.path.join(self.options['bin-directory'], 'zeoservice.py') self._write_file(zeo_file, zeo_service % arguments) initialization = """ import os; os.environ['PYTHONPATH'] = %r """.strip() % os.path.pathsep.join(self.ws_locations) zc.buildout.easy_install.scripts( [('zeoservice', 'zeoservice', 'main')], self.zodb_ws, self.options['executable'], self.options['bin-directory'], extra_paths = self.ws_locations, initialization = initialization, ) # runzeo.bat runzeo = open(join(curdir, 'runzeo.bat')).read() self._write_file(os.path.join(self.options['bin-directory'], 'runzeo.bat'), runzeo % arguments) def _write_file(self, path, content): logger = logging.getLogger('zc.buildout.easy_install') f = open(path, 'w') try: f.write(content) finally: f.close() logger.debug('Wrote file %s' % path) os.chmod(path, 0755) logger.warning('Changed mode for %s to 755' % path) invalid_z2_location_msg = """ 'zope2-location' doesn't point to an actual Zope2 SOFTWARE_HOME. Check this setting and, eventually, make sure this buildout part is being run after the part that is supposed to provide the 'zope2-location' value. """.strip() zodb_import_msg = """ Unable to import ZEO. Please, either add the ZODB3 egg to the 'eggs' entry or set zope2-location """.strip() # the template used to build a regular file storage entry for zeo.conf file_storage_template = """ path %(file_storage)s """.strip() # the template used to build a blob storage wrapping a file storage entry for # zeo.conf blob_storage_template = """ blob-dir %(blob_storage)s path %(file_storage)s """.strip() z_log_file = """\ path %(filename)s format %%(message)s """.strip() # The template used to build zeo.conf zeo_conf_template="""\ %%define INSTANCE %(instance_home)s address %(zeo_address)s read-only false invalidation-queue-size %(invalidation_queue_size)s pid-filename %(pid_file)s %(storage)s level info %(z_log)s program $INSTANCE/bin/runzeo socket-name %(socket_name)s daemon true forever false backoff-limit 10 exit-codes 0, 2 directory $INSTANCE default-to-interactive true %(effective_user)s # This logfile should match the one in the zeo.conf file. # It is used by zdctl's logtail command, zdrun/zdctl doesn't write it. logfile %(z_log_filename)s %(zeo_conf_additional)s """ PK)€S8 ÒHZ}3}3(plone/recipe/zope2zeoserver/__init__.pyc;ò YîºGc@s¶dkZdkZdkZdkZdkZdkZdkZeii Z eii e ƒZ dfd„ƒYZ diƒZdiƒZdiƒZdiƒZdiƒZdZdS( NsRecipecBsktZd„ZeZd„ZeeƒZd„Zd„Zd„Z d„Z d„Z d„Z d „Z RS( NcCsŸtiii||d|ƒ|_|||f\|_|_|_ti i |dd|iƒ|d<|dd|d path %(file_storage)s s› blob-dir %(blob_storage)s path %(file_storage)s sP path %(filename)s format %%(message)s s‡%%define INSTANCE %(instance_home)s address %(zeo_address)s read-only false invalidation-queue-size %(invalidation_queue_size)s pid-filename %(pid_file)s %(storage)s level info %(z_log)s program $INSTANCE/bin/runzeo socket-name %(socket_name)s daemon true forever false backoff-limit 10 exit-codes 0, 2 directory $INSTANCE default-to-interactive true %(effective_user)s # This logfile should match the one in the zeo.conf file. # It is used by zdctl's logtail command, zdrun/zdctl doesn't write it. logfile %(z_log_filename)s %(zeo_conf_additional)s (ssyssossresshutils zc.buildoutszcs zc.recipe.eggsloggingspathsjoinsdirnames__file__scurdirsRecipesstripsinvalid_z2_location_msgszodb_import_msgsfile_storage_templatesblob_storage_templates z_log_fileszeo_conf_template(szodb_import_msgsloggingszeo_conf_templatesfile_storage_templatesinvalid_z2_location_msgsRecipesblob_storage_templateszcssyssrescurdirs z_log_filesjoinsshutilsos((sIbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/__init__.pys?s$    ÿ=    PK.S8—öâ$$"plone/recipe/zope2zeoserver/ctl.py############################################################################## # # Copyright (c) 2006-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. # ############################################################################## """zeocltl -- control a ZEO server using zdaemon. Usage: zeocltl [options] [action [arguments]] Options: -h/--help -- print usage message and exit -i/--interactive -- start an interactive shell after executing commands action [arguments] -- see below Actions are commands like "start", "stop" and "status". If -i is specified or no action is specified on the command line, a "shell" interpreting actions typed interactively is started (unless the configuration option default_to_interactive is set to false). Use the action "help" to find out about available actions. """ import os, sys from ZEO import zeoctl if sys.platform[:3].lower() == "win": print 'For win32 platforms, runzeo.bat or zeoservice.exe should be used' print '%s is based on zdaemon, which is Linux specific' % sys.argv[0] print 'Aborting...' sys.exit(0) def main(args=None): zeoctl.main(args) PK)€S8*pZ¡RR#plone/recipe/zope2zeoserver/ctl.pyc;ò YîºGc@szdZdkZdkZdklZeid iƒdjo+dGHdeidGHdGHeidƒne d „Z dS( s8zeocltl -- control a ZEO server using zdaemon. Usage: zeocltl [options] [action [arguments]] Options: -h/--help -- print usage message and exit -i/--interactive -- start an interactive shell after executing commands action [arguments] -- see below Actions are commands like "start", "stop" and "status". If -i is specified or no action is specified on the command line, a "shell" interpreting actions typed interactively is started (unless the configuration option default_to_interactive is set to false). Use the action "help" to find out about available actions. N(szeoctliswins@For win32 platforms, runzeo.bat or zeoservice.exe should be useds/%s is based on zdaemon, which is Linux specificis Aborting...cCsti|ƒdS(N(szeoctlsmainsargs(sargs((sDbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/ctl.pysmain(s( s__doc__sosssyssZEOszeoctlsplatformslowersargvsexitsNonesmain(ssyssmainsosszeoctl((sDbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/ctl.pys?s PK.S8HK@&&#plone/recipe/zope2zeoserver/pack.py# zeopack wrapper import sys from ZEO.scripts import zeopack def main(host, port): for arg in sys.argv: if arg[:2] in [ "-h", "-U" ]: break else: sys.argv.extend(["-h", str(host), "-p", str(port)]) zeopack.main() if __name__ == "__main__": main() PK)€S8.òËÿÎÎ$plone/recipe/zope2zeoserver/pack.pyc;ò YîºGc@s;dkZdklZd„Zedjo eƒndS(N(szeopackcCsfxUtiD]"}|d ddgjoPq q Wtiidt|ƒdt|ƒgƒtiƒdS(Nis-hs-Us-p( ssyssargvsargsextendsstrshostsportszeopacksmain(shostsportsarg((sEbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/pack.pysmains   (s__main__(ssyss ZEO.scriptsszeopacksmains__name__(ssyssmainszeopack((sEbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/pack.pys?s    PK.S8tÑ11&plone/recipe/zope2zeoserver/runzeo.bat@rem %(PACKAGE)s instance start script @set PYTHON=%(PYTHON)s @set ZODB3_HOME=%(zodb3_home)s @set CONFIG_FILE=%(INSTANCE_HOME)s/etc/%(PACKAGE)s.conf @set PYTHONPATH=%%ZODB3_HOME%% @set RUNZEO=%%ZODB3_HOME%%/ZEO/runzeo.py "%%PYTHON%%" "%%RUNZEO%%" -C "%%CONFIG_FILE%%" %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 PK.S8Ñ#ÿíxx)plone/recipe/zope2zeoserver/zeoservice.py############################################################################## # # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.0 (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 # ############################################################################## """ A ZEO Windows NT service frontend. Usage: Installation The ZEO service should be installed by the Zope Windows installer. You can manually install, uninstall the service from the commandline. ntservice.py [options] install|update|remove|start [...] |stop|restart [...]|debug [...] Options for 'install' and 'update' commands only: --username domain\username : The Username the service is to run under --password password : The password for the username --startup [manual|auto|disabled] : How the service starts, default = manual Commands install : Installs the service update : Updates the service. Use this if you change any configuration settings and need the service to be re-registered. remove : Removes the service start : Starts the service, this can also be done from the services control panel stop : Stops the service, this can also be done from the services control panel restart : Restarts the service debug : Runs the service in debug mode You can view the usage options by running this module without any arguments. Starting ZEO Start ZEO by clicking the 'start' button in the services control panel. You can set ZEO to automatically start at boot time by choosing 'Auto' startup by clicking the 'statup' button. Stopping ZEO Stop ZEO by clicking the 'stop' button in the services control panel. Event logging Service related events (such as startup, shutdown, or errors executing the Zope process) are logged to the NT application event log. Use the event viewer to see these events. ZEO Events are still written to the ZEO event logs. """ import sys, os # these are replacements from mkzopeinstance PYTHON = r'%(PYTHON)s' SOFTWARE_HOME=r'%(SOFTWARE_HOME)s' INSTANCE_HOME = r'%(INSTANCE_HOME)s' ZOPE_HOME = r'%(ZOPE_HOME)s' ZODB3_HOME = r'%(zodb3_home)s' ZEO_RUN = r'%%s\\ZEO\\runzeo.py' %% ZODB3_HOME CONFIG_FILE= os.path.join(INSTANCE_HOME, 'etc', 'zope.conf') PYTHONSERVICE_EXE=r'%%s\\bin\\PythonService.exe' %% ZOPE_HOME # Setup the environment, so sub-processes see these variables parts = os.environ.get("PYTHONPATH", "").split(os.pathsep) if SOFTWARE_HOME not in parts: parts = filter(None, [SOFTWARE_HOME] + parts) os.environ["PYTHONPATH"] = os.pathsep.join(parts) os.environ["INSTANCE_HOME"] = INSTANCE_HOME # Ensure SOFTWARE_HOME is on our current sys.path so we can import the # nt_svcutils package. if SOFTWARE_HOME not in sys.path: sys.path.insert(0, SOFTWARE_HOME) from nt_svcutils.service import Service servicename = 'ZEO_%%s' %% str(hash(INSTANCE_HOME.lower())) class InstanceService(Service): _svc_name_ = servicename _svc_display_name_ = 'ZEO instance at %%s' %% INSTANCE_HOME # _svc_description_ can also be set (but what to say isn't clear!) # If the exe we expect is not there, let the service framework search # for it. This will be true for people running from source builds and # relying on pre-installed pythonservice.exe. # Note this is only used at install time, not runtime. if os.path.isfile(PYTHONSERVICE_EXE): _exe_name_ = PYTHONSERVICE_EXE process_runner = PYTHON process_args = '"%%s" -C "%%s"' %% (ZEO_RUN, CONFIG_FILE) def main(): import win32serviceutil win32serviceutil.HandleCommandLine(InstanceService) if __name__ == '__main__': main() PK.S8P„_ -plone/recipe/zope2zeoserver/tests/__init__.py# package PK)€S8Äy®ÕŸŸ.plone/recipe/zope2zeoserver/tests/__init__.pyc;ò YîºGc@sdS(N((((sObuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/tests/__init__.pys?sPK.S8xj¡±±.plone/recipe/zope2zeoserver/tests/test_docs.py# -*- coding: utf-8 -*- """ Grabs the doctests in /tests """ __docformat__ = 'restructuredtext' import unittest import doctest import sys import re import os import shutil import popen2 import StringIO from zope.testing import doctest, renormalizing import zc.buildout.testing, zc.buildout.easy_install current_dir = os.path.abspath(os.path.dirname(__file__)) recipe_location = current_dir for i in range(5): recipe_location = os.path.split(recipe_location)[0] def _right_platform(doc): if doc.endswith('win32.txt'): return sys.platform == 'win32' return True def doc_suite(test_dir, globs=None): """Returns a test suite, based on doctests found in /doctest.""" suite = [] if globs is None: globs = globals() flags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE) doctest_dir = test_dir # filtering files on extension docs = [os.path.join(doctest_dir, doc) for doc in os.listdir(doctest_dir) if doc.endswith('.txt') if _right_platform(doc)] for test in docs: suite.append(doctest.DocFileSuite(test, optionflags=flags, globs=globs, setUp=zc.buildout.testing.buildoutSetUp, tearDown=zc.buildout.testing.buildoutTearDown, checker=renormalizing.RENormalizing([ zc.buildout.testing.normalize_path, (re.compile(r'\S+buildout.py'), 'buildout.py'), (re.compile(r'line \d+'), 'line NNN'), (re.compile(r'py\(\d+\)'), 'py(NNN)'), ]) , module_relative=False)) return unittest.TestSuite(suite) def test_suite(): """returns the test suite""" return doc_suite(current_dir) if __name__ == '__main__': unittest.main(defaultTest='test_suite') PK)€S8;9K  /plone/recipe/zope2zeoserver/tests/test_docs.pyc;ò YîºGc@s dZdZdkZdkZdkZdkZdkZdkZdkZdk Z dk lZl Z dk Z dkZ eiieiieƒƒZeZx*edƒD]ZeiieƒdZqªWd„Zed„Zd„Zed joeid d ƒndS( s Grabs the doctests in /tests srestructuredtextN(sdoctests renormalizingiicCs)|idƒotidjSntSdS(Ns win32.txtswin32(sdocsendswithssyssplatformsTrue(sdoc((sPbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/tests/test_docs.pys_right_platformsc CsZg}|tjo tƒ}ntitiBtiB}|}gi }t i|ƒD]D}|idƒo.t|ƒo|t ii||ƒƒq˜qTqT~}x¥|D]}|i ti|d|d|dtiiidtiiidtitiiiti dƒdfti d ƒd fti d ƒd fgƒd t!ƒƒq¨Wt"i#|ƒSdS(s:Returns a test suite, based on doctests found in /doctest.s.txts optionflagssglobsssetUpstearDownscheckers\S+buildout.pys buildout.pysline \d+sline NNNs py\(\d+\)spy(NNN)smodule_relativeN($ssuitesglobssNonesglobalssdoctestsELLIPSISsNORMALIZE_WHITESPACEsREPORT_ONLY_FIRST_FAILUREsflagsstest_dirs doctest_dirsappends_[1]sosslistdirsdocsendswiths_right_platformspathsjoinsdocsstests DocFileSuiteszcsbuildoutstestings buildoutSetUpsbuildoutTearDowns renormalizings RENormalizingsnormalize_pathsrescompilesFalsesunittests TestSuite( stest_dirsglobss doctest_dirsdocss_[1]sflagssdocstestssuite((sPbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/tests/test_docs.pys doc_suites   dQcCsttƒSdS(sreturns the test suiteN(s doc_suites current_dir(((sPbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/tests/test_docs.pys test_suite>ss__main__s defaultTests test_suite(s__doc__s __docformat__sunittestsdoctestssyssresossshutilspopen2sStringIOs zope.testings renormalizingszc.buildout.testingszcszc.buildout.easy_installspathsabspathsdirnames__file__s current_dirsrecipe_locationsrangesissplits_right_platformsNones doc_suites test_suites__name__smain(srecipe_locationsStringIOsis current_dirsunittestspopen2s __docformat__szcssyssres test_suites renormalizingsdoctests_right_platformsshutilsoss doc_suite((sPbuild/bdist.darwin-9.2.0-i386/egg/plone/recipe/zope2zeoserver/tests/test_docs.pys?s*            PK.S8™µ· È È 5plone/recipe/zope2zeoserver/tests/zeoserver-win32.txt=========================== plone.recipe.zope2zeoserver =========================== These tests are specific to win32. They make sure runzeo.bat and zeoservice.py are created properly. :: >>> from zc.buildout.testing import * >>> from os.path import join >>> import sys, os Let's create a minimum buildout that uses the current plone.recipe.zope2instance:: >>> simplest = ''' ... [buildout] ... parts = zeo ... develop = ... %(recipe_location)s ... ... [zeo] ... recipe = plone.recipe.zope2zeoserver ... ... ''' % globals() >>> write('buildout.cfg', simplest) Let's run it:: >>> print system(join('bin', 'buildout')), Develop: '...' ... Generated script '.../bin/zeo'. Generated script '.../bin/zeopack'. ... Changed mode for ... to 755 We should have a basic zeo.conf:: >>> zeo = os.path.join(sample_buildout, 'parts', 'zeo') >>> print open(os.path.join(zeo, 'etc', 'zeo.conf')).read() %define INSTANCE /sample-buildout/parts/zeo address 8100 read-only false invalidation-queue-size 100 pid-filename /sample-buildout/var/zeo.pid path /sample-buildout/var/filestorage/Data.fs level info path /sample-buildout/var/log/zeo.log format %(message)s program $INSTANCE/bin/runzeo socket-name /sample-buildout/var/zeo.zdsock daemon true forever false backoff-limit 10 exit-codes 0, 2 directory $INSTANCE default-to-interactive true # This logfile should match the one in the zeo.conf file. # It is used by zdctl's logtail command, zdrun/zdctl doesn't write it. logfile /sample-buildout/var/log/zeo.log And some win32 specific scripts:: >>> ls(join(sample_buildout, 'bin')) - ... - runzeo.bat ... - zeoservice-script.py - zeoservice.exe - zeoservice.py Let's check the files we got. First of all, the batch script:: >>> print open(join(sample_buildout, 'bin', 'runzeo.bat')).read() @rem zeo instance start script ... @set PYTHONPATH=%ZODB3_HOME% @set RUNZEO=%ZODB3_HOME%/ZEO/runzeo.py "%PYTHON%" "%RUNZEO%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5 %6 %7 %8 %9 And the service script:: >>> print open(join(sample_buildout, 'bin', 'zeoservice.py')).read() #... ... def main(): import win32serviceutil win32serviceutil.HandleCommandLine(InstanceService) if __name__ == '__main__': main() PK.S8·©#j j /plone/recipe/zope2zeoserver/tests/zeoserver.txt=========================== plone.recipe.zope2zeoserver =========================== This is the doctest for plone.recipe.zope2instance. It ensures the template works fine. It is based on zc.buildout testing module:: >>> from zc.buildout.testing import * >>> from os.path import join >>> import sys, os Let's create a minimum buildout that uses the current plone.recipe.zope2instance:: >>> simplest = ''' ... [buildout] ... parts = zeo ... develop = ... %(recipe_location)s ... ... [zeo] ... recipe = plone.recipe.zope2zeoserver ... ... ''' % globals() >>> write('buildout.cfg', simplest) Let's run it:: >>> print system(join('bin', 'buildout')), Develop: '...' ... We should have a basic zeo.conf:: >>> zeo = os.path.join(sample_buildout, 'parts', 'zeo') >>> print open(os.path.join(zeo, 'etc', 'zeo.conf')).read() %define INSTANCE /sample-buildout/parts/zeo address 8100 read-only false invalidation-queue-size 100 pid-filename /sample-buildout/var/zeo.pid path /sample-buildout/var/filestorage/Data.fs level info path /sample-buildout/var/log/zeo.log format %(message)s program $INSTANCE/bin/runzeo socket-name /sample-buildout/var/zeo.zdsock daemon true forever false backoff-limit 10 exit-codes 0, 2 directory $INSTANCE default-to-interactive true # This logfile should match the one in the zeo.conf file. # It is used by zdctl's logtail command, zdrun/zdctl doesn't write it. logfile /sample-buildout/var/log/zeo.log Custom Zeo log ============== `zeo-log-custom` is a new option that allows you to create a custom zeo log section. For example, let's say you want to use `rotatezlogs`:: >>> write('buildout.cfg', ... ''' ... [buildout] ... parts = zeo ... develop = ... %(recipe_location)s ... ... [zeo] ... recipe = plone.recipe.zope2zeoserver ... ... zeo-log-custom = ... %%import iw.rotatezlogs ... ... path %(sample_buildout)s/var/log/zeo.log ... max-bytes 1MB ... backup-count 5 ... ... ... ''' % globals()) Let's run it:: >>> print system(join('bin', 'buildout')), Develop: '...' Uninstalling zeo. Installing zeo. ... Changed mode for ... to 755 We should have a zeo.conf with a rotatezlog:: >>> zeo = os.path.join(sample_buildout, 'parts', 'zeo') >>> print open(os.path.join(zeo, 'etc', 'zeo.conf')).read() %define INSTANCE ... ... level info %import iw.rotatezlogs path ...zeo.log max-bytes 1MB backup-count 5 ... PK)€S8µjÞÞ¤EGG-INFO/PKG-INFOPK)€S8ÖüBPÖÖ¤ EGG-INFO/SOURCES.txtPK)€S8“×2¤EGG-INFO/dependency_links.txtPK)€S8Rzö‘<<¤QEGG-INFO/entry_points.txtPK)€S8묤 ¤ÄEGG-INFO/namespace_packages.txtPK€S8“×2¤EGG-INFO/not-zip-safePK)€S8”'â·$$¤HEGG-INFO/requires.txtPK)€S8­Aq?¤ŸEGG-INFO/top_level.txtPK.S8š­¬#ôô¤Ùplone/__init__.pyPK)€S8¶y“ƒƒ¤üplone/__init__.pycPK.S8š­¬#ôô¤¯!plone/recipe/__init__.pyPK)€S8-NŠŠ¤Ù"plone/recipe/__init__.pycPK.S8ª’Žcï:ï:'¤š$plone/recipe/zope2zeoserver/__init__.pyPK)€S8 ÒHZ}3}3(¤Î_plone/recipe/zope2zeoserver/__init__.pycPK.S8—öâ$$"¤‘“plone/recipe/zope2zeoserver/ctl.pyPK)€S8*pZ¡RR#¤õ™plone/recipe/zope2zeoserver/ctl.pycPK.S8HK@&&#¤ˆŸplone/recipe/zope2zeoserver/pack.pyPK)€S8.òËÿÎÎ$¤ï plone/recipe/zope2zeoserver/pack.pycPK.S8tÑ11&¤ÿ£plone/recipe/zope2zeoserver/runzeo.batPK.S8Ñ#ÿíxx)¤t¥plone/recipe/zope2zeoserver/zeoservice.pyPK.S8P„_ -¤3¶plone/recipe/zope2zeoserver/tests/__init__.pyPK)€S8Äy®ÕŸŸ.¤ˆ¶plone/recipe/zope2zeoserver/tests/__init__.pycPK.S8xj¡±±.¤s·plone/recipe/zope2zeoserver/tests/test_docs.pyPK)€S8;9K  /¤p¿plone/recipe/zope2zeoserver/tests/test_docs.pycPK.S8™µ· È È 5¤ÏËplone/recipe/zope2zeoserver/tests/zeoserver-win32.txtPK.S8·©#j j /¤êÖplone/recipe/zope2zeoserver/tests/zeoserver.txtPK¡ã