mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04: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:
1 parent
bfebfdb149
commit
318c982f3b
1 file changed
+8
-3
@@ -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)
|
||||
Reference in new issue
Block a user