⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 email_maintainers.py

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 PY
📖 第 1 页 / 共 2 页
字号:
            time.sleep (30)        return False            # Parses the file $BOOST_ROOT/libs/maintainers.txt to create a hash    # mapping from the library name to the list of maintainers.    def parseLibraryMaintainersFile(self):        """        Parse the maintainers file in ../../../libs/maintainers.txt to        collect information about the maintainers of broken libraries.        """        lib_maintainer_regex = re.compile('(\S+)\s*(.*)')        name_email_regex = re.compile('\s*(\w*(\s*\w+)+)\s*<\s*(\S*(\s*\S+)+)\S*>')        at_regex = re.compile('\s*-\s*at\s*-\s*')        for line in file('../../../libs/maintainers.txt', 'r'):            m = lib_maintainer_regex.match (line)            if m:                libname = m.group(1)                if self.libraries.has_key(m.group(1)):                    library = self.libraries[m.group(1)]                    for person in re.split('\s*,\s*', m.group(2)):                        nmm = name_email_regex.match(person)                        if nmm:                            name = nmm.group(1)                            email = nmm.group(3)                            email = at_regex.sub('@', email)                            maintainer = self.getMaintainer(name, email)                            maintainer.addLibrary(library)                            library.addMaintainer(maintainer)                            pass                        pass                    pass                pass            pass        pass    def numFailures(self):        count = 0        for library in self.libraries:            count += self.libraries[library].numFailures()            pass        return count    def numReportableFailures(self):        count = 0        for library in self.libraries:            count += self.libraries[library].numReportableFailures()            pass        return count    def composeSummaryEmail(self):        """        Compose a message to send to the Boost developer's        list. Return the message and return it.        """        message = """From: Douglas Gregor <dgregor@osl.iu.edu>To: boost@lists.boost.orgReply-To: boost@lists.boost.orgSubject: [Report] """        message += str(self.numFailures()) + " failures on " + branch        message += " (" + str(datetime.date.today()) + ")"        message += """Boost regression test failures"""        message += "Report time: " + self.date + """This report lists all regression test failures on release platforms.Detailed report:"""        message += '  ' + self.url + '\n\n'        if self.numFailures() == 0:            message += "No failures! Yay!\n"            return message                    # List the platforms that are broken        any_broken_platforms = self.numReportableFailures() < self.numFailures()        if any_broken_platforms:            message += """The following platforms have a large number of failures:"""            for platform in sorted_keys( self.platforms ):                if self.platforms[platform].isBroken():                    message += '  ' + platform + '\n'            message += '\n'           # Display the number of failures        message += (str(self.numFailures()) + ' failures in ' +                     str(len(self.libraries)) + ' libraries')        if any_broken_platforms:            message += ' (' + str(self.numReportableFailures()) + ' are from non-broken platforms)'        message += '\n'        # Display the number of failures per library        for k in sorted_keys( self.libraries ):            library = self.libraries[k]            num_failures = library.numFailures()            message += ('  ' + library.name + ' ('                         + str(library.numReportableFailures()))            if library.numReportableFailures() < num_failures:                message += (' of ' + str(num_failures)                             + ' failures are from non-broken platforms')            message += ')\n'            pass        # If we have any broken platforms, tell the user how we're        # displaying them.        if any_broken_platforms:            message += """Test failures marked with a (*) represent tests that failed onplatforms that are considered broken. They are likely caused bymisconfiguration by the regression tester or a failure in a corelibrary such as Test or Config."""        message += '\n'        # Provide the details for the failures in each library.        for k in sorted_keys( self.libraries ):            library = self.libraries[k]            message += '\n|' + library.name + '|\n'            for test in library.tests:                message += '  ' + test.name + ':'                for failure in test.failures:                    platform = failure.platform                    message += '  ' + platform.name                    if platform.isBroken():                        message += '*'                    pass                message += '\n'                pass            pass        return message# Send a message to "person" (a maintainer of a library that is# failing).# maintainers is the result of get_library_maintainers()def send_individualized_message (branch, person, maintainers):  # There are several states we could be in:  #   0 Initial state. Eat everything up to the "NNN failures in MMM  #     libraries" line  #   1 Suppress output within this library  #   2 Forward output within this library  state = 0   failures_in_lib_regex = re.compile('\d+ failur.*\d+ librar')  lib_failures_regex = re.compile('  (\S+) \((\d+)\)')  lib_start_regex = re.compile('\|(\S+)\|')  general_pass_regex = re.compile('  http://')  for line in file('issues-email.txt', 'r'):    if state == 0:        lfm = lib_failures_regex.match(line)        if lfm:            # Pass the line through if the current person is a            # maintainer of this library            if lfm.group(1) in maintainers and person in maintainers[lfm.group(1)]:                message += line                print line,                        elif failures_in_lib_regex.match(line):            message += "\nThere are failures in these libraries you maintain:\n"        elif general_pass_regex.match(line):            message += line                lib_start = lib_start_regex.match(line)    if lib_start:        if state == 0:            message += '\n'                    if lib_start.group(1) in maintainers and person in maintainers[lib_start.group(1)]:            message += line            state = 2        else:            state = 1    else:        if state == 1:            pass        elif state == 2:            message += line  if '--debug' in sys.argv:      print '-----------------Message text----------------'      print message  else:      print        if '--send' in sys.argv:      print "Sending..."      smtp = smtplib.SMTP('milliways.osl.iu.edu')      smtp.sendmail(from_addr = 'Douglas Gregor <dgregor@osl.iu.edu>',                    to_addrs = person[1],                    msg = message)      print "Done."# Send a message to the developer's listdef send_boost_developers_message(branch, maintainers, failing_libraries):  to_line = 'boost@lists.boost.org'  from_line = 'Douglas Gregor <dgregor@osl.iu.edu>'  message = """From: Douglas Gregor <dgregor@osl.iu.edu>To: boost@lists.boost.orgReply-To: boost@lists.boost.orgSubject: Boost regression testing notification ("""  message += str(datetime.date.today()) + " [" + branch + "]"  message += ")"  message += """"""  for line in file('issues-email.txt', 'r'):      # Right before the detailed report, put out a warning message if      # any libraries with failures to not have maintainers listed.      if line.startswith('Detailed report:'):          missing_maintainers = False          for lib in failing_libraries:              if not(lib in maintainers) or maintainers[lib] == list():                  missing_maintainers = True          if missing_maintainers:              message += """WARNING: The following libraries have failing regression tests but donot have a maintainer on file. Once a maintainer is found, add anentry to libs/maintainers.txt to eliminate this message."""              for lib in failing_libraries:                  if not(lib in maintainers) or maintainers[lib] == list():                      message += '  ' + lib + '\n'              message += '\n'                    message += line        if '--send' in sys.argv:      print 'Sending notification email...'      smtp = smtplib.SMTP('milliways.osl.iu.edu')      smtp.sendmail(from_addr = from_line, to_addrs = to_line, msg = message)      print 'Done.'  if '--debug' in sys.argv:      print "----------Boost developer's message text----------"      print message################################################################################ Main program                                                                ################################################################################# Parse command-line optionsbranch = "trunk"for arg in sys.argv:    if arg.startswith("--branch="):        branch = arg[len("--branch="):]report = Report(branch)# Try to parse the issues e-mailif '--no-get' in sys.argv:    okay = report.parseIssuesEmail()else:    okay = report.getIssuesEmail()if not okay:    print 'Aborting.'    if '--send' in sys.argv:        message = """From: Douglas Gregor <dgregor@osl.iu.edu>        To: Douglas Gregor <dgregor@osl.iu.edu>        Reply-To: boost@lists.boost.org        Subject: Regression status script failed on """        message += str(datetime.date.today()) + " [" + branch + "]"        smtp = smtplib.SMTP('milliways.osl.iu.edu')        smtp.sendmail(from_addr = 'Douglas Gregor <dgregor@osl.iu.edu>',                      to_addrs = 'dgregor@osl.iu.edu',                      msg = message)    sys.exit(1)# Try to parse maintainers informationreport.parseLibraryMaintainersFile()for maintainer_name in report.maintainers:    maintainer = report.maintainers[maintainer_name]    email = maintainer.composeEmail(report)    if email:        if '--send' in sys.argv:            print ('Sending notification email to ' + maintainer.name + '...')            smtp = smtplib.SMTP('milliways.osl.iu.edu')            smtp.sendmail(from_addr = report_author,                           to_addrs = maintainer.email,                          msg = email)            print 'done.\n'        else:            print 'Would send a notification e-mail to',maintainer.name        if '--debug' in sys.argv:            print ('Message text for ' + maintainer.name + ':\n')            print email            email = report.composeSummaryEmail()if '--send' in sys.argv:    print 'Sending summary email to Boost developer list...'    smtp = smtplib.SMTP('milliways.osl.iu.edu')    smtp.sendmail(from_addr = report_author,                   to_addrs = boost_dev_list,                  msg = email)    print 'done.\n'if '--debug' in sys.argv:    print 'Message text for summary:\n'    print emailif not ('--send' in sys.argv):    print 'Chickening out and not sending any e-mail.'    print 'Use --send to actually send e-mail, --debug to see e-mails.'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -