Merge "Run regex match over jobs in memory"
This commit is contained in:
commit
c03fb66894
@ -92,9 +92,11 @@ def check_formatting():
|
|||||||
return errors
|
return errors
|
||||||
|
|
||||||
def grep(source, pattern):
|
def grep(source, pattern):
|
||||||
|
"""Run regex PATTERN over each line in SOURCE and return
|
||||||
|
True if any match found"""
|
||||||
found = False
|
found = False
|
||||||
p = re.compile(pattern)
|
p = re.compile(pattern)
|
||||||
for line in open(source, "r").readlines():
|
for line in source:
|
||||||
if p.match(line):
|
if p.match(line):
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
@ -111,11 +113,15 @@ def check_jobs():
|
|||||||
# The job-list.txt file is created by tools/run-layout.sh and
|
# The job-list.txt file is created by tools/run-layout.sh and
|
||||||
# thus should exist if this is run from tox. If this is manually invoked
|
# thus should exist if this is run from tox. If this is manually invoked
|
||||||
# the file might not exist, in that case pass the test.
|
# the file might not exist, in that case pass the test.
|
||||||
job_list = ".test/job-list.txt"
|
job_list_file = ".test/job-list.txt"
|
||||||
if not os.path.isfile(job_list):
|
if not os.path.isfile(job_list_file):
|
||||||
print("Job list file %s does not exist, not checking jobs section"
|
print("Job list file %s does not exist, not checking jobs section"
|
||||||
% job_list)
|
% job_list_file)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
with open(job_list_file, 'r') as f:
|
||||||
|
job_list = [line.rstrip() for line in f]
|
||||||
|
|
||||||
for jobs in layout['jobs']:
|
for jobs in layout['jobs']:
|
||||||
found = grep(job_list, jobs['name'])
|
found = grep(job_list, jobs['name'])
|
||||||
if not found:
|
if not found:
|
||||||
|
Loading…
Reference in New Issue
Block a user