subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1717919 - /subversion/trunk/tools/dist/security/mailinglist.py
Date Fri, 04 Dec 2015 10:00:12 GMT
Author: brane
Date: Fri Dec  4 10:00:12 2015
New Revision: 1717919

URL: http://svn.apache.org/viewvc?rev=1717919&view=rev
Log:
Add parser for the advisory mail recipients.

* tools/dist/security/mailinglist.py: New.

Added:
    subversion/trunk/tools/dist/security/mailinglist.py   (with props)

Added: subversion/trunk/tools/dist/security/mailinglist.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/security/mailinglist.py?rev=1717919&view=auto
==============================================================================
--- subversion/trunk/tools/dist/security/mailinglist.py (added)
+++ subversion/trunk/tools/dist/security/mailinglist.py Fri Dec  4 10:00:12 2015
@@ -0,0 +1,58 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+"""
+Parser for advisory e-mail distribution addresses
+"""
+
+from __future__ import absolute_import
+
+
+import os
+import re
+
+
+class MailingList(object):
+    """
+    A list of e-mail addresses for security advisory pre-notifications.
+    Parses ^/pmc/subversion/security/pre-notifications.txt
+    """
+
+    __PRE_NOTIFICATIONS = 'pre-notifications.txt'
+    __ADDRESS_LINE = re.compile(r'^\s{6}(?:[^<]+)?<[^<>]+>\s*$')
+
+    def __init__(self, rootdir):
+        self.__addresses = []
+        self.__parse_addresses(rootdir)
+
+    def __iter__(self):
+        return self.__addresses.__iter__()
+
+    def __len__(self):
+        return len(self.__addresses)
+
+    def __parse_addresses(self, rootdir):
+        pre_notifications = os.path.join(rootdir, self.__PRE_NOTIFICATIONS)
+        with open(pre_notifications, 'rt') as pn:
+            for line in pn:
+                m = self.__ADDRESS_LINE.match(line)
+                if not m:
+                    continue
+
+                self.__addresses.append(line.strip())

Propchange: subversion/trunk/tools/dist/security/mailinglist.py
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message