summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2006-05-01 23:19:38 +0000
committerbwarsaw2006-05-01 23:19:38 +0000
commit59bbe4f47bddd81e4d0b57be6be196f0e35f440b (patch)
tree89d9b83b7fdee1949e07eca2ecd5f9551478c744
parent8f8aba159d82769d2ba33cbc5d268110a5fe33c5 (diff)
downloadmailman-59bbe4f47bddd81e4d0b57be6be196f0e35f440b.tar.gz
mailman-59bbe4f47bddd81e4d0b57be6be196f0e35f440b.tar.zst
mailman-59bbe4f47bddd81e4d0b57be6be196f0e35f440b.zip
Convert bin/inject and bin/version to Mailman.bin modules. Remove rb-archfix.
-rw-r--r--Mailman/bin/inject.py92
-rwxr-xr-xMailman/bin/rmlist.py2
-rw-r--r--Mailman/bin/version.py50
-rw-r--r--bin/Makefile.in10
-rw-r--r--bin/inject107
-rw-r--r--bin/rb-archfix108
-rw-r--r--bin/version26
-rwxr-xr-xconfigure5
-rw-r--r--configure.in5
9 files changed, 150 insertions, 255 deletions
diff --git a/Mailman/bin/inject.py b/Mailman/bin/inject.py
new file mode 100644
index 000000000..1b25ec1bf
--- /dev/null
+++ b/Mailman/bin/inject.py
@@ -0,0 +1,92 @@
+# Copyright (C) 2002-2006 by the Free Software Foundation, Inc.
+#
+# This program 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
+# of the License, or (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+import os
+import sys
+import optparse
+
+from Mailman import Post
+from Mailman import Utils
+from Mailman import mm_cfg
+from Mailman.i18n import _
+
+__i18n_templates__ = True
+
+
+
+def parseargs():
+ parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ usage=_("""\
+%prog [options] [filename]
+
+Inject a message from a file into Mailman's incoming queue. 'filename' is the
+name of the plaintext message file to inject. If omitted, standard input is
+used.
+"""))
+ parser.add_option('-l', '--listname',
+ type='string', help=_("""\
+The name of the list to inject this message to. Required."""))
+ parser.add_option('-q', '--queue',
+ type='string', help=_("""\
+The name of the queue to inject the message to. The queuename must be one of
+the directories inside the qfiles directory. If omitted, the incoming queue
+is used."""))
+ opts, args = parser.parse_args()
+ if len(args) > 1:
+ parser.print_help()
+ print >> sys.stderr, _('Unexpected arguments')
+ sys.exit(1)
+ if opts.listname is None:
+ parser.print_help()
+ print >> sys.stderr, _('-l is required')
+ sys.exit(1)
+ return parser, opts, args
+
+
+
+def main():
+ parser, opts, args = parseargs()
+
+ if opts.queue:
+ qdir = os.path.join(mm_cfg.QUEUE_DIR, opts.queue)
+ if not os.path.isdir(qdir):
+ parser.print_help()
+ print >> sys.stderr, _('Bad queue directory: $qdir')
+ sys.exit(1)
+ else:
+ qdir = mm_cfg.INQUEUE_DIR
+
+ if not Utils.list_exists(opts.listname):
+ parser.print_help()
+ print >> sys.stderr, _('No such list: $opts.listname')
+ sys.exit(1)
+
+ if args:
+ fp = open(args[0])
+ try:
+ msgtext = fp.read()
+ finally:
+ fp.close()
+ else:
+ msgtext = sys.stdin.read()
+
+ Post.inject(opts.listname, msgtext, qdir=qdir)
+
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Mailman/bin/rmlist.py b/Mailman/bin/rmlist.py
index 9d83bf1b6..aef927c88 100755
--- a/Mailman/bin/rmlist.py
+++ b/Mailman/bin/rmlist.py
@@ -46,7 +46,7 @@ def remove_it(listname, filename, msg):
def parseargs():
parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
usage=_("""\
-%%prog [options] listname
+%prog [options] listname
Remove the components of a mailing list with impunity - beware!
diff --git a/Mailman/bin/version.py b/Mailman/bin/version.py
new file mode 100644
index 000000000..dbf52c656
--- /dev/null
+++ b/Mailman/bin/version.py
@@ -0,0 +1,50 @@
+# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+#
+# This program 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
+# of the License, or (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+import optparse
+
+from Mailman import mm_cfg
+from Mailman.i18n import _
+
+__i18n_templates__ = True
+
+
+
+def parseargs():
+ parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ usage=_("""\
+%prog
+
+Print the Mailman version an exit."""))
+ opts, args = parser.parse_args()
+ if args:
+ parser.print_help()
+ print >> sys.stderr, _('Unexpected arguments')
+ sys.exit(1)
+ return parser, opts, args
+
+
+
+def main():
+ parser, opts, args = parseargs()
+ # Yes, this is kind of silly
+ print _('Using Mailman version: $mm_cfg.VERSION')
+
+
+
+if __name__ == '__main__':
+ main()
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 9be471942..75c72d296 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -47,14 +47,14 @@ SHELL= /bin/sh
SCRIPTS= mmshell add_members \
remove_members clone_member update \
sync_members check_db withlist check_perms find_member \
- version config_list dumpdb cleanarch \
- list_admins genaliases mailmanctl qrunner inject \
+ config_list dumpdb cleanarch \
+ list_admins genaliases mailmanctl qrunner \
fix_url.py convert.py transcheck \
- list_owners msgfmt.py discard rb-archfix \
+ list_owners msgfmt.py discard \
reset_pw.py templ2pot.py po2templ.py
-LN_SCRIPTS= arch change_pw list_lists list_members mmsitepass newlist \
- rmlist show_qfiles unshunt
+LN_SCRIPTS= arch change_pw inject list_lists list_members mmsitepass \
+ newlist rmlist show_qfiles unshunt version
BUILDDIR= ../build/bin
diff --git a/bin/inject b/bin/inject
deleted file mode 100644
index cc79f6310..000000000
--- a/bin/inject
+++ /dev/null
@@ -1,107 +0,0 @@
-#! @PYTHON@
-#
-# Copyright (C) 2002 by the Free Software Foundation, Inc.
-#
-# This program 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
-# of the License, or (at your option) any later version.
-#
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""Inject a message from a file into Mailman's incoming queue.
-
-Usage: inject [options] [filename]
-
-Options:
-
- -h / --help
- Print this text and exit.
-
- -l listname
- --listname=listname
- The name of the list to inject this message to. Required.
-
- -q queuename
- --queue=queuename
- The name of the queue to inject the message to. The queuename must be
- one of the directories inside the qfiles directory. If omitted, the
- incoming queue is used.
-
-filename is the name of the plaintext message file to inject. If omitted,
-standard input is used.
-"""
-
-import sys
-import os
-import getopt
-
-import paths
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman import Post
-from Mailman.i18n import _
-
-
-
-def usage(code, msg=''):
- if code:
- fd = sys.stderr
- else:
- fd = sys.stdout
- print >> fd, _(__doc__)
- if msg:
- print >> fd, msg
- sys.exit(code)
-
-
-
-def main():
- try:
- opts, args = getopt.getopt(
- sys.argv[1:], 'hl:q:L',
- ['help', 'listname=', 'queue=', 'showqnames'])
- except getopt.error, msg:
- usage(1, msg)
-
- qdir = mm_cfg.INQUEUE_DIR
- listname = None
-
- for opt, arg in opts:
- if opt in ('-h', '--help'):
- usage(0)
- elif opt in ('-q', '--queue'):
- qdir = os.path.join(mm_cfg.QUEUE_DIR, arg)
- if not os.path.isdir(qdir):
- usage(1, _('Bad queue directory: %(qdir)s'))
- elif opt in ('-l', '--listname'):
- listname = arg
-
- if listname is None:
- usage(1, _('A list name is required'))
- elif not Utils.list_exists(listname):
- usage(1, _('No such list: %(listname)s'))
-
- if len(args) == 0:
- # Use standard input
- msgtext = sys.stdin.read()
- elif len(args) == 1:
- fp = open(args[0])
- msgtext = fp.read()
- fp.close()
- else:
- usage(1)
-
- Post.inject(listname, msgtext, qdir=qdir)
-
-
-
-if __name__ == '__main__':
- main()
diff --git a/bin/rb-archfix b/bin/rb-archfix
deleted file mode 100644
index fceadc273..000000000
--- a/bin/rb-archfix
+++ /dev/null
@@ -1,108 +0,0 @@
-#! @PYTHON@
-#
-# Copyright (C) 2003 by the Free Software Foundation, Inc.
-#
-# This program 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
-# of the License, or (at your option) any later version.
-#
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# Author: Richard Barrett
-
-"""Reduce disk space usage for Pipermail archives.
-
-Usage: %(PROGRAM)s [options] file ...
-
-Where options are:
- -h / --help
- Print this help message and exit.
-
-Only use this to 'fix' archive -article database files that have been written
-with Mailman 2.1.3 or earlier and have html_body attributes in them. These
-attributes can cause huge amounts of memory bloat and impact performance for
-high activity lists, particularly those where large text postings are made to
-them.
-
-Example:
-
-%% ls -1 archives/private/*/database/*-article | xargs %(PROGRAM)s
-
-You should run `bin/check_perms -f' after running this script.
-
-You will probably want to delete the -article.bak files created by this script
-when you are satisfied with the results.
-
-This script is provided for convenience purposes only. It isn't supported.
-"""
-
-import os
-import sys
-import getopt
-import marshal
-import cPickle as pickle
-
-# Required to get the right classes for unpickling
-import paths
-from Mailman.i18n import _
-
-PROGRAM = sys.argv[0]
-
-
-
-def usage(code, msg=''):
- if code:
- fd = sys.stderr
- else:
- fd = sys.stdout
- print >> fd, _(__doc__)
- if msg:
- print >> fd, msg
- sys.exit(code)
-
-
-
-def main():
- # get command line arguments
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'h', ['help'])
- except getopt.error, msg:
- usage(1, msg)
-
- for opt, arg in opts:
- if opt in ('-h', '--help'):
- usage(0)
-
- for filename in args:
- print 'processing:', filename
- fp = open(filename, 'rb')
- d = marshal.load(fp)
- fp.close()
- newd = {}
- for key, pckstr in d.items():
- article = pickle.loads(pckstr)
- try:
- del article.html_body
- except AttributeError:
- pass
- newd[key] = pickle.dumps(article)
- fp = open(filename + '.tmp', 'wb')
- marshal.dump(newd, fp)
- fp.close()
- os.rename(filename, filename + '.bak')
- os.rename(filename + '.tmp', filename)
-
- print 'You should now run "bin/check_perms -f"'
-
-
-
-if __name__ == '__main__':
- main()
diff --git a/bin/version b/bin/version
deleted file mode 100644
index 72c50b890..000000000
--- a/bin/version
+++ /dev/null
@@ -1,26 +0,0 @@
-#! @PYTHON@
-#
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
-#
-# This program 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
-# of the License, or (at your option) any later version.
-#
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""Print the Mailman version.
-"""
-
-import paths
-import Mailman.mm_cfg
-from Mailman.i18n import _
-
-print _('Using Mailman version:'), Mailman.mm_cfg.VERSION
diff --git a/configure b/configure
index 711a884f9..dc118747e 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 7882 .
+# From configure.in Revision: 7886 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
@@ -4288,7 +4288,6 @@ build/bin/dumpdb:bin/dumpdb \
build/bin/find_member:bin/find_member \
build/bin/fix_url.py:bin/fix_url.py \
build/bin/genaliases:bin/genaliases \
-build/bin/inject:bin/inject \
build/bin/list_admins:bin/list_admins \
build/bin/list_owners:bin/list_owners \
build/bin/mailmanctl:bin/mailmanctl \
@@ -4301,9 +4300,7 @@ build/bin/reset_pw.py:bin/reset_pw.py \
build/bin/sync_members:bin/sync_members \
build/bin/transcheck:bin/transcheck \
build/bin/update:bin/update \
-build/bin/version:bin/version \
build/bin/withlist:bin/withlist \
-build/bin/rb-archfix:bin/rb-archfix \
build/bin/templ2pot.py:bin/templ2pot.py \
build/bin/po2templ.py:bin/po2templ.py \
build/contrib/check_perms_grsecurity.py:contrib/check_perms_grsecurity.py \
diff --git a/configure.in b/configure.in
index fe8ba0936..52f26827e 100644
--- a/configure.in
+++ b/configure.in
@@ -15,7 +15,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 7886 $)
+AC_REVISION($Revision: 7890 $)
AC_PREREQ(2.0)
AC_INIT(src/common.h)
@@ -606,7 +606,6 @@ bin/dumpdb \
bin/find_member \
bin/fix_url.py \
bin/genaliases \
-bin/inject \
bin/list_admins \
bin/list_owners \
bin/mailmanctl \
@@ -619,9 +618,7 @@ bin/reset_pw.py \
bin/sync_members \
bin/transcheck \
bin/update \
-bin/version \
bin/withlist \
-bin/rb-archfix \
bin/templ2pot.py \
bin/po2templ.py \
contrib/check_perms_grsecurity.py \