Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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: #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>
  • 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
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.