| OLD | NEW |
| (Empty) |
| 1 # coding=utf8 | |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 """Ignores issues not using the right project base url regex.""" | |
| 6 | |
| 7 import logging | |
| 8 import os | |
| 9 import re | |
| 10 | |
| 11 import find_depot_tools # pylint: disable=W0611 | |
| 12 import breakpad | |
| 13 | |
| 14 from verification import base | |
| 15 | |
| 16 | |
| 17 class ProjectBaseUrlVerifier(base.Verifier): | |
| 18 """Needs the project base url to match at least one regexp in self.regex.""" | |
| 19 name = 'project_bases' | |
| 20 | |
| 21 def __init__(self, project_bases): | |
| 22 super(ProjectBaseUrlVerifier, self).__init__() | |
| 23 self.project_bases = project_bases | |
| 24 | |
| 25 def verify(self, pending): | |
| 26 matches = filter( | |
| 27 None, (re.match(r, pending.base_url) for r in self.project_bases)) | |
| 28 if not matches: | |
| 29 logging.info('%s not in whitelist' % pending.base_url) | |
| 30 state = base.IGNORED | |
| 31 else: | |
| 32 if len(matches) != 1: | |
| 33 breakpad.SendStack( | |
| 34 Exception('pending.base_url triggered multiple matches'), '') | |
| 35 match = matches[0] | |
| 36 if match.lastindex: | |
| 37 pending.relpath = match.group(match.lastindex).lstrip('/').replace( | |
| 38 '/', os.sep) | |
| 39 state = base.SUCCEEDED | |
| 40 pending.verifications[self.name] = base.SimpleStatus(state) | |
| 41 | |
| 42 def update_status(self, queue): | |
| 43 pass | |
| OLD | NEW |