def find_vc_pdir(msvc_version): """Try to find the product directory for the given version. Note ---- If for some reason the requested version could not be found, an exception which inherits from VisualCException will be raised.""" root = 'Software\\' try: hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version] except KeyError: debug("Unknown version of MSVC: %s" % msvc_version) raise UnsupportedVersion("Unknown version %s" % msvc_version) for hkroot, key in hkeys: try: comps = None if common.is_win64(): try: # ordinally at win64, try Wow6432Node first. comps = common.read_reg(root + 'Wow6432Node\\' + key, hkroot) except SCons.Util.WinError, e: # at Microsoft Visual Studio for Python 2.7, value is not in Wow6432Node pass if not comps: # not Win64, or Microsoft Visual Studio for Python 2.7 comps = common.read_reg(root + key, hkroot) except SCons.Util.WinError, e: debug('find_vc_dir(): no VC registry key %s' % repr(key))
def find_vc_pdir(msvc_version): """Try to find the product directory for the given version. Note ---- If for some reason the requested version could not be found, an exception which inherits from VisualCException will be raised.""" root = 'Software\\' if common.is_win64(): root = root + 'Wow6432Node\\' try: hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version] except KeyError: debug("Unknown version of MSVC: %s" % msvc_version) raise UnsupportedVersion("Unknown version %s" % msvc_version) for key in hkeys: key = root + key try: comps = common.read_reg(key) except WindowsError, e: debug('find_vc_dir(): no VC registry key %s' % repr(key)) else: debug('find_vc_dir(): found VC in registry: %s' % comps) if os.path.exists(comps): return comps else: debug('find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)'\ % comps) raise MissingConfiguration("registry dir %s not found on the filesystem" % comps)
def find_sdk_dir(self): """Try to find the MS SDK from the registry. Return None if failed or the directory does not exist. """ if not SCons.Util.can_read_reg: debug('find_sdk_dir(): can not read registry') return None hkey = self.HKEY_FMT % self.hkey_data debug('find_sdk_dir(): checking registry:%s'%hkey) try: sdk_dir = common.read_reg(hkey) except (WindowsError, e): debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey)) return None debug('find_sdk_dir(): Trying SDK Dir: %s'%sdk_dir) if not os.path.exists(sdk_dir): debug('find_sdk_dir(): %s not on file system' % sdk_dir) return None ftc = os.path.join(sdk_dir, self.sanity_check_file) if not os.path.exists(ftc): debug("find_sdk_dir(): sanity check %s not found" % ftc) return None return sdk_dir
def find_sdk_dir(self): """Try to find the MS SDK from the registry. Return None if failed or the directory does not exist. """ if not SCons.Util.can_read_reg: debug('find_sdk_dir(): can not read registry') return None hkey = self.HKEY_FMT % self.hkey_data try: sdk_dir = common.read_reg(hkey) except WindowsError as e: debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey)) return None if not os.path.exists(sdk_dir): debug('find_sdk_dir(): %s not on file system' % sdk_dir) return None ftc = os.path.join(sdk_dir, self.sanity_check_file) if not os.path.exists(ftc): debug("find_sdk_dir(): sanity check %s not found" % ftc) return None return sdk_dir
def find_framework_root(): # XXX: find it from environment (FrameworkDir) try: froot = read_reg(_FRAMEWORKDIR_HKEY_ROOT) debug("Found framework install root in registry: %s" % froot) except SCons.Util.WinError, e: debug("Could not read reg key %s" % _FRAMEWORKDIR_HKEY_ROOT) return None
def find_framework_root(): # XXX: find it from environment (FrameworkDir) try: froot = read_reg(_FRAMEWORKDIR_HKEY_ROOT) debug("Found framework install root in registry: %s" % froot) except WindowsError, e: debug("Could not read reg key %s" % _FRAMEWORKDIR_HKEY_ROOT) return None
def get_cur_sdk_dir_from_reg(): """Try to find the platform sdk directory from the registry. Return None if failed or the directory does not exist""" if not SCons.Util.can_read_reg: debug('SCons cannot read registry') return None try: val = common.read_reg(_CURINSTALLED_SDK_HKEY_ROOT) debug("Found current sdk dir in registry: %s" % val) except WindowsError, e: debug("Did not find current sdk in registry") return None
def find_framework_root(): # XXX: find it from environment (FrameworkDir) try: froot = read_reg(_FRAMEWORKDIR_HKEY_ROOT) debug("Found framework install root in registry: %s" % froot) except (WindowsError, e): debug("Could not read reg key %s" % _FRAMEWORKDIR_HKEY_ROOT) return None if not os.path.exists(froot): debug("%s not found on fs" % froot) return None return froot
def find_vs_dir_by_reg(self): root = 'Software\\' if is_win64(): root = root + 'Wow6432Node\\' for key in self.hkeys: if key=='use_dir': return self.find_vs_dir_by_vc() key = root + key try: comps = read_reg(key) except WindowsError, e: debug('find_vs_dir_by_reg(): no VS registry key %s' % repr(key)) else: debug('find_vs_dir_by_reg(): found VS in registry: %s' % comps) return comps
def find_sdk_dir(self): """Try to find the MS SDK from the registry. Return None if failed or the directory does not exist. """ if not SCons.Util.can_read_reg: debug('find_sdk_dir(): can not read registry') return None hkey = self.HKEY_FMT % self.hkey_data try: sdk_dir = common.read_reg(hkey) except WindowsError, e: debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey)) return None
def find_vc_dir(self): root = "Software\\" if common.is_win64(): root = root + "Wow6432Node\\" for key in self.hkeys: key = root + key try: comps = common.read_reg(key) except WindowsError, e: debug("find_vc_dir(): no VC registry key %s" % repr(key)) else: debug("find_vc_dir(): found VC in registry: %s" % comps) if os.path.exists(comps): return comps else: debug("find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)" % comps) return None
def find_vc_dir(self): root = 'Software\\' if common.is_win64(): root = root + 'Wow6432Node\\' for key in self.hkeys: key = root + key try: comps = common.read_reg(key) except WindowsError, e: debug('find_vc_dir(): no VC registry key %s' % repr(key)) else: debug('find_vc_dir(): found VC in registry: %s' % comps) if os.path.exists(comps): return comps else: debug('find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)'\ % comps) return None
def find_vc_pdir(msvc_version): """Try to find the product directory for the given version. Note ---- If for some reason the requested version could not be found, an exception which inherits from VisualCException will be raised.""" # NOLA if VCINSTALLDIR already set, VCVARS32.bat has been run # Avoid looking at the registry (CYGWIN can't do it) try: vcdir = os.environ['VCINSTALLDIR'] if (os.path.exists(vcdir)): debug('find_vc_dir(): VCINSTALLDIR: %s' % vcdir) return vcdir except KeyError: pass # NOLA cygwin python cannot read the registry if sys.platform == 'cygwin': return None root = 'Software\\' if common.is_win64(): root = root + 'Wow6432Node\\' try: hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version] except KeyError: debug("Unknown version of MSVC: %s" % msvc_version) raise UnsupportedVersion("Unknown version %s" % msvc_version) for key in hkeys: key = root + key try: comps = common.read_reg(key) except SCons.Util.RegError, e: debug('find_vc_dir(): no VC registry key %s' % repr(key)) else: debug('find_vc_dir(): found VC in registry: %s' % comps) if os.path.exists(comps): return comps else: debug('find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)'\ % comps) raise MissingConfiguration( "registry dir %s not found on the filesystem" % comps)
def find_vc_pdir(msvc_version): """Try to find the product directory for the given version. Note ---- If for some reason the requested version could not be found, an exception which inherits from VisualCException will be raised.""" # NOLA if VCINSTALLDIR already set, VCVARS32.bat has been run # Avoid looking at the registry (CYGWIN can't do it) try: vcdir = os.environ['VCINSTALLDIR']; if (os.path.exists(vcdir)): debug('find_vc_dir(): VCINSTALLDIR: %s' % vcdir) return vcdir except KeyError: pass # NOLA cygwin python cannot read the registry if sys.platform == 'cygwin': return None root = 'Software\\' if common.is_win64(): root = root + 'Wow6432Node\\' try: hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version] except KeyError: debug("Unknown version of MSVC: %s" % msvc_version) raise UnsupportedVersion("Unknown version %s" % msvc_version) for key in hkeys: key = root + key try: comps = common.read_reg(key) except SCons.Util.RegError, e: debug('find_vc_dir(): no VC registry key %s' % repr(key)) else: debug('find_vc_dir(): found VC in registry: %s' % comps) if os.path.exists(comps): return comps else: debug('find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)'\ % comps) raise MissingConfiguration("registry dir %s not found on the filesystem" % comps)
def find_sdk_dir(self): """Try to find the MS SDK from the registry. Return None if failed or the directory does not exist. """ # NOLA Explicitly check environment variable to avoid having to read registry try: sdk_dir = os.environ['VSSDK120Install'] except KeyError: return None if os.path.exists(sdk_dir): return sdk_dir if not SCons.Util.can_read_reg: debug('find_sdk_dir(): can not read registry') return None hkey = self.HKEY_FMT % self.hkey_data debug('find_sdk_dir(): checking registry:%s' % hkey) try: sdk_dir = common.read_reg(hkey) except SCons.Util.RegError, e: debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey)) return None
def find_sdk_dir(self): """Try to find the MS SDK from the registry. Return None if failed or the directory does not exist. """ # NOLA Explicitly check environment variable to avoid having to read registry try: sdk_dir = os.environ['VSSDK120Install'] except KeyError: return None if os.path.exists(sdk_dir): return sdk_dir if not SCons.Util.can_read_reg: debug('find_sdk_dir(): can not read registry') return None hkey = self.HKEY_FMT % self.hkey_data debug('find_sdk_dir(): checking registry:%s'%hkey) try: sdk_dir = common.read_reg(hkey) except SCons.Util.RegError, e: debug('find_sdk_dir(): no SDK registry key %s' % repr(hkey)) return None