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:
Henrik Kjellander
2015-06-02 13:10:04 +02:00
parent 8f074183b1
commit 14771ac6bf
2 changed files with 25 additions and 19 deletions

View File

@ -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

View File

@ -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