def gather_vswhere_versions(conf, versions): try: import json except ImportError: Logs.error('Visual Studio 2017 detection requires Python 2.6') return prg_path = os.environ.get( 'ProgramFiles(x86)', os.environ.get('ProgramFiles', 'C:\\Program Files (x86)')) vswhere = os.path.join(prg_path, 'Microsoft Visual Studio', 'Installer', 'vswhere.exe') args = [vswhere, '-products', '*', '-legacy', '-format', 'json'] try: txt = conf.cmd_and_log(args) except Errors.WafError as e: Logs.debug('msvc: vswhere.exe failed %s', e) return if sys.version_info[0] < 3: txt = txt.decode(Utils.console_encoding()) arr = json.loads(txt) arr.sort(key=lambda x: x['installationVersion']) for entry in arr: ver = entry['installationVersion'] ver = str('.'.join(ver.split('.')[:2])) path = str(os.path.abspath(entry['installationPath'])) if os.path.exists(path) and ('msvc %s' % ver) not in versions: conf.gather_msvc_targets(versions, ver, path)
def gather_vswhere_versions(conf, versions): try: import json except ImportError: Logs.error('Visual Studio 2017 detection requires Python 2.6') return prg_path = os.environ.get('ProgramFiles(x86)', os.environ.get('ProgramFiles', 'C:\\Program Files (x86)')) vswhere = os.path.join(prg_path, 'Microsoft Visual Studio', 'Installer', 'vswhere.exe') args = [vswhere, '-products', '*', '-legacy', '-format', 'json'] try: txt = conf.cmd_and_log(args) except Errors.WafError as e: Logs.debug('msvc: vswhere.exe failed %s', e) return if sys.version_info[0] < 3: txt = txt.decode(sys.stdout.encoding or 'windows-1252') arr = json.loads(txt) arr.sort(key=lambda x: x['installationVersion']) for entry in arr: ver = entry['installationVersion'] ver = str('.'.join(ver.split('.')[:2])) path = str(os.path.abspath(entry['installationPath'])) if os.path.exists(path) and ('msvc %s' % ver) not in versions: conf.gather_msvc_targets(versions, ver, path)
def gather_msvc_versions(conf, versions): vc_paths = [] for (v,version,reg) in gather_msvc_detected_versions(): try: try: msvc_version = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC") except WindowsError: msvc_version = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++") path,type = Utils.winreg.QueryValueEx(msvc_version, 'ProductDir') except WindowsError: continue else: vc_paths.append((version, os.path.abspath(str(path)))) wince_supported_platforms = gather_wince_supported_platforms() for version,vc_path in vc_paths: vs_path = os.path.dirname(vc_path) vsvars = os.path.join(vs_path, 'Common7', 'Tools', 'vsvars32.bat') if wince_supported_platforms and os.path.isfile(vsvars): conf.gather_wince_targets(versions, version, vc_path, vsvars, wince_supported_platforms) # WP80 works with 11.0Exp and 11.0, both of which resolve to the same vc_path. # Stop after one is found. for version,vc_path in vc_paths: vs_path = os.path.dirname(vc_path) vsvars = os.path.join(vs_path, 'VC', 'WPSDK', 'WP80', 'vcvarsphoneall.bat') if os.path.isfile(vsvars): conf.gather_winphone_targets(versions, '8.0', vc_path, vsvars) break for version,vc_path in vc_paths: vs_path = os.path.dirname(vc_path) conf.gather_msvc_targets(versions, version, vc_path)
def gather_msvc_versions(conf, versions): vc_paths = [] for (v, version, reg) in gather_msvc_detected_versions(): try: try: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC") except WindowsError: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++") path, type = Utils.winreg.QueryValueEx(msvc_version, 'ProductDir') vc_paths.append((version, os.path.abspath(str(path)))) except WindowsError: continue wince_supported_platforms = gather_wince_supported_platforms() for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) vsvars = os.path.join(vs_path, 'Common7', 'Tools', 'vsvars32.bat') if wince_supported_platforms and os.path.isfile(vsvars): conf.gather_wince_targets(versions, version, vc_path, vsvars, wince_supported_platforms) vsvars = os.path.join(vs_path, 'VC', 'WPSDK', 'WP80', 'vcvarsphoneall.bat') if os.path.isfile(vsvars): conf.gather_winphone_targets(versions, '8.0', vc_path, vsvars) for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) conf.gather_msvc_targets(versions, version, vc_path)
def gather_msvc_versions(conf, versions): vc_paths = [] for (v, version, reg) in gather_msvc_detected_versions(): try: try: msvc_version = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC") except WindowsError: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++" ) path, type = Utils.winreg.QueryValueEx(msvc_version, "ProductDir") vc_paths.append((version, os.path.abspath(str(path)))) except WindowsError: continue wince_supported_platforms = gather_wince_supported_platforms() for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) vsvars = os.path.join(vs_path, "Common7", "Tools", "vsvars32.bat") if wince_supported_platforms and os.path.isfile(vsvars): conf.gather_wince_targets(versions, version, vc_path, vsvars, wince_supported_platforms) vsvars = os.path.join(vs_path, "VC", "WPSDK", "WP80", "vcvarsphoneall.bat") if os.path.isfile(vsvars): conf.gather_winphone_targets(versions, "8.0", vc_path, vsvars) for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) conf.gather_msvc_targets(versions, version, vc_path)
def gather_vswhere_versions(conf, versions): try: import json except ImportError: Logs.error("Visual Studio 2017 detection requires Python 2.6") return prg_path = os.environ.get( "ProgramFiles(x86)", os.environ.get("ProgramFiles", "C:\\Program Files (x86)") ) vswhere = os.path.join( prg_path, "Microsoft Visual Studio", "Installer", "vswhere.exe" ) args = [vswhere, "-products", "*", "-legacy", "-format", "json"] try: txt = conf.cmd_and_log(args) except Errors.WafError as e: Logs.debug("msvc: vswhere.exe failed %s", e) return if sys.version_info[0] < 3: txt = txt.decode(Utils.console_encoding()) arr = json.loads(txt) arr.sort(key=lambda x: x["installationVersion"]) for entry in arr: ver = entry["installationVersion"] ver = str(".".join(ver.split(".")[:2])) path = str(os.path.abspath(entry["installationPath"])) if os.path.exists(path) and ("msvc %s" % ver) not in versions: conf.gather_msvc_targets(versions, ver, path)
def gather_msvc_versions(conf, versions): vc_paths = [] for (v, version, reg) in gather_msvc_detected_versions(): try: try: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC" ) except OSError: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++", ) path, type = Utils.winreg.QueryValueEx(msvc_version, "ProductDir") except OSError: try: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432node\\Microsoft\\VisualStudio\\SxS\\VS7", ) path, type = Utils.winreg.QueryValueEx(msvc_version, version) except OSError: continue else: vc_paths.append((version, os.path.abspath(str(path)))) continue else: vc_paths.append((version, os.path.abspath(str(path)))) wince_supported_platforms = gather_wince_supported_platforms() for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) vsvars = os.path.join(vs_path, "Common7", "Tools", "vsvars32.bat") if wince_supported_platforms and os.path.isfile(vsvars): conf.gather_wince_targets( versions, version, vc_path, vsvars, wince_supported_platforms ) # WP80 works with 11.0Exp and 11.0, both of which resolve to the same vc_path. # Stop after one is found. for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) vsvars = os.path.join(vs_path, "VC", "WPSDK", "WP80", "vcvarsphoneall.bat") if os.path.isfile(vsvars): conf.gather_winphone_targets(versions, "8.0", vc_path, vsvars) break for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) conf.gather_msvc_targets(versions, version, vc_path)
def gather_msvc_versions(conf,versions): vc_paths=[] for(v,version,reg)in gather_msvc_detected_versions(): try: try: msvc_version=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,reg+"\\Setup\\VC") except WindowsError: msvc_version=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,reg+"\\Setup\\Microsoft Visual C++") path,type=_winreg.QueryValueEx(msvc_version,'ProductDir') vc_paths.append((version,os.path.abspath(str(path)))) except WindowsError: continue wince_supported_platforms=gather_wince_supported_platforms() for version,vc_path in vc_paths: vs_path=os.path.dirname(vc_path) conf.gather_msvc_targets(versions,version,vc_path) vsvars=os.path.join(vs_path,'Common7','Tools','vsvars32.bat') if wince_supported_platforms and os.path.isfile(vsvars): conf.gather_wince_targets(versions,version,vc_path,vsvars,wince_supported_platforms)
def gather_msvc_versions(conf, windows_kit, versions): vc_paths = [] for (v, version, reg) in gather_msvc_detected_versions(): try: try: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC") except WindowsError: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++") path, type = Utils.winreg.QueryValueEx(msvc_version, 'ProductDir') vc_paths.append((version, os.path.abspath(str(path)))) except WindowsError: continue for version, vc_path in vc_paths: vs_path = os.path.dirname(vc_path) conf.gather_msvc_targets(versions, version, windows_kit, vc_path) pass
except Errors.WafError, e: Logs.debug('msvc: vswhere.exe failed %s', e) return if sys.version_info[0] < 3: try: txt = txt.decode(sys.stdout.encoding or 'cp1252') except UnicodeError: txt = txt.decode('utf-8', 'replace') arr = json.loads(txt) arr.sort(key=lambda x: x['installationVersion']) for entry in arr: ver = entry['installationVersion'] ver = str('.'.join(ver.split('.')[:2])) path = str(os.path.abspath(entry['installationPath'])) if os.path.exists(path) and ('msvc %s' % ver) not in versions: conf.gather_msvc_targets(versions, ver, path) @conf def gather_msvc_versions(conf, versions): vc_paths = [] for (v, version, reg) in gather_msvc_detected_versions(): try: try: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC") except OSError: msvc_version = Utils.winreg.OpenKey( Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++") path, type = Utils.winreg.QueryValueEx(msvc_version, 'ProductDir')