From 6965bd89216a8d759ff8ea35ca4d1e88b0c35906 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 25 Feb 2008 00:24:03 -0500 Subject: Rework the basic infrastructure for qrunner process control. Split out the functionality of mailmanctl into a separate master watcher script. mailmanctl has not yet been updated but that'll happen next. Fix DELIVERY_MODULE to name a handler instead of a module. Change make_instance to use pkg_resources instead of module.__file__. Change the qrunner and master processes coordination so that the qrunners are not restarted on SIGINT, because otherwise C-c just doesn't work. Now SIGUSR1 is how we'll implement 'mailman restart'. Add a database commit so that initializing the schema doesn't lock the sqlite database. Also, don't try to initialize the schema if the tables already exist. Use some sqlite magic to do this test. Move mailman.cfg.in into a new package Mailman/extras inside the tree. Also, MAILMAN_UID and MAILMAN_GID should be integers not strings. Convert the command runner to use an IHandler instance instead of handler module. Similarly for the outgoing runner, DELIVERY_MODULE now names an IHandler instance instead of a handler module. --- Mailman/bin/make_instance.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Mailman/bin/make_instance.py') diff --git a/Mailman/bin/make_instance.py b/Mailman/bin/make_instance.py index 26e799470..1f93c39bb 100644 --- a/Mailman/bin/make_instance.py +++ b/Mailman/bin/make_instance.py @@ -25,9 +25,9 @@ import errno import shutil import optparse import setuptools -from string import Template -import Mailman.data +from pkg_resources import resource_string +from string import Template from Mailman import Defaults from Mailman.Version import MAILMAN_VERSION @@ -35,7 +35,6 @@ from Mailman.i18n import _ SPACE = ' ' -DATA_DIR = os.path.dirname(Mailman.data.__file__) @@ -131,15 +130,13 @@ def instantiate(var_dir, user, group, languages, force): # Create an etc/mailman.cfg file which contains just a few configuration # variables about the run-time environment that can't be calculated. # Don't overwrite mailman.cfg unless the -f flag was given. - in_file_path = os.path.join(DATA_DIR, 'mailman.cfg.in') out_file_path = os.path.join(etc_dir, 'mailman.cfg') if os.path.exists(out_file_path) and not force: # The logging subsystem isn't up yet, so just print this to stderr. print >> sys.stderr, 'File exists:', out_file_path print >> sys.stderr, 'Use --force to override.' else: - with open(in_file_path) as fp: - raw = Template(fp.read()) + raw = Template(resource_string('Mailman.extras', 'mailman.cfg.in')) processed = raw.safe_substitute(var_dir=var_dir, user_id=uid, user_name=user_name, -- cgit v1.2.3-70-g09d2