Skip to content

Commit

Permalink
build: pass a tuple of alternatives to str.endswith()
Browse files Browse the repository at this point in the history
https://docs.python.org/3/library/stdtypes.html#str.endswith

One function call should be faster than three function calls per file.

PR-URL: #40017
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Shingo Inoue <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
  • Loading branch information
cclauss authored and targos committed Oct 4, 2021
1 parent d36127d commit a1bee94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
for ent in files:
(path, dirs, files) = ent
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 = '%s/%s' % (dir_sub, file)
if patch_dir:
Expand Down

0 comments on commit a1bee94

Please sign in to comment.