build: pass a tuple of alternatives to str.endswith()
https://docs.python.org/3/library/stdtypes.html#str.endswith One function call should be faster than three function calls per file. PR-URL: https://github.com/nodejs/node/pull/40017 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
0e561de643
commit
b25a73f26a
@ -1512,7 +1512,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
|
|||||||
for ent in files:
|
for ent in files:
|
||||||
(path, dirs, files) = ent
|
(path, dirs, files) = ent
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.endswith('.cpp') or file.endswith('.c') or file.endswith('.h'):
|
if file.endswith(('.cpp', '.c', '.h')):
|
||||||
# srcfile uses "slash" as dir separator as its output is consumed by gyp
|
# srcfile uses "slash" as dir separator as its output is consumed by gyp
|
||||||
srcfile = '%s/%s' % (dir_sub, file)
|
srcfile = '%s/%s' % (dir_sub, file)
|
||||||
if patch_dir:
|
if patch_dir:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user