media/webrtc/trunk/tools/gyp/PRESUBMIT.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # Copyright (c) 2012 Google Inc. All rights reserved.
michael@0 2 # Use of this source code is governed by a BSD-style license that can be
michael@0 3 # found in the LICENSE file.
michael@0 4
michael@0 5
michael@0 6 """Top-level presubmit script for GYP.
michael@0 7
michael@0 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
michael@0 9 for more details about the presubmit API built into gcl.
michael@0 10 """
michael@0 11
michael@0 12
michael@0 13 PYLINT_BLACKLIST = [
michael@0 14 # TODO: fix me.
michael@0 15 # From SCons, not done in google style.
michael@0 16 'test/lib/TestCmd.py',
michael@0 17 'test/lib/TestCommon.py',
michael@0 18 'test/lib/TestGyp.py',
michael@0 19 # Needs style fix.
michael@0 20 'pylib/gyp/generator/scons.py',
michael@0 21 'pylib/gyp/generator/xcode.py',
michael@0 22 ]
michael@0 23
michael@0 24
michael@0 25 PYLINT_DISABLED_WARNINGS = [
michael@0 26 # TODO: fix me.
michael@0 27 # Many tests include modules they don't use.
michael@0 28 'W0611',
michael@0 29 # Include order doesn't properly include local files?
michael@0 30 'F0401',
michael@0 31 # Some use of built-in names.
michael@0 32 'W0622',
michael@0 33 # Some unused variables.
michael@0 34 'W0612',
michael@0 35 # Operator not preceded/followed by space.
michael@0 36 'C0323',
michael@0 37 'C0322',
michael@0 38 # Unnecessary semicolon.
michael@0 39 'W0301',
michael@0 40 # Unused argument.
michael@0 41 'W0613',
michael@0 42 # String has no effect (docstring in wrong place).
michael@0 43 'W0105',
michael@0 44 # Comma not followed by space.
michael@0 45 'C0324',
michael@0 46 # Access to a protected member.
michael@0 47 'W0212',
michael@0 48 # Bad indent.
michael@0 49 'W0311',
michael@0 50 # Line too long.
michael@0 51 'C0301',
michael@0 52 # Undefined variable.
michael@0 53 'E0602',
michael@0 54 # Not exception type specified.
michael@0 55 'W0702',
michael@0 56 # No member of that name.
michael@0 57 'E1101',
michael@0 58 # Dangerous default {}.
michael@0 59 'W0102',
michael@0 60 # Others, too many to sort.
michael@0 61 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231',
michael@0 62 'R0201', 'E0101', 'C0321',
michael@0 63 # ************* Module copy
michael@0 64 # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect
michael@0 65 'W0104',
michael@0 66 ]
michael@0 67
michael@0 68
michael@0 69 def CheckChangeOnUpload(input_api, output_api):
michael@0 70 report = []
michael@0 71 report.extend(input_api.canned_checks.PanProjectChecks(
michael@0 72 input_api, output_api))
michael@0 73 return report
michael@0 74
michael@0 75
michael@0 76 def CheckChangeOnCommit(input_api, output_api):
michael@0 77 report = []
michael@0 78 license = (
michael@0 79 r'.*? Copyright \(c\) %(year)s Google Inc\. All rights reserved\.\n'
michael@0 80 r'.*? Use of this source code is governed by a BSD-style license that '
michael@0 81 r'can be\n'
michael@0 82 r'.*? found in the LICENSE file\.\n'
michael@0 83 ) % {
michael@0 84 'year': input_api.time.strftime('%Y'),
michael@0 85 }
michael@0 86
michael@0 87 report.extend(input_api.canned_checks.PanProjectChecks(
michael@0 88 input_api, output_api, license_header=license))
michael@0 89 report.extend(input_api.canned_checks.CheckTreeIsOpen(
michael@0 90 input_api, output_api,
michael@0 91 'http://gyp-status.appspot.com/status',
michael@0 92 'http://gyp-status.appspot.com/current'))
michael@0 93
michael@0 94 import sys
michael@0 95 old_sys_path = sys.path
michael@0 96 try:
michael@0 97 sys.path = ['pylib', 'test/lib'] + sys.path
michael@0 98 report.extend(input_api.canned_checks.RunPylint(
michael@0 99 input_api,
michael@0 100 output_api,
michael@0 101 black_list=PYLINT_BLACKLIST,
michael@0 102 disabled_warnings=PYLINT_DISABLED_WARNINGS))
michael@0 103 finally:
michael@0 104 sys.path = old_sys_path
michael@0 105 return report
michael@0 106
michael@0 107
michael@0 108 def GetPreferredTrySlaves():
michael@0 109 return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac']

mercurial