@@ -708,25 +708,28 @@ def detect_visual_c_compiler_version(tools_env):
708
708
709
709
710
710
def find_visual_c_batch_file (env ):
711
- from SCons .Tool .MSCommon .vc import (
712
- get_default_version ,
713
- get_host_target ,
714
- find_batch_file ,
715
- )
711
+ from SCons .Tool .MSCommon .vc import get_default_version , get_host_target , find_batch_file , find_vc_pdir
716
712
717
713
# Syntax changed in SCons 4.4.0.
718
714
from SCons import __version__ as scons_raw_version
719
715
720
716
scons_ver = env ._get_major_minor_revision (scons_raw_version )
721
717
722
- version = get_default_version (env )
718
+ msvc_version = get_default_version (env )
723
719
724
720
if scons_ver >= (4 , 4 , 0 ):
725
- (host_platform , target_platform , _ ) = get_host_target (env , version )
721
+ (host_platform , target_platform , _ ) = get_host_target (env , msvc_version )
726
722
else :
727
723
(host_platform , target_platform , _ ) = get_host_target (env )
728
724
729
- return find_batch_file (env , version , host_platform , target_platform )[0 ]
725
+ if scons_ver < (4 , 6 , 0 ):
726
+ return find_batch_file (env , msvc_version , host_platform , target_platform )[0 ]
727
+
728
+ # Scons 4.6.0+ removed passing env, so we need to get the product_dir ourselves first,
729
+ # then pass that as the last param instead of env as the first param as before.
730
+ # We should investigate if we can avoid relying on SCons internals here.
731
+ product_dir = find_vc_pdir (env , msvc_version )
732
+ return find_batch_file (msvc_version , host_platform , target_platform , product_dir )[0 ]
730
733
731
734
732
735
def generate_cpp_hint_file (filename ):
0 commit comments