@@ -1375,14 +1375,11 @@ def FSharp(self):
1375
1375
return [self .si .FSharpInstallDir ]
1376
1376
1377
1377
@property
1378
- def VCRuntimeRedist (self ):
1378
+ def VCRuntimeRedist (self ) -> str | None :
1379
1379
"""
1380
1380
Microsoft Visual C++ runtime redistributable dll.
1381
1381
1382
- Return
1383
- ------
1384
- str
1385
- path
1382
+ Returns the first suitable path found or None.
1386
1383
"""
1387
1384
vcruntime = 'vcruntime%d0.dll' % self .vc_ver
1388
1385
arch_subdir = self .pi .target_dir (x64 = True ).strip ('\\ ' )
@@ -1406,11 +1403,11 @@ def VCRuntimeRedist(self):
1406
1403
)
1407
1404
1408
1405
# vcruntime path
1409
- for prefix , crt_dir in itertools . product ( prefixes , crt_dirs ):
1410
- path = join (prefix , arch_subdir , crt_dir , vcruntime )
1411
- if isfile ( path ):
1412
- return path
1413
- return None
1406
+ candidate_paths = (
1407
+ join (prefix , arch_subdir , crt_dir , vcruntime )
1408
+ for ( prefix , crt_dir ) in itertools . product ( prefixes , crt_dirs )
1409
+ )
1410
+ return next ( filter ( isfile , candidate_paths ), None )
1414
1411
1415
1412
def return_env (self , exists = True ):
1416
1413
"""
@@ -1469,7 +1466,7 @@ def return_env(self, exists=True):
1469
1466
exists ,
1470
1467
),
1471
1468
)
1472
- if self .vs_ver >= 14 and isfile ( self .VCRuntimeRedist ) :
1469
+ if self .vs_ver >= 14 and self .VCRuntimeRedist :
1473
1470
env ['py_vcruntime_redist' ] = self .VCRuntimeRedist
1474
1471
return env
1475
1472
0 commit comments