Fix Python lint and unit tests
One of the unit tests added in https://webrtc-codereview.appspot.com/50079004/ is failing on Windows since os.sep is a backslash on Windows. The code is based on the contents of the DEPS file rather than the filesystem, so the right thing is to use '/' instead of os.sep. The PyLint blacklist also didn't work on Windows, causing it to process a massive list of files during presubmit. I also added a bunch of new entries to speed up lint execution on all platforms. TESTED=Ran the presubmit with this CL on Windows and Linux. R=phoglund@webrtc.org Review URL: https://webrtc-codereview.appspot.com/52029004 Cr-Commit-Position: refs/heads/master@{#9353}
This commit is contained in:
40
PRESUBMIT.py
40
PRESUBMIT.py
@ -257,24 +257,30 @@ def _CommonChecks(input_api, output_api):
|
||||
black_list=(r'^.*gviz_api\.py$',
|
||||
r'^.*gaeunit\.py$',
|
||||
# Embedded shell-script fakes out pylint.
|
||||
r'^build/.*\.py$',
|
||||
r'^buildtools/.*\.py$',
|
||||
r'^chromium/.*\.py$',
|
||||
r'^out.*/.*\.py$',
|
||||
r'^testing/.*\.py$',
|
||||
r'^third_party/.*\.py$',
|
||||
r'^tools/clang/.*\.py$',
|
||||
r'^tools/gn/.*\.py$',
|
||||
r'^tools/gyp/.*\.py$',
|
||||
r'^tools/protoc_wrapper/.*\.py$',
|
||||
r'^tools/python/.*\.py$',
|
||||
r'^tools/python_charts/data/.*\.py$',
|
||||
r'^tools/refactoring/.*\.py$',
|
||||
r'^tools/swarming_client/.*\.py$',
|
||||
r'^build[\\\/].*\.py$',
|
||||
r'^buildtools[\\\/].*\.py$',
|
||||
r'^chromium[\\\/].*\.py$',
|
||||
r'^google_apis[\\\/].*\.py$',
|
||||
r'^net.*[\\\/].*\.py$',
|
||||
r'^out.*[\\\/].*\.py$',
|
||||
r'^testing[\\\/].*\.py$',
|
||||
r'^third_party[\\\/].*\.py$',
|
||||
r'^tools[\\\/]find_depot_tools.py$',
|
||||
r'^tools[\\\/]clang[\\\/].*\.py$',
|
||||
r'^tools[\\\/]generate_library_loader[\\\/].*\.py$',
|
||||
r'^tools[\\\/]gn[\\\/].*\.py$',
|
||||
r'^tools[\\\/]gyp[\\\/].*\.py$',
|
||||
r'^tools[\\\/]protoc_wrapper[\\\/].*\.py$',
|
||||
r'^tools[\\\/]python[\\\/].*\.py$',
|
||||
r'^tools[\\\/]python_charts[\\\/]data[\\\/].*\.py$',
|
||||
r'^tools[\\\/]refactoring[\\\/].*\.py$',
|
||||
r'^tools[\\\/]swarming_client[\\\/].*\.py$',
|
||||
r'^tools[\\\/]vim[\\\/].*\.py$',
|
||||
# TODO(phoglund): should arguably be checked.
|
||||
r'^tools/valgrind-webrtc/.*\.py$',
|
||||
r'^tools/valgrind/.*\.py$',
|
||||
r'^xcodebuild.*/.*\.py$',),
|
||||
r'^tools[\\\/]valgrind-webrtc[\\\/].*\.py$',
|
||||
r'^tools[\\\/]valgrind[\\\/].*\.py$',
|
||||
r'^tools[\\\/]win[\\\/].*\.py$',
|
||||
r'^xcodebuild.*[\\\/].*\.py$',),
|
||||
disabled_warnings=['F0401', # Failed to import x
|
||||
'E0611', # No package y in x
|
||||
'W0232', # Class has no __init__ method
|
||||
|
@ -182,9 +182,9 @@ def GetMatchingDepsEntries(depsentry_dict, dir_path):
|
||||
if path == dir_path:
|
||||
result.append(depsentry)
|
||||
else:
|
||||
parts = path.split(os.sep)
|
||||
parts = path.split('/')
|
||||
if all(part == parts[i]
|
||||
for i, part in enumerate(dir_path.split(os.sep))):
|
||||
for i, part in enumerate(dir_path.split('/'))):
|
||||
result.append(depsentry)
|
||||
return result
|
||||
|
||||
|
Reference in New Issue
Block a user