Exemplo n.º 1
0
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))
Exemplo n.º 2
0
Arquivo: vc.py Projeto: mapycz/mapnik
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))
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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
Exemplo n.º 10
0
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
Exemplo n.º 11
0
    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
Exemplo n.º 12
0
    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
Exemplo n.º 13
0
    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
Exemplo n.º 14
0
 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
Exemplo n.º 15
0
 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
Exemplo n.º 16
0
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)
Exemplo n.º 17
0
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)
Exemplo n.º 18
0
    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
Exemplo n.º 19
0
    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