@@ -190,9 +190,8 @@ def get_msvc_version_numeric(msvc_version):
190190 return '' .join ([x for x in msvc_version if x in string_digits + '.' ])
191191
192192def get_host_target (env ):
193- debug ('called' )
194-
195193 host_platform = env .get ('HOST_ARCH' )
194+ debug ("HOST_ARCH:" + str (host_platform ))
196195 if not host_platform :
197196 host_platform = platform .machine ()
198197
@@ -205,8 +204,7 @@ def get_host_target(env):
205204
206205 # Retain user requested TARGET_ARCH
207206 req_target_platform = env .get ('TARGET_ARCH' )
208- debug ('req_target_platform:%s' % req_target_platform )
209-
207+ debug ("HOST_ARCH:" + str (req_target_platform ))
210208 if req_target_platform :
211209 # If user requested a specific platform then only try that one.
212210 target_platform = req_target_platform
@@ -308,12 +306,17 @@ def msvc_version_to_maj_min(msvc_version):
308306def is_host_target_supported (host_target , msvc_version ):
309307 """Check if (host, target) pair is supported for a VC version.
310308
311- :note: only checks whether a given version *may* support the given (host,
312- target), not that the toolchain is actually present on the machine.
313- :param tuple host_target: canonalized host-targets pair, e.g.
314- ("x86", "amd64") for cross compilation from 32 bit Windows to 64 bits.
315- :param str msvc_version: Visual C++ version (major.minor), e.g. "10.0"
316- :returns: True or False
309+ Only checks whether a given version *may* support the given
310+ (host, target) pair, not that the toolchain is actually on the machine.
311+
312+ Args:
313+ host_target: canonalized host-target pair, e.g.
314+ ("x86", "amd64") for cross compilation from 32- to 64-bit Windows.
315+ msvc_version: Visual C++ version (major.minor), e.g. "10.0"
316+
317+ Returns:
318+ True or False
319+
317320 """
318321 # We assume that any Visual Studio version supports x86 as a target
319322 if host_target [1 ] != "x86" :
@@ -330,9 +333,7 @@ def is_host_target_supported(host_target, msvc_version):
330333]]
331334
332335def msvc_find_vswhere ():
333- """
334- Find the location of vswhere
335- """
336+ """ Find the location of vswhere """
336337 # For bug 3333: support default location of vswhere for both
337338 # 64 and 32 bit windows installs.
338339 # For bug 3542: also accommodate not being on C: drive.
@@ -347,14 +348,19 @@ def msvc_find_vswhere():
347348 return vswhere_path
348349
349350def find_vc_pdir_vswhere (msvc_version , env = None ):
350- """
351- Find the MSVC product directory using the vswhere program.
351+ """ Find the MSVC product directory using the vswhere program.
352352
353- :param msvc_version: MSVC version to search for
354- :return: MSVC install dir or None
355- :raises UnsupportedVersion: if the version is not known by this file
356- """
353+ Args:
354+ msvc_version: MSVC version to search for
355+ env: optional to look up VSWHERE variable
357356
357+ Returns:
358+ MSVC install dir or None
359+
360+ Raises:
361+ UnsupportedVersion: if the version is not known by this file
362+
363+ """
358364 try :
359365 vswhere_version = _VCVER_TO_VSWHERE_VER [msvc_version ]
360366 except KeyError :
@@ -369,7 +375,7 @@ def find_vc_pdir_vswhere(msvc_version, env=None):
369375 if vswhere_path is None :
370376 return None
371377
372- debug ('VSWHERE = %s' % vswhere_path )
378+ debug ('VSWHERE: %s' % vswhere_path )
373379 vswhere_cmd = [
374380 vswhere_path ,
375381 "-products" , "*" ,
@@ -414,6 +420,7 @@ def find_vc_pdir(env, msvc_version):
414420 MissingConfiguration: found version but the directory is missing.
415421
416422 Both exceptions inherit from VisualCException.
423+
417424 """
418425 root = 'Software\\ '
419426 try :
@@ -467,7 +474,7 @@ def find_batch_file(env,msvc_version,host_arch,target_arch):
467474 pdir = find_vc_pdir (env , msvc_version )
468475 if pdir is None :
469476 raise NoVersionFound ("No version of Visual Studio found" )
470- debug ('find_batch_file() in {}' .format (pdir ))
477+ debug ('looking in {}' .format (pdir ))
471478
472479 # filter out e.g. "Exp" from the version name
473480 msvc_ver_numeric = get_msvc_version_numeric (msvc_version )
@@ -590,8 +597,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version):
590597 return True
591598
592599 elif 14 >= ver_num >= 8 :
593-
594- # Set default value to be -1 as "" which is the value for x86/x86
600+ # Set default value to be -1 as "", which is the value for x86/x86,
595601 # yields true when tested if not host_trgt_dir
596602 host_trgt_dir = _HOST_TARGET_TO_CL_DIR .get ((host_platform , target_platform ), None )
597603 if host_trgt_dir is None :
@@ -714,12 +720,9 @@ def script_env(script, args=None):
714720 return cache_data
715721
716722def get_default_version (env ):
717- debug ('called' )
718-
719723 msvc_version = env .get ('MSVC_VERSION' )
720724 msvs_version = env .get ('MSVS_VERSION' )
721-
722- debug ('msvc_version:%s msvs_version:%s' % (msvc_version ,msvs_version ))
725+ debug ('msvc_version:%s msvs_version:%s' % (msvc_version , msvs_version ))
723726
724727 if msvs_version and not msvc_version :
725728 SCons .Warnings .warn (
@@ -735,6 +738,7 @@ def get_default_version(env):
735738 "visual studio version, MSVS_VERSION is deprecated" \
736739 % (msvc_version , msvs_version ))
737740 return msvs_version
741+
738742 if not msvc_version :
739743 installed_vcs = cached_get_installed_vcs (env )
740744 debug ('installed_vcs:%s' % installed_vcs )
@@ -746,6 +750,8 @@ def get_default_version(env):
746750 return None
747751 msvc_version = installed_vcs [0 ]
748752 debug ('using default installed MSVC version %s' % repr (msvc_version ))
753+ else :
754+ debug ('using specified MSVC version %s' % repr (msvc_version ))
749755
750756 return msvc_version
751757
@@ -879,14 +885,12 @@ def msvc_find_valid_batch_script(env, version):
879885
880886def msvc_setup_env (env ):
881887 debug ('called' )
882-
883888 version = get_default_version (env )
884889 if version is None :
885890 warn_msg = "No version of Visual Studio compiler found - C/C++ " \
886891 "compilers most likely not set correctly"
887892 SCons .Warnings .warn (SCons .Warnings .VisualCMissingWarning , warn_msg )
888893 return None
889- debug ('using specified MSVC version %s' % repr (version ))
890894
891895 # XXX: we set-up both MSVS version for backward
892896 # compatibility with the msvs tool
0 commit comments