def find_vc_product_dir(self): if not SCons.Util.can_read_reg: debug('find_vc_product_dir(): can not read registry') return None key = self.hkey_root + '\\' + self.vc_product_dir_key try: comps = read_reg(key) except WindowsError as e: debug('find_vc_product_dir(): no registry key %s' % key) else: if self.batch_file_dir_reg_relpath: comps = os.path.join(comps, self.batch_file_dir_reg_relpath) comps = os.path.normpath(comps) if os.path.exists(comps): return comps else: debug('find_vc_product_dir(): %s not on file system' % comps) d = os.environ.get(self.common_tools_var) if not d: msg = 'find_vc_product_dir(): no %s variable' debug(msg % self.common_tools_var) return None if not os.path.isdir(d): debug('find_vc_product_dir(): %s not on file system' % d) return None if self.batch_file_dir_env_relpath: d = os.path.join(d, self.batch_file_dir_env_relpath) d = os.path.normpath(d) return d
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 = read_reg(hkey) except WindowsError as e: debug('find_sdk_dir(): no registry key %s' % 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_vc_product_dir(self): if not SCons.Util.can_read_reg: debug('find_vc_product_dir(): can not read registry') return None key = self.hkey_root + '\\' + self.vc_product_dir_key try: comps = read_reg(key) except WindowsError, e: debug('find_vc_product_dir(): no registry key %s' % key)
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 = 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_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 = read_reg(hkey) except WindowsError, e: debug('find_sdk_dir(): no registry key %s' % hkey) return None
def mssdk_setup_env(env): HKEY_FMT = r'Software\Microsoft\Microsoft SDKs\Windows\v{sdk_version}\InstallationFolder' available_versions = get_sdk_versions() sdk_version = env.get('MSSDK_VERSION') if sdk_version not in available_versions: msg = ('mssdk <{v}> version is not available. ' 'Available versions are : {vs}') msg = msg.format(v = sdk_version, vs = available_versions) raise racy.ToolError('mssdk', msg ) HKEY_FMT = HKEY_FMT.format(sdk_version = sdk_version) try: sdk_dir = MSCommon.read_reg(HKEY_FMT) except WindowsError, e: msg = 'Missing SDK registry key {key}' msg = msg.format(key = HKEY_FMT) raise racy.ToolError('mssdk', msg )