Update of /cvsroot/mailman/mailman/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv5232/bin
Modified Files:
Tag: Release_2_1-maint
add_members check_perms genaliases list_members remove_members
transcheck
Log Message:
Backporting various fixes and improvements from the trunk.
Index: add_members
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/add_members,v
retrieving revision 2.14
retrieving revision 2.14.2.1
diff -u -d -r2.14 -r2.14.2.1
--- add_members 24 Dec 2002 04:46:11 -0000 2.14
+++ add_members 31 Mar 2003 20:07:53 -0000 2.14.2.1
@@ -1,19 +1,19 @@
#! @PYTHON@
#
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# 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
+# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# argv[1] should be the name of the list.
@@ -38,13 +38,13 @@
-n/--non-digest-members-file are deprecated synonyms for this option.
--digest-members-file=file
- -d=file
+ -d file
Similar to above, but these people become digest members.
--changes-msg=<y|n>
- -c <y|n>
- Set whether or not to send the list members the `there's going to be
- big changes to your list' message. defaults to no.
+ -c <y|n>
+ Set whether or not to send the list members the `there's going to be
+ big changes to your list' message. defaults to no.
--welcome-msg=<y|n>
-w <y|n>
@@ -174,7 +174,7 @@
print >> tee, _('Hostile address (illegal characters): %(member)s')
else:
print >> tee, _('Subscribed: %(member)s')
-
+
def main():
@@ -186,7 +186,7 @@
'non-digest-members-file=',
'digest-members-file=',
'changes-msg=',
- 'welcome-msg=',
+ 'welcome-msg=',
'help'])
except getopt.error, msg:
usage(1, msg)
@@ -235,7 +235,7 @@
admin_notif = 0
else:
usage(1, _('Bad argument to -a/--admin-notify: %(arg)s'))
-
+
if dfile is None and nfile is None:
usage(1)
Index: check_perms
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/check_perms,v
retrieving revision 2.15
retrieving revision 2.15.2.1
diff -u -d -r2.15 -r2.15.2.1
--- check_perms 12 Nov 2002 21:28:32 -0000 2.15
+++ check_perms 31 Mar 2003 20:07:55 -0000 2.15.2.1
@@ -26,12 +26,12 @@
"""
-import sys
import os
-import errno
-import getopt
+import sys
import pwd
import grp
+import errno
+import getopt
from stat import *
try:
@@ -55,11 +55,17 @@
# Gotta check the archives/private/*/database/* files
+try:
+ True, False
+except NameError:
+ True = 1
+ False = 0
+
class State:
- FIX = 0
- VERBOSE = 0
+ FIX = False
+ VERBOSE = False
ERRORS = 0
STATE = State()
@@ -78,7 +84,13 @@
stat = os.stat(path)
return stat[ST_MODE], stat[ST_GID]
+seen = {}
+
def checkwalk(arg, dirname, names):
+ # Short-circuit duplicates
+ if seen.has_key(dirname):
+ return
+ seen[dirname] = True
for name in names:
path = os.path.join(dirname, name)
if arg.VERBOSE:
@@ -151,10 +163,16 @@
prefix = mm_cfg.PREFIX
print _('checking mode for %(prefix)s')
dirs = {}
- for d in (mm_cfg.PREFIX, mm_cfg.EXEC_PREFIX, mm_cfg.VAR_PREFIX):
- dirs[d] = 1
+ for d in (mm_cfg.PREFIX, mm_cfg.EXEC_PREFIX, mm_cfg.VAR_PREFIX,
+ mm_cfg.LOG_DIR):
+ dirs[d] = True
for d in dirs.keys():
- mode = statmode(d)
+ try:
+ mode = statmode(d)
+ except OSError, e:
+ if e.errno <> errno.ENOENT: raise
+ print _('WARNING: directory does not exist: %(d)s')
+ continue
if (mode & DIRPERMS) <> DIRPERMS:
STATE.ERRORS += 1
print _('directory must be at least 02775: %(d)s'),
@@ -166,7 +184,6 @@
# check all subdirs
os.path.walk(d, checkwalk, STATE)
-
def checkarchives():
private = mm_cfg.PRIVATE_ARCHIVE_FILE_DIR
if STATE.VERBOSE:
@@ -185,7 +202,6 @@
MBOXPERMS = S_IRGRP | S_IWGRP | S_IRUSR | S_IWUSR
-
def checkmboxfile(mboxdir):
absdir = os.path.join(mm_cfg.PRIVATE_ARCHIVE_FILE_DIR, mboxdir)
for f in os.listdir(absdir):
@@ -202,7 +218,6 @@
else:
print
-
def checkarchivedbs():
# The archives/private/listname/database file must not be other readable
# or executable otherwise those files will be accessible when the archives
@@ -226,7 +241,6 @@
else:
print
-
def checkcgi():
cgidir = os.path.join(mm_cfg.EXEC_PREFIX, 'cgi-bin')
if STATE.VERBOSE:
@@ -332,8 +346,7 @@
if __name__ == '__main__':
try:
- opts, args = getopt.getopt(sys.argv[1:],
- 'fvh',
+ opts, args = getopt.getopt(sys.argv[1:], 'fvh',
['fix', 'verbose', 'help'])
except getopt.error, msg:
usage(1, msg)
@@ -342,9 +355,9 @@
if opt in ('-h', '--help'):
usage(0)
elif opt in ('-f', '--fix'):
- STATE.FIX = 1
+ STATE.FIX = True
elif opt in ('-v', '--verbose'):
- STATE.VERBOSE = 1
+ STATE.VERBOSE = True
checkall()
checkarchives()
Index: genaliases
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/genaliases,v
retrieving revision 2.11
retrieving revision 2.11.2.1
diff -u -d -r2.11 -r2.11.2.1
--- genaliases 21 Oct 2002 22:36:56 -0000 2.11
+++ genaliases 31 Mar 2003 20:07:55 -0000 2.11.2.1
@@ -1,37 +1,40 @@
#! @PYTHON@
#
-# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-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
+# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-"""Regenerate Postfix's data/aliases and data/aliases.db files from scratch.
-
-Usage:
+"""Regenerate Mailman specific aliases from scratch.
- genaliases [options]
+The actual output depends on the value of the `MTA' variable in your mm_cfg.py
+file.
+Usage: genaliases [options]
Options:
+ -q/--quiet
+ Some MTA output can include more verbose help text. Use this to tone
+ down the verbosity.
+
-h/--help
Print this message and exit.
"""
-import sys
import os
+import sys
import getopt
-import fcntl
import paths # path hacking
from Mailman import mm_cfg
@@ -39,6 +42,12 @@
from Mailman import MailList
from Mailman.i18n import _
+try:
+ True, False
+except NameError:
+ True = 1
+ False = 0
+
def usage(code, msg=''):
@@ -54,32 +63,35 @@
def main():
+ quiet = False
try:
- opts, args = getopt.getopt(sys.argv[1:], 'h', ['help'])
+ opts, args = getopt.getopt(sys.argv[1:], 'hq',
+ ['help', 'quiet'])
except getopt.error, msg:
usage(1, msg)
for opt, arg in opts:
if opt in ('-h', '--help'):
usage(0)
+ elif opt in ('-q', '--quiet'):
+ quiet = True
if args:
usage(1)
- # Open up the MTA specific module
+ # Import the MTA specific module
modulename = 'Mailman.MTA.' + mm_cfg.MTA
__import__(modulename)
MTA = sys.modules[modulename]
- # Open the text file and Berkeley DB files, truncating any data already
- # there. We need to acquire a lock so nobody tries to update the files
- # while we're doing it.
+ # We need to acquire a lock so nobody tries to update the files while
+ # we're doing it.
lock = MTA.makelock()
lock.lock()
# Group lists by virtual hostname
mlists = {}
for listname in Utils.list_names():
- mlist = MailList.MailList(listname, lock=0)
+ mlist = MailList.MailList(listname, lock=False)
mlists.setdefault(mlist.host_name, []).append(mlist)
# Make sure the files are created rw-rw-xxx; it should be okay to be world
# readable.
@@ -87,14 +99,16 @@
try:
MTA.clear()
if not mlists:
- MTA.create(None, nolock=1)
+ MTA.create(None, nolock=True, quiet=quiet)
else:
for hostname, vlists in mlists.items():
for mlist in vlists:
- MTA.create(mlist, nolock=1)
+ MTA.create(mlist, nolock=True, quiet=quiet)
+ # Be verbose for only the first printed list
+ quiet = True
finally:
os.umask(omask)
- lock.unlock(unconditionally=1)
+ lock.unlock(unconditionally=True)
Index: list_members
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/list_members,v
retrieving revision 2.12
retrieving revision 2.12.2.1
diff -u -d -r2.12 -r2.12.2.1
--- list_members 2 Dec 2002 14:41:29 -0000 2.12
+++ list_members 31 Mar 2003 20:07:56 -0000 2.12.2.1
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# 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
@@ -61,6 +61,7 @@
"""
import sys
+from types import UnicodeType
import paths
from Mailman import mm_cfg
@@ -72,6 +73,8 @@
from email.Utils import formataddr
PROGRAM = sys.argv[0]
+ENC = sys.getdefaultencoding()
+
WHYCHOICES = {'enabled' : MemberAdaptor.ENABLED,
'unknown' : MemberAdaptor.UNKNOWN,
'byuser' : MemberAdaptor.BYUSER,
@@ -92,6 +95,15 @@
+def safe(s):
+ if not s:
+ return ''
+ if isinstance(s, UnicodeType):
+ return s.encode(ENC, 'replace')
+ return unicode(s, ENC, 'replace').encode(ENC, 'replace')
+
+
+
def whymatches(mlist, addr, why):
# Return true if the `why' matches the reason the address is enabled, or
# in the case of why is None, that they are disabled for any reason
@@ -199,17 +211,15 @@
if regular:
rmembers.sort()
for addr in rmembers:
- name = fullnames and mlist.getMemberName(addr)
+ name = fullnames and mlist.getMemberName(addr) or ''
# Filter out nomails
if nomail and not whymatches(mlist, addr, why):
continue
- enc = sys.getdefaultencoding()
- s = formataddr((name, addr)).encode(enc, 'replace')
- print >> fp, s
+ print >> fp, formataddr((safe(name), addr))
if digest:
dmembers.sort()
for addr in dmembers:
- name = fullnames and mlist.getMemberName(addr)
+ name = fullnames and mlist.getMemberName(addr) or ''
# Filter out nomails
if nomail and not whymatches(mlist, addr, why):
continue
@@ -222,9 +232,7 @@
# They're getting MIME digests
if kind == 'plain':
continue
- enc = sys.getdefaultencoding()
- s = formataddr((name, addr)).encode(enc, 'replace')
- print >> fp, s
+ print >> fp, formataddr((safe(name), addr))
Index: remove_members
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/remove_members,v
retrieving revision 2.7
retrieving revision 2.7.2.1
diff -u -d -r2.7 -r2.7.2.1
--- remove_members 10 Dec 2002 06:07:51 -0000 2.7
+++ remove_members 31 Mar 2003 20:07:56 -0000 2.7.2.1
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# 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
@@ -31,21 +31,23 @@
--all
-a
Remove all members of the mailing list.
- (mutually exclusive with --fromall)
+ (mutually exclusive with --fromall)
--fromall
- Removes the given addresses from all the lists on this system
- regardless of virtual domains if you have any. This option cannot be
- used -a/--all. Also, you should not specify a listname when using this
- option.
+ Removes the given addresses from all the lists on this system
+ regardless of virtual domains if you have any. This option cannot be
+ used -a/--all. Also, you should not specify a listname when using
+ this option.
--nouserack
-n
- Don't send the user acknowledgements.
+ Don't send the user acknowledgements. If not specified, the list
+ default value is used.
--noadminack
-N
- Don't send the admin acknowledgements.
+ Don't send the admin acknowledgements. If not specified, the list
+ default value is used.
--help
-h
@@ -66,6 +68,12 @@
from Mailman import Errors
from Mailman.i18n import _
+try:
+ True, False
+except NameError:
+ True = 1
+ False = 0
+
def usage(code, msg=''):
@@ -83,10 +91,10 @@
lines = []
if filename == "-":
fp = sys.stdin
- closep = 0
+ closep = False
else:
fp = open(filename)
- closep = 1
+ closep = True
lines = filter(None, [line.strip() for line in fp.readlines()])
if closep:
fp.close()
@@ -106,10 +114,11 @@
usage(1)
filename = None
- all = 0
- alllists = 0
- userack = 1
- admin_notif = 1
+ all = False
+ alllists = False
+ # None means use list default
+ userack = None
+ admin_notif = None
for opt, arg in opts:
if opt in ('-h', '--help'):
@@ -117,13 +126,13 @@
elif opt in ('-f', '--file'):
filename = arg
elif opt in ('-a', '--all'):
- all = 1
+ all = True
elif opt == '--fromall':
- alllists = 1
+ alllists = True
elif opt in ('-n', '--nouserack'):
- userack = 0
+ userack = False
elif opt in ('-N', '--noadminack'):
- admin_notif = 0
+ admin_notif = False
# You probably don't want to delete all the users of all the lists -- Marc
if all and alllists:
@@ -163,10 +172,8 @@
if not alllists:
print _('No such member: %(addr)s')
continue
- mlist.ApprovedDeleteMember(addr,
- 'bin/remove_members',
- admin_notif,
- userack)
+ mlist.ApprovedDeleteMember(addr, 'bin/remove_members',
+ admin_notif, userack)
if alllists:
print _("User `%(addr)s' removed from list: %(listname)s.")
mlist.Save()
Index: transcheck
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/transcheck,v
retrieving revision 2.5
retrieving revision 2.5.2.1
diff -u -d -r2.5 -r2.5.2.1
--- transcheck 28 Oct 2002 03:20:27 -0000 2.5
+++ transcheck 31 Mar 2003 20:07:57 -0000 2.5.2.1
@@ -55,14 +55,19 @@
class TransChecker:
"check a translation comparing with the original string"
- def __init__(self, regexp):
+ def __init__(self, regexp, escaped=None):
self.dict = {}
self.errs = []
self.regexp = re.compile(regexp)
+ self.escaped = None
+ if escaped:
+ self.escaped = re.compile(escaped)
def checkin(self, string):
"scan a string from the original file"
for key in self.regexp.findall(string):
+ if self.escaped and self.escaped.match(key):
+ continue
if self.dict.has_key(key):
self.dict[key] += 1
else:
@@ -71,6 +76,8 @@
def checkout(self, string):
"scan a translated string"
for key in self.regexp.findall(string):
+ if self.escaped and self.escaped.match(key):
+ continue
if self.dict.has_key(key):
self.dict[key] -= 1
else:
@@ -273,9 +280,9 @@
search also <MM-*> tags if html is not zero"""
if html:
- c = TransChecker("(%\([^)]+\)[0-9]*[sd]|</?MM-[^>]+>)")
+ c = TransChecker("(%%|%\([^)]+\)[0-9]*[sd]|</?MM-[^>]+>)", "^%%$")
else:
- c = TransChecker("(%\([^)]+\)[0-9]*[sd])")
+ c = TransChecker("(%%|%\([^)]+\)[0-9]*[sd])", "^%%$")
try:
f = open(originalFile)
@@ -319,7 +326,7 @@
"scan the po file comparing msgids with msgstrs"
n = 0
p = POParser(file)
- c = TransChecker("(%\([^)]+\)[0-9]*[sdu]|%[0-9]*[sdu])")
+ c = TransChecker("(%%|%\([^)]+\)[0-9]*[sdu]|%[0-9]*[sdu])", "^%%$")
while p.parse():
if p.msgstr:
c.reset()
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins