def gather_icl_versions(conf, versions): """ Checks ICL compilers :param versions: list to modify :type versions: list """ version_pattern = re.compile("^...?.?\....?.?") try: all_versions = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++" ) except WindowsError: try: all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Intel\\Compilers\\C++") except WindowsError: return index = 0 while 1: try: version = Utils.winreg.EnumKey(all_versions, index) except WindowsError: break index = index + 1 if not version_pattern.match(version): continue targets = [] for target, arch in all_icl_platforms: try: if target == "intel64": targetDir = "EM64T_NATIVE" else: targetDir = target Utils.winreg.OpenKey(all_versions, version + "\\" + targetDir) icl_version = Utils.winreg.OpenKey(all_versions, version) path, type = Utils.winreg.QueryValueEx(icl_version, "ProductDir") batch_file = os.path.join(path, "bin", "iclvars.bat") if os.path.isfile(batch_file): try: targets.append((target, (arch, conf.get_msvc_version("intel", version, target, batch_file)))) except conf.errors.ConfigurationError: pass except WindowsError: pass for target, arch in all_icl_platforms: try: icl_version = Utils.winreg.OpenKey(all_versions, version + "\\" + target) path, type = Utils.winreg.QueryValueEx(icl_version, "ProductDir") batch_file = os.path.join(path, "bin", "iclvars.bat") if os.path.isfile(batch_file): try: targets.append((target, (arch, conf.get_msvc_version("intel", version, target, batch_file)))) except conf.errors.ConfigurationError: pass except WindowsError: continue major = version[0:2] versions.append(("intel " + major, targets))
def gather_icl_versions(conf, versions): """ Checks ICL compilers :param versions: list to modify :type versions: list """ version_pattern = re.compile('^...?.?\....?.?') try: all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++') except WindowsError: try: all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Intel\\Compilers\\C++') except WindowsError: return index = 0 while 1: try: version = _winreg.EnumKey(all_versions, index) except WindowsError: break index = index + 1 if not version_pattern.match(version): continue targets = [] for target,arch in all_icl_platforms: try: if target=='intel64': targetDir='EM64T_NATIVE' else: targetDir=target _winreg.OpenKey(all_versions,version+'\\'+targetDir) icl_version=_winreg.OpenKey(all_versions,version) path,type=_winreg.QueryValueEx(icl_version,'ProductDir') if os.path.isfile(os.path.join(path,'bin','iclvars.bat')): try: targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat'))))) except conf.errors.ConfigurationError: pass except WindowsError: pass for target,arch in all_icl_platforms: try: icl_version = _winreg.OpenKey(all_versions, version+'\\'+target) path,type = _winreg.QueryValueEx(icl_version,'ProductDir') if os.path.isfile(os.path.join(path, 'bin', 'iclvars.bat')): try: targets.append((target, (arch, conf.get_msvc_version('intel', version, target, os.path.join(path, 'bin', 'iclvars.bat'))))) except conf.errors.ConfigurationError: pass except WindowsError: continue major = version[0:2] versions.append(('intel ' + major, targets))
def gather_winphone_targets(conf,versions,version,vc_path,vsvars): targets=[] for target,realtarget in all_msvc_platforms[::-1]: try: targets.append((target,(realtarget,conf.get_msvc_version('winphone',version,target,vsvars)))) except conf.errors.ConfigurationError ,e: pass
def gather_wsdk_versions(conf,versions): version_pattern=re.compile('^v..?.?\...?.?') try: all_versions=Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows') except WindowsError: try: all_versions=Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows') except WindowsError: return index=0 while 1: try: version=Utils.winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue try: msvc_version=Utils.winreg.OpenKey(all_versions,version) path,type=Utils.winreg.QueryValueEx(msvc_version,'InstallationFolder') except WindowsError: continue if os.path.isfile(os.path.join(path,'bin','SetEnv.cmd')): targets=[] for target,arch in all_msvc_platforms: try: targets.append((target,(arch,conf.get_msvc_version('wsdk',version,'/'+target,os.path.join(path,'bin','SetEnv.cmd'))))) except conf.errors.ConfigurationError: pass versions.append(('wsdk '+version[1:],targets))
def gather_wince_targets(conf, versions, version, vc_path, vsvars, supported_platforms): #Looking for Win CE compilers! for device, platforms in supported_platforms: cetargets = [] for platform, compiler, include, lib in platforms: winCEpath = os.path.join(vc_path, 'ce') if not os.path.isdir(winCEpath): continue try: common_bindirs, _1, _2 = conf.get_msvc_version( 'msvc', version, 'x86', vsvars) except conf.errors.ConfigurationError: continue if os.path.isdir(os.path.join(winCEpath, 'lib', platform)): bindirs = [ os.path.join(winCEpath, 'bin', compiler), os.path.join(winCEpath, 'bin', 'x86_' + compiler) ] + common_bindirs incdirs = [ os.path.join(winCEpath, 'include'), os.path.join(winCEpath, 'atlmfc', 'include'), include ] libdirs = [ os.path.join(winCEpath, 'lib', platform), os.path.join(winCEpath, 'atlmfc', 'lib', platform), lib ] cetargets.append( (platform, (platform, (bindirs, incdirs, libdirs)))) if cetargets: versions.append((device + ' ' + version, cetargets))
def gather_wince_targets(conf, versions, version, vc_path, vsvars, supported_platforms): # Looking for Win CE compilers! for device, platforms in supported_platforms: cetargets = [] for platform, compiler, include, lib in platforms: winCEpath = os.path.join(vc_path, "ce") if not os.path.isdir(winCEpath): continue try: common_bindirs, _1, _2 = conf.get_msvc_version("msvc", version, "x86", vsvars) except conf.errors.ConfigurationError: continue if os.path.isdir(os.path.join(winCEpath, "lib", platform)): bindirs = [ os.path.join(winCEpath, "bin", compiler), os.path.join(winCEpath, "bin", "x86_" + compiler), ] + common_bindirs incdirs = [os.path.join(winCEpath, "include"), os.path.join(winCEpath, "atlmfc", "include"), include] libdirs = [ os.path.join(winCEpath, "lib", platform), os.path.join(winCEpath, "atlmfc", "lib", platform), lib, ] cetargets.append((platform, (platform, (bindirs, incdirs, libdirs)))) if cetargets: versions.append((device + " " + version, cetargets))
def gather_icl_versions(conf,versions): version_pattern=re.compile('^...?.?\....?.?') try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++') except WindowsError: try: all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Intel\\Compilers\\C++') except WindowsError: return index=0 while 1: try: version=_winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue targets=[] for target,arch in all_icl_platforms: try: if target=='intel64':targetDir='EM64T_NATIVE' else:targetDir=target _winreg.OpenKey(all_versions,version+'\\'+targetDir) icl_version=_winreg.OpenKey(all_versions,version) path,type=_winreg.QueryValueEx(icl_version,'ProductDir') if os.path.isfile(os.path.join(path,'bin','iclvars.bat')): try: targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat'))))) except conf.errors.ConfigurationError: pass except WindowsError: pass for target,arch in all_icl_platforms: try: icl_version=_winreg.OpenKey(all_versions,version+'\\'+target) path,type=_winreg.QueryValueEx(icl_version,'ProductDir') if os.path.isfile(os.path.join(path,'bin','iclvars.bat')): try: targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat'))))) except conf.errors.ConfigurationError: pass except WindowsError: continue major=version[0:2] versions.append(('intel '+major,targets))
def gather_msvc_targets(conf,versions,version,vc_path): targets=[] if os.path.isfile(os.path.join(vc_path,'vcvarsall.bat')): for target,realtarget in all_msvc_platforms[::-1]: try: targets.append((target,(realtarget,conf.get_msvc_version('msvc',version,target,os.path.join(vc_path,'vcvarsall.bat'))))) except conf.errors.ConfigurationError ,e: pass
def gather_msvc_targets(conf, versions, version, vc_path): # Looking for normal MSVC compilers! targets = [] if os.path.isfile(os.path.join(vc_path, "vcvarsall.bat")): for target, realtarget in all_msvc_platforms[::-1]: try: targets.append( ( target, ( realtarget, conf.get_msvc_version("msvc", version, target, os.path.join(vc_path, "vcvarsall.bat")), ), ) ) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(vc_path, "Common7", "Tools", "vsvars32.bat")): try: targets.append( ( "x86", ( "x86", conf.get_msvc_version( "msvc", version, "x86", os.path.join(vc_path, "Common7", "Tools", "vsvars32.bat") ), ), ) ) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(vc_path, "Bin", "vcvars32.bat")): try: targets.append( ( "x86", ("x86", conf.get_msvc_version("msvc", version, "", os.path.join(vc_path, "Bin", "vcvars32.bat"))), ) ) except conf.errors.ConfigurationError: pass if targets: versions.append(("msvc " + version, targets))
def gather_winphone_targets(conf, versions, version, vc_path, vsvars): #Looking for WinPhone compilers targets = [] for target,realtarget in all_msvc_platforms[::-1]: try: targets.append((target, (realtarget, conf.get_msvc_version('winphone', version, target, vsvars)))) except conf.errors.ConfigurationError as e: pass if targets: versions.append(('winphone '+ version, targets))
def gather_msvc_targets(conf,versions,version,vc_path): targets=[] if os.path.isfile(os.path.join(vc_path,'vcvarsall.bat')): for target,realtarget in all_msvc_platforms[::-1]: try: targets.append((target,(realtarget,conf.get_msvc_version('msvc',version,target,os.path.join(vc_path,'vcvarsall.bat'))))) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(vc_path,'Common7','Tools','vsvars32.bat')): try: targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'x86',os.path.join(vc_path,'Common7','Tools','vsvars32.bat'))))) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(vc_path,'Bin','vcvars32.bat')): try: targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'',os.path.join(vc_path,'Bin','vcvars32.bat'))))) except conf.errors.ConfigurationError: pass versions.append(('msvc '+version,targets))
def gather_intel_composer_versions(conf,versions): version_pattern=re.compile('^...?.?\...?.?.?') try: all_versions=Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Intel\\Suites') except WindowsError: try: all_versions=Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Intel\\Suites') except WindowsError: return index=0 while 1: try: version=Utils.winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue targets=[] for target,arch in all_icl_platforms: try: if target=='intel64':targetDir='EM64T_NATIVE' else:targetDir=target try: defaults=Utils.winreg.OpenKey(all_versions,version+'\\Defaults\\C++\\'+targetDir) except WindowsError: if targetDir=='EM64T_NATIVE': defaults=Utils.winreg.OpenKey(all_versions,version+'\\Defaults\\C++\\EM64T') else: raise WindowsError uid,type=Utils.winreg.QueryValueEx(defaults,'SubKey') Utils.winreg.OpenKey(all_versions,version+'\\'+uid+'\\C++\\'+targetDir) icl_version=Utils.winreg.OpenKey(all_versions,version+'\\'+uid+'\\C++') path,type=Utils.winreg.QueryValueEx(icl_version,'ProductDir') batch_file=os.path.join(path,'bin','iclvars.bat') if os.path.isfile(batch_file): try: targets.append((target,(arch,conf.get_msvc_version('intel',version,target,batch_file)))) except conf.errors.ConfigurationError as e: pass compilervars_warning_attr='_compilervars_warning_key' if version[0:2]=='13'and getattr(conf,compilervars_warning_attr,True): setattr(conf,compilervars_warning_attr,False) patch_url='http://software.intel.com/en-us/forums/topic/328487' compilervars_arch=os.path.join(path,'bin','compilervars_arch.bat') for vscomntool in('VS110COMNTOOLS','VS100COMNTOOLS'): if vscomntool in os.environ: vs_express_path=os.environ[vscomntool]+r'..\IDE\VSWinExpress.exe' dev_env_path=os.environ[vscomntool]+r'..\IDE\devenv.exe' if(r'if exist "%VS110COMNTOOLS%..\IDE\VSWinExpress.exe"'in Utils.readf(compilervars_arch)and not os.path.exists(vs_express_path)and not os.path.exists(dev_env_path)): Logs.warn(('The Intel compilervar_arch.bat only checks for one Visual Studio SKU ''(VSWinExpress.exe) but it does not seem to be installed at %r. ''The intel command line set up will fail to configure unless the file %r''is patched. See: %s')%(vs_express_path,compilervars_arch,patch_url)) except WindowsError: pass major=version[0:2] versions.append(('intel '+major,targets))
def gather_msvc_targets(conf, versions, version, vc_path): targets = [] if os.path.isfile(os.path.join(vc_path, 'vcvarsall.bat')): for target, realtarget in all_msvc_platforms[::-1]: try: targets.append( (target, (realtarget, conf.get_msvc_version( 'msvc', version, target, os.path.join(vc_path, 'vcvarsall.bat'))))) except conf.errors.ConfigurationError, e: pass
def gather_intel_composer_versions(conf,versions): version_pattern=re.compile('^...?.?\...?.?.?') try: all_versions=Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Intel\\Suites') except WindowsError: try: all_versions=Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Intel\\Suites') except WindowsError: return index=0 while 1: try: version=Utils.winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue targets=[] for target,arch in all_icl_platforms: try: if target=='intel64':targetDir='EM64T_NATIVE' else:targetDir=target try: defaults=Utils.winreg.OpenKey(all_versions,version+'\\Defaults\\C++\\'+targetDir) except WindowsError: if targetDir=='EM64T_NATIVE': defaults=Utils.winreg.OpenKey(all_versions,version+'\\Defaults\\C++\\EM64T') else: raise WindowsError uid,type=Utils.winreg.QueryValueEx(defaults,'SubKey') Utils.winreg.OpenKey(all_versions,version+'\\'+uid+'\\C++\\'+targetDir) icl_version=Utils.winreg.OpenKey(all_versions,version+'\\'+uid+'\\C++') path,type=Utils.winreg.QueryValueEx(icl_version,'ProductDir') batch_file=os.path.join(path,'bin','iclvars.bat') if os.path.isfile(batch_file): try: targets.append((target,(arch,conf.get_msvc_version('intel',version,target,batch_file)))) except conf.errors.ConfigurationError ,e: pass compilervars_warning_attr='_compilervars_warning_key' if version[0:2]=='13'and getattr(conf,compilervars_warning_attr,True): setattr(conf,compilervars_warning_attr,False) patch_url='http://software.intel.com/en-us/forums/topic/328487' compilervars_arch=os.path.join(path,'bin','compilervars_arch.bat') for vscomntool in('VS110COMNTOOLS','VS100COMNTOOLS'): if vscomntool in os.environ: vs_express_path=os.environ[vscomntool]+r'..\IDE\VSWinExpress.exe' dev_env_path=os.environ[vscomntool]+r'..\IDE\devenv.exe' if(r'if exist "%VS110COMNTOOLS%..\IDE\VSWinExpress.exe"'in Utils.readf(compilervars_arch)and not os.path.exists(vs_express_path)and not os.path.exists(dev_env_path)): Logs.warn(('The Intel compilervar_arch.bat only checks for one Visual Studio SKU ''(VSWinExpress.exe) but it does not seem to be installed at %r. ''The intel command line set up will fail to configure unless the file %r''is patched. See: %s')%(vs_express_path,compilervars_arch,patch_url)) except WindowsError: pass
def gather_winphone_targets(conf, versions, version, vc_path, vsvars): #Looking for WinPhone compilers targets = [] for target, realtarget in all_msvc_platforms[::-1]: try: targets.append( (target, (realtarget, conf.get_msvc_version('winphone', version, target, vsvars)))) except conf.errors.ConfigurationError as e: pass if targets: versions.append(('winphone ' + version, targets))
def gather_wsdk_versions(conf, versions): """ Use winreg to add the msvc versions to the input list :param versions: list to modify :type versions: list """ version_pattern = re.compile("^v..?.?\...?.?") try: all_versions = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows" ) except WindowsError: try: all_versions = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows" ) except WindowsError: return index = 0 while 1: try: version = Utils.winreg.EnumKey(all_versions, index) except WindowsError: break index = index + 1 if not version_pattern.match(version): continue try: msvc_version = Utils.winreg.OpenKey(all_versions, version) path, type = Utils.winreg.QueryValueEx(msvc_version, "InstallationFolder") except WindowsError: continue if os.path.isfile(os.path.join(path, "bin", "SetEnv.cmd")): targets = [] for target, arch in all_msvc_platforms: try: targets.append( ( target, ( arch, conf.get_msvc_version( "wsdk", version, "/" + target, os.path.join(path, "bin", "SetEnv.cmd") ), ), ) ) except conf.errors.ConfigurationError: pass versions.append(("wsdk " + version[1:], targets))
def gather_msvc_2017_targets(conf, versions, version, windows_kit, vc_path): #Looking for normal MSVC compilers! targets = [] vcvarsall_bat = os.path.join(vc_path, 'VC', 'Auxiliary', 'Build', 'vcvarsall.bat') if os.path.isfile(vcvarsall_bat): try: targets.append( ('x64', ('x64', conf.get_msvc_version('msvc', version, 'x64', windows_kit, vcvarsall_bat)))) except conf.errors.ConfigurationError: pass if targets: versions.append(('msvc ' + version, targets))
def gather_wince_targets(conf,versions,version,vc_path,vsvars,supported_platforms): for device,platforms in supported_platforms: cetargets=[] for platform,compiler,include,lib in platforms: winCEpath=os.path.join(vc_path,'ce') if not os.path.isdir(winCEpath): continue try: common_bindirs,_1,_2=conf.get_msvc_version('msvc',version,'x86',vsvars) except conf.errors.ConfigurationError: continue if os.path.isdir(os.path.join(winCEpath,'lib',platform)): bindirs=[os.path.join(winCEpath,'bin',compiler),os.path.join(winCEpath,'bin','x86_'+compiler)]+common_bindirs incdirs=[os.path.join(winCEpath,'include'),os.path.join(winCEpath,'atlmfc','include'),include] libdirs=[os.path.join(winCEpath,'lib',platform),os.path.join(winCEpath,'atlmfc','lib',platform),lib] cetargets.append((platform,(platform,(bindirs,incdirs,libdirs)))) if cetargets: versions.append((device+' '+version,cetargets))
def gather_msvc_2017_targets(conf, paths_hash, versions, version, windows_kit, vc_path): # Attempt to restore the versions from a cache environment if possible if restore_vs_version_from_cached_path(conf, version, windows_kit, paths_hash, versions): return # Looking for normal MSVC compilers! targets = [] vcvarsall_bat = os.path.join(vc_path, 'VC', 'Auxiliary', 'Build', 'vcvarsall.bat') if os.path.isfile(vcvarsall_bat): try: targets.append(('x64', ('x64', conf.get_msvc_version('msvc', version, 'x64', windows_kit, vcvarsall_bat)))) except conf.errors.ConfigurationError: pass if targets: versions.append(('msvc {}/{}'.format(version, windows_kit), targets)) # Cache the versions tuples for the current vs version and environment so we can cut the cost of conf.get_msvc_version store_vs_version_to_cache(conf, version, windows_kit, paths_hash, versions)
def gather_intel_composer_versions(conf, versions): """ Checks ICL compilers that are part of Intel Composer Suites :param versions: list to modify :type versions: list """ version_pattern = re.compile("^...?.?\...?.?.?") try: all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432node\\Intel\\Suites") except WindowsError: try: all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Intel\\Suites") except WindowsError: return index = 0 while 1: try: version = Utils.winreg.EnumKey(all_versions, index) except WindowsError: break index = index + 1 if not version_pattern.match(version): continue targets = [] for target, arch in all_icl_platforms: try: if target == "intel64": targetDir = "EM64T_NATIVE" else: targetDir = target try: defaults = Utils.winreg.OpenKey(all_versions, version + "\\Defaults\\C++\\" + targetDir) except WindowsError: if targetDir == "EM64T_NATIVE": defaults = Utils.winreg.OpenKey(all_versions, version + "\\Defaults\\C++\\EM64T") else: raise WindowsError uid, type = Utils.winreg.QueryValueEx(defaults, "SubKey") Utils.winreg.OpenKey(all_versions, version + "\\" + uid + "\\C++\\" + targetDir) icl_version = Utils.winreg.OpenKey(all_versions, version + "\\" + uid + "\\C++") path, type = Utils.winreg.QueryValueEx(icl_version, "ProductDir") batch_file = os.path.join(path, "bin", "iclvars.bat") if os.path.isfile(batch_file): try: targets.append((target, (arch, conf.get_msvc_version("intel", version, target, batch_file)))) except conf.errors.ConfigurationError as e: pass # The intel compilervar_arch.bat is broken when used with Visual Studio Express 2012 # http://software.intel.com/en-us/forums/topic/328487 compilervars_warning_attr = "_compilervars_warning_key" if version[0:2] == "13" and getattr(conf, compilervars_warning_attr, True): setattr(conf, compilervars_warning_attr, False) patch_url = "http://software.intel.com/en-us/forums/topic/328487" compilervars_arch = os.path.join(path, "bin", "compilervars_arch.bat") for vscomntool in ("VS110COMNTOOLS", "VS100COMNTOOLS"): if vscomntool in os.environ: vs_express_path = os.environ[vscomntool] + r"..\IDE\VSWinExpress.exe" dev_env_path = os.environ[vscomntool] + r"..\IDE\devenv.exe" if ( r'if exist "%VS110COMNTOOLS%..\IDE\VSWinExpress.exe"' in Utils.readf(compilervars_arch) and not os.path.exists(vs_express_path) and not os.path.exists(dev_env_path) ): Logs.warn( ( "The Intel compilervar_arch.bat only checks for one Visual Studio SKU " "(VSWinExpress.exe) but it does not seem to be installed at %r. " "The intel command line set up will fail to configure unless the file %r" "is patched. See: %s" ) % (vs_express_path, compilervars_arch, patch_url) ) except WindowsError: pass major = version[0:2] versions.append(("intel " + major, targets))
def gather_msvc_versions(conf, versions): """ Checks SmartPhones SDKs :param versions: list to modify :type versions: list """ try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs") except WindowsError: try: ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs") except WindowsError: ce_sdk = "" if ce_sdk: supported_wince_platforms = [] ce_index = 0 while 1: try: sdk_device = _winreg.EnumKey(ce_sdk, ce_index) except WindowsError: break ce_index = ce_index + 1 sdk = _winreg.OpenKey(ce_sdk, sdk_device) path, type = _winreg.QueryValueEx(sdk, "SDKRootDir") path = str(path) path, device = os.path.split(path) if not device: path, device = os.path.split(path) for arch, compiler in all_wince_platforms: platforms = [] if os.path.isdir(os.path.join(path, device, "Lib", arch)): platforms.append( ( arch, compiler, os.path.join(path, device, "Include", arch), os.path.join(path, device, "Lib", arch), ) ) if platforms: supported_wince_platforms.append((device, platforms)) # checks MSVC version_pattern = re.compile("^..?\...?") detected_versions = [] for vcver, vcvar in [("VCExpress", "Exp"), ("VisualStudio", "")]: try: prefix = "SOFTWARE\\Wow6432node\\Microsoft\\" + vcver all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, prefix) except WindowsError: try: prefix = "SOFTWARE\\Microsoft\\" + vcver all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, prefix) except WindowsError: continue index = 0 while 1: try: version = _winreg.EnumKey(all_versions, index) except WindowsError: break index = index + 1 if not version_pattern.match(version): continue if version.endswith("Exp"): versionnumber = float(version[:-3]) else: versionnumber = float(version) detected_versions.append((versionnumber, version, prefix + "\\" + version)) def fun(tup): return tup[0] # FIXME sort does not have a key on python 2.3 detected_versions.sort(key=fun) for (v, version, reg) in detected_versions: try: msvc_version = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VS") path, type = _winreg.QueryValueEx(msvc_version, "ProductDir") path = str(path) targets = [] if ce_sdk: for device, platforms in supported_wince_platforms: cetargets = [] for platform, compiler, include, lib in platforms: winCEpath = os.path.join(path, "VC", "ce") if os.path.isdir(winCEpath): try: common_bindirs, _1, _2 = conf.get_msvc_version( "msvc", version, "x86", os.path.join(path, "Common7", "Tools", "vsvars32.bat") ) except conf.errors.ConfigurationError: pass else: if os.path.isdir(os.path.join(winCEpath, "lib", platform)): bindirs = [ os.path.join(winCEpath, "bin", compiler), os.path.join(winCEpath, "bin", "x86_" + compiler), ] + common_bindirs incdirs = [ include, os.path.join(winCEpath, "include"), os.path.join(winCEpath, "atlmfc", "include"), ] libdirs = [ lib, os.path.join(winCEpath, "lib", platform), os.path.join(winCEpath, "atlmfc", "lib", platform), ] cetargets.append((platform, (platform, (bindirs, incdirs, libdirs)))) versions.append((device + " " + version, cetargets)) if os.path.isfile(os.path.join(path, "VC", "vcvarsall.bat")): for target, realtarget in all_msvc_platforms[::-1]: try: targets.append( ( target, ( realtarget, conf.get_msvc_version( "msvc", version, target, os.path.join(path, "VC", "vcvarsall.bat") ), ), ) ) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(path, "Common7", "Tools", "vsvars32.bat")): try: targets.append( ( "x86", ( "x86", conf.get_msvc_version( "msvc", version, "x86", os.path.join(path, "Common7", "Tools", "vsvars32.bat") ), ), ) ) except conf.errors.ConfigurationError: pass versions.append(("msvc " + version, targets)) except WindowsError: continue
for target, realtarget in all_msvc_platforms[::-1]: try: targets.append( (target, (realtarget, conf.get_msvc_version( 'msvc', version, target, os.path.join(vc_path, 'vcvarsall.bat'))))) except conf.errors.ConfigurationError, e: pass elif os.path.isfile( os.path.join(vc_path, 'Common7', 'Tools', 'vsvars32.bat')): try: targets.append( ('x86', ('x86', conf.get_msvc_version( 'msvc', version, 'x86', os.path.join(vc_path, 'Common7', 'Tools', 'vsvars32.bat'))))) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(vc_path, 'Bin', 'vcvars32.bat')): try: targets.append(('x86', ('x86', conf.get_msvc_version( 'msvc', version, '', os.path.join(vc_path, 'Bin', 'vcvars32.bat'))))) except conf.errors.ConfigurationError: pass versions.append(('msvc ' + version, targets))
def msvc_thunk(): vs = conf.get_msvc_version(compiler, version, bat_target, bat) if select: return select(vs) else: return vs
def gather_msvc_versions(conf,versions): try: ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: try: ce_sdk=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs') except WindowsError: ce_sdk='' if ce_sdk: supported_wince_platforms=[] ce_index=0 while 1: try: sdk_device=_winreg.EnumKey(ce_sdk,ce_index) except WindowsError: break ce_index=ce_index+1 sdk=_winreg.OpenKey(ce_sdk,sdk_device) path,type=_winreg.QueryValueEx(sdk,'SDKRootDir') path=str(path) path,device=os.path.split(path) if not device: path,device=os.path.split(path) for arch,compiler in all_wince_platforms: platforms=[] if os.path.isdir(os.path.join(path,device,'Lib',arch)): platforms.append((arch,compiler,os.path.join(path,device,'Include',arch),os.path.join(path,device,'Lib',arch))) if platforms: supported_wince_platforms.append((device,platforms)) version_pattern=re.compile('^..?\...?') detected_versions=[] for vcver,vcvar in[('VCExpress','Exp'),('VisualStudio','')]: try: prefix='SOFTWARE\\Wow6432node\\Microsoft\\'+vcver all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,prefix) except WindowsError: try: prefix='SOFTWARE\\Microsoft\\'+vcver all_versions=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,prefix) except WindowsError: continue index=0 while 1: try: version=_winreg.EnumKey(all_versions,index) except WindowsError: break index=index+1 if not version_pattern.match(version): continue if version.endswith('Exp'): versionnumber=float(version[:-3]) else: versionnumber=float(version) detected_versions.append((versionnumber,version,prefix+"\\"+version)) def fun(tup): return tup[0] detected_versions.sort(key=fun) for(v,version,reg)in detected_versions: try: msvc_version=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,reg+"\\Setup\\VS") path,type=_winreg.QueryValueEx(msvc_version,'ProductDir') path=str(path) targets=[] if ce_sdk: for device,platforms in supported_wince_platforms: cetargets=[] for platform,compiler,include,lib in platforms: winCEpath=os.path.join(path,'VC','ce') if os.path.isdir(winCEpath): try: common_bindirs,_1,_2=conf.get_msvc_version('msvc',version,'x86',os.path.join(path,'Common7','Tools','vsvars32.bat')) except conf.errors.ConfigurationError: pass else: if os.path.isdir(os.path.join(winCEpath,'lib',platform)): bindirs=[os.path.join(winCEpath,'bin',compiler),os.path.join(winCEpath,'bin','x86_'+compiler)]+common_bindirs incdirs=[include,os.path.join(winCEpath,'include'),os.path.join(winCEpath,'atlmfc','include')] libdirs=[lib,os.path.join(winCEpath,'lib',platform),os.path.join(winCEpath,'atlmfc','lib',platform)] cetargets.append((platform,(platform,(bindirs,incdirs,libdirs)))) versions.append((device+' '+version,cetargets)) if os.path.isfile(os.path.join(path,'VC','vcvarsall.bat')): for target,realtarget in all_msvc_platforms[::-1]: try: targets.append((target,(realtarget,conf.get_msvc_version('msvc',version,target,os.path.join(path,'VC','vcvarsall.bat'))))) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(path,'Common7','Tools','vsvars32.bat')): try: targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'x86',os.path.join(path,'Common7','Tools','vsvars32.bat'))))) except conf.errors.ConfigurationError: pass versions.append(('msvc '+version,targets)) except WindowsError: continue
try: detected_versions.sort(key=fun) except: detected_versions.sort(lambda x,y:cmp(x[0],y[0])) return detected_versions def gather_msvc_targets(conf,versions,version,vc_path): targets=[] if os.path.isfile(os.path.join(vc_path,'vcvarsall.bat')): for target,realtarget in all_msvc_platforms[::-1]: try: targets.append((target,(realtarget,conf.get_msvc_version('msvc',version,target,os.path.join(vc_path,'vcvarsall.bat'))))) except conf.errors.ConfigurationError ,e: pass elif os.path.isfile(os.path.join(vc_path,'Common7','Tools','vsvars32.bat')): try: targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'x86',os.path.join(vc_path,'Common7','Tools','vsvars32.bat'))))) except conf.errors.ConfigurationError: pass elif os.path.isfile(os.path.join(vc_path,'Bin','vcvars32.bat')): try: targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'',os.path.join(vc_path,'Bin','vcvars32.bat'))))) except conf.errors.ConfigurationError: pass versions.append(('msvc '+version,targets)) def gather_wince_targets(conf,versions,version,vc_path,vsvars,supported_platforms): for device,platforms in supported_platforms: cetargets=[] for platform,compiler,include,lib in platforms: winCEpath=os.path.join(vc_path,'ce') if not os.path.isdir(winCEpath): continue