Ejemplo 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\\'
    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)
Ejemplo n.º 2
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))
Ejemplo n.º 3
0
Archivo: vc.py Proyecto: 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))
Ejemplo n.º 4
0
 def vcbin_arch(self):
     if common.is_win64():
         result = {"x86_64": ["amd64", r"BIN\x86_amd64"], "ia64": [r"BIN\ia64"]}.get(target_arch, [])
     else:
         result = {"x86_64": ["x86_amd64"], "ia64": ["x86_ia64"]}.get(target_arch, [])
     # TODO(1.5)
     # return ';'.join(result)
     return string.join(result, ";")
Ejemplo n.º 5
0
 def vcbin_arch(self):
     if common.is_win64():
         result = {
             'x86_64' : ['amd64', r'BIN\x86_amd64'],
             'ia64'   : [r'BIN\ia64'],
         }.get(target_arch, [])
     else:
         result = {
             'x86_64' : ['x86_amd64'],
             'ia64'   : ['x86_ia64'],
         }.get(target_arch, [])
     # TODO(1.5)
     #return ';'.join(result)
     return string.join(result, ';')
Ejemplo n.º 6
0
 def vcbin_arch(self):
     if common.is_win64():
         result = {
             'x86_64' : ['amd64', r'BIN\x86_amd64'],
             'ia64'   : [r'BIN\ia64'],
         }.get(target_arch, [])
     else:
         result = {
             'x86_64' : ['x86_amd64'],
             'ia64'   : ['x86_ia64'],
         }.get(target_arch, [])
     # TODO(1.5)
     #return ';'.join(result)
     return string.join(result, ';')
Ejemplo n.º 7
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
Ejemplo n.º 8
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
Ejemplo n.º 9
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
Ejemplo n.º 10
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
Ejemplo n.º 11
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)
Ejemplo n.º 12
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)