]> code.delx.au - gnu-emacs-elpa/commitdiff
Add optional override file to override maintainers.
authorGlenn Morris <rgm@gnu.org>
Tue, 22 May 2012 07:22:25 +0000 (00:22 -0700)
committerGlenn Morris <rgm@gnu.org>
Tue, 22 May 2012 07:22:25 +0000 (00:22 -0700)
Allow "nomail" to mean no mail is to be forwarded.

admin/forward-diffs.py

index 1a5626618275f1707e700c83e9de832a4709ee34..abd7c0b355b12e10b01c8764ddd15b066069aa8b 100755 (executable)
 ##
 ## package1   email1
 ## package2   email2,email3
+##
+## Use "nomail" for the email field to not send a mail.
+##
+## overmaintfile = like maintfile, but takes precedence over it.
 
 ### Code:
 
@@ -48,7 +52,8 @@ import smtplib
 import datetime
 import os
 
-usage="""usage: %prog <-m maintfile> <-l logfile> <-s sender> [--sendmail]
+usage="""usage: %prog <-m maintfile> <-l logfile> <-s sender>
+   [-o overmaintfile] [--sendmail]
 Take a GNU ELPA diff on stdin, and forward it to the maintainer(s)."""
 
 parser = optparse.OptionParser()
@@ -57,6 +62,8 @@ parser.add_option( "-m", dest="maintfile", default=None,
                    help="file listing packages and maintainers")
 parser.add_option( "-l", dest="logfile", default=None,
                    help="file to append output to")
+parser.add_option( "-o", dest="overmaintfile", default=None,
+                   help="override file listing packages and maintainers")
 parser.add_option( "-s", dest="sender", default=None,
                    help="sender address for forwards")
 parser.add_option( "--sendmail", dest="sendmail", default=False,
@@ -98,6 +105,21 @@ for line in mfile:
 mfile.close()
 
 
+if opts.overmaintfile:
+    try:
+        ofile = open( opts.overmaintfile, 'r' )
+    except Exception as err:
+        lfile.write('Error opening overmaintfile: %s\n' % str(err))
+        sys.exit(1)
+
+    for line in ofile:
+        if re.match( '^#|^ *$', line ): continue
+        (pack, maint) = line.split()
+        maints[pack] = maint.split(',')
+
+    ofile.close()
+
+
 stdin = sys.stdin
 
 text = stdin.read()
@@ -165,6 +187,11 @@ for line in text.splitlines():
         maints_seen.append(maint)
 
 
+        if maint == "nomail":
+            lfile.write('Not resending, no mail is requested\n')
+            continue
+
+
         if maint == msg_from:
             lfile.write('Not resending, since maintainer = committer\n')
             continue