From 26292805c3e624fd771ffb7bb61f73c9ac5ce422 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 3 Sep 2024 08:22:39 -0400 Subject: [PATCH] Prefer generator expression in VCRuntimeRedist --- setuptools/msvc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 4295c10352..51afb43857 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -1406,11 +1406,11 @@ def VCRuntimeRedist(self): ) # vcruntime path - for prefix, crt_dir in itertools.product(prefixes, crt_dirs): - path = join(prefix, arch_subdir, crt_dir, vcruntime) - if isfile(path): - return path - return None + candidate_paths = ( + join(prefix, arch_subdir, crt_dir, vcruntime) + for (prefix, crt_dir) in itertools.product(prefixes, crt_dirs) + ) + return next(filter(isfile, candidate_paths), None) def return_env(self, exists=True): """