mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
tools: fix C++ import checker argument expansion
Makefile assumes that it can pass a list of files to the import checker, whereas the import checker expects a single argument that is interpreted as a blob. Fix that mismatch by accepting multiple arguments in the import checker. Refs: https://github.com/nodejs/node/pull/34565 PR-URL: https://github.com/nodejs/node/pull/34582 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
e97fe4b630
commit
af0cfeb1bb
|
|
@ -5,7 +5,7 @@ import glob
|
|||
import io
|
||||
import re
|
||||
import sys
|
||||
|
||||
import itertools
|
||||
|
||||
def do_exist(file_name, lines, imported):
|
||||
if not any(not re.match('using \w+::{0};'.format(imported), line) and
|
||||
|
|
@ -41,5 +41,10 @@ def is_valid(file_name):
|
|||
return valid
|
||||
|
||||
if __name__ == '__main__':
|
||||
files = glob.iglob(sys.argv[1] if len(sys.argv) > 1 else 'src/*.cc')
|
||||
sys.exit(0 if all(map(is_valid, files)) else 1)
|
||||
if len(sys.argv) > 1:
|
||||
files = []
|
||||
for pattern in sys.argv[1:]:
|
||||
files = itertools.chain(files, glob.iglob(pattern))
|
||||
else:
|
||||
files = glob.iglob('src/*.cc')
|
||||
sys.exit(0 if all(list(map(is_valid, files))) else 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user