Fix check_package_boundaries presubmit test for Windows.

BUG=webrtc:6954
NOTRY=True

Review-Url: https://codereview.webrtc.org/2695573003
Cr-Commit-Position: refs/heads/master@{#16581}
This commit is contained in:
ehmaldonado
2017-02-13 05:18:02 -08:00
committed by Commit bot
parent 806a1a0c28
commit f6ddbe77cb
2 changed files with 4 additions and 3 deletions

View File

@ -54,11 +54,11 @@ class Logger(object):
def _BuildSubpackagesPattern(packages, query): def _BuildSubpackagesPattern(packages, query):
"""Returns a regular expression that matches source files inside subpackages """Returns a regular expression that matches source files inside subpackages
of the given query.""" of the given query."""
query += '/' query += os.path.sep
length = len(query) length = len(query)
pattern = r'(?P<line_number>\d+)\$\s*"(?P<source_file>(?P<subpackage>' pattern = r'(?P<line_number>\d+)\$\s*"(?P<source_file>(?P<subpackage>'
pattern += '|'.join(package[length:] for package in packages pattern += '|'.join(package[length:].replace(os.path.sep, '/')
if package.startswith(query)) for package in packages if package.startswith(query))
pattern += r')/[\w\./]*)"' pattern += r')/[\w\./]*)"'
return re.compile(pattern) return re.compile(pattern)

View File

@ -33,6 +33,7 @@ class Logger(object):
def log(self, build_file_path, line_number, target_name, source_file, def log(self, build_file_path, line_number, target_name, source_file,
subpackage): subpackage):
build_file_path = os.path.relpath(build_file_path, self.test_dir) build_file_path = os.path.relpath(build_file_path, self.test_dir)
build_file_path = build_file_path.replace(os.path.sep, '/')
self.messages.append([build_file_path, line_number, target_name, self.messages.append([build_file_path, line_number, target_name,
source_file, subpackage]) source_file, subpackage])