diff options
| -rw-r--r-- | Mailman/bin/list_owners.py | 87 | ||||
| -rw-r--r-- | bin/Makefile.in | 6 | ||||
| -rw-r--r-- | bin/list_owners | 120 | ||||
| -rwxr-xr-x | configure | 9 | ||||
| -rw-r--r-- | configure.in | 3 |
5 files changed, 95 insertions, 130 deletions
diff --git a/Mailman/bin/list_owners.py b/Mailman/bin/list_owners.py new file mode 100644 index 000000000..2ff6a9d53 --- /dev/null +++ b/Mailman/bin/list_owners.py @@ -0,0 +1,87 @@ +# 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 sys +import optparse + +from Mailman import Utils +from Mailman import mm_cfg +from Mailman.MailList import MailList +from Mailman.i18n import _ + +__i18n_templates__ = True + + + +def parseargs(): + parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION, + usage=_("""\ +%prog [options] [listname ...] + +List the owners of a mailing list, or all mailing lists if no list names are +given.""")) + parser.add_option('-w', '--with-listnames', + default=False, action='store_true', + help=_("""\ +Group the owners by list names and include the list names in the output. +Otherwise, the owners will be sorted and uniquified based on the email +address.""")) + parser.add_option('-m', '--moderators', + default=False, action='store_true', + help=_('Include the list moderators in the output.')) + opts, args = parser.parse_args() + return parser, opts, args + + + +def main(): + parser, opts, args = parseargs() + + listnames = args or Utils.list_names() + bylist = {} + + for listname in listnames: + mlist = MailList(listname, lock=False) + addrs = mlist.owner[:] + if opts.moderators: + addrs.extend(mlist.moderator) + bylist[listname] = addrs + + if opts.with_listnames: + for listname in listnames: + unique = set() + for addr in bylist[listname]: + unique.add(addr) + keys = list(unique) + keys.sort() + print listname + for k in keys: + print '\t', k + else: + unique = set() + for listname in listnames: + for addr in bylist[listname]: + unique.add(addr) + keys = list(unique) + keys.sort() + for k in keys: + print k + + + +if __name__ == '__main__': + main() diff --git a/bin/Makefile.in b/bin/Makefile.in index 75c72d296..46ae3f09a 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -50,11 +50,11 @@ SCRIPTS= mmshell add_members \ config_list dumpdb cleanarch \ list_admins genaliases mailmanctl qrunner \ fix_url.py convert.py transcheck \ - list_owners msgfmt.py discard \ + msgfmt.py discard \ reset_pw.py templ2pot.py po2templ.py -LN_SCRIPTS= arch change_pw inject list_lists list_members mmsitepass \ - newlist rmlist show_qfiles unshunt version +LN_SCRIPTS= arch change_pw inject list_lists list_members list_owners \ + mmsitepass newlist rmlist show_qfiles unshunt version BUILDDIR= ../build/bin diff --git a/bin/list_owners b/bin/list_owners deleted file mode 100644 index 5b050450d..000000000 --- a/bin/list_owners +++ /dev/null @@ -1,120 +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. - -"""List the owners of a mailing list, or all mailing lists. - -Usage: %(PROGRAM)s [options] [listname ...] -Options: - - -w / --with-listnames - Group the owners by list names and include the list names in the - output. Otherwise, the owners will be sorted and uniquified based on - the email address. - - -m / --moderators - Include the list moderators in the output. - - -h / --help - Print this help message and exit. - - listname - Print the owners of the specified lists. More than one can appear - after the options. If there are no listnames provided, the owners of - all the lists will be displayed. -""" - -import sys -import getopt - -import paths -from Mailman import Utils -from Mailman.MailList import MailList -from Mailman.i18n import _ - -PROGRAM = sys.argv[0] - -try: - True, False -except NameError: - True = 1 - False = 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(): - try: - opts, args = getopt.getopt(sys.argv[1:], 'wmh', - ['with-listnames', 'moderators', 'help']) - except getopt.error, msg: - usage(1, msg) - - withnames = moderators = False - for opt, arg in opts: - if opt in ('-h', '--help'): - usage(0) - elif opt in ('-m', '--moderators'): - moderators = True - elif opt in ('-w', '--with-listnames'): - withnames = True - - listnames = args or Utils.list_names() - bylist = {} - - for listname in listnames: - mlist = MailList(listname, lock=0) - addrs = mlist.owner[:] - if moderators: - addrs.extend(mlist.moderator) - bylist[listname] = addrs - - if withnames: - for listname in listnames: - unique = {} - for addr in bylist[listname]: - unique[addr] = 1 - keys = unique.keys() - keys.sort() - print listname - for k in keys: - print '\t', k - else: - unique = {} - for listname in listnames: - for addr in bylist[listname]: - unique[addr] = 1 - keys = unique.keys() - keys.sort() - for k in keys: - print k - - - -if __name__ == '__main__': - main() @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 7886 . +# From configure.in Revision: 7890 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # @@ -721,13 +721,13 @@ echo X"$0" | /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then + if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r "$srcdir/$ac_unique_file"; then +if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } @@ -736,7 +736,7 @@ if test ! -r "$srcdir/$ac_unique_file"; then { (exit 1); exit 1; }; } fi fi -(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null || +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` @@ -4289,7 +4289,6 @@ build/bin/find_member:bin/find_member \ build/bin/fix_url.py:bin/fix_url.py \ build/bin/genaliases:bin/genaliases \ build/bin/list_admins:bin/list_admins \ -build/bin/list_owners:bin/list_owners \ build/bin/mailmanctl:bin/mailmanctl \ build/bin/mmshell:bin/mmshell \ build/bin/msgfmt.py:bin/msgfmt.py \ diff --git a/configure.in b/configure.in index 52f26827e..68b33ffb9 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: 7890 $) +AC_REVISION($Revision: 7891 $) AC_PREREQ(2.0) AC_INIT(src/common.h) @@ -607,7 +607,6 @@ bin/find_member \ bin/fix_url.py \ bin/genaliases \ bin/list_admins \ -bin/list_owners \ bin/mailmanctl \ bin/mmshell \ bin/msgfmt.py \ |
