Пример #1
0
	def GetPathToHeader(self):
		"Find full path to the requested header, searching through all INCLUDE directories"
		from distutils import msvc9compiler as mscompiler   # could try some other compilers for other python versions.
		includes = mscompiler.query_vcvarsall(mscompiler.get_build_version(), "x86")["include"].split(";")
		for path in includes:
			p = os.path.join(path, self.header).replace("\\\\", "\\")
			if os.path.isfile(p): return p
		raise ValueError("Can't find header")
Пример #2
0
 def GetPathToHeader(self):
     "Find full path to the requested header, searching through all INCLUDE directories"
     from distutils import msvc9compiler as mscompiler  # could try some other compilers for other python versions.
     includes = mscompiler.query_vcvarsall(mscompiler.get_build_version(),
                                           "x86")["include"].split(";")
     for path in includes:
         p = os.path.join(path, self.header).replace("\\\\", "\\")
         if os.path.isfile(p): return p
     raise ValueError("Can't find header")
Пример #3
0
    def check_compilers():
        # pylint: disable=F0401
        try:
            from distutils.msvccompiler import get_build_version as get_python_build_compiler
            from distutils.msvc9compiler import query_vcvarsall
        except ImportError:
            # We could implement our own checks but distutils should be available, send a warning
            raise EnvironmentError(
                'Failed to import distutils, not able to confirm compiler toolchain is present'
            )
        # pylint: enable=F0401

        _, version, _ = find_devenv()
        if version == None:
            raise EnvironmentError(
                'Failed to find any Visual Studio installed')
        versions_map = {'2008': 9.0, '2010': 10.0, '2012': 11.0, '2013': 12.0}

        # Turbulenz tools are built 32bit so always check for these compilers
        try:
            query_vcvarsall(versions_map[version], 'x86')
        except ValueError:
            raise EnvironmentError(
                'Setuptools unable to detect Visual Studio Compilers correctly'
            )

        arch, _ = platform.architecture()
        if arch == '64bit':
            _, python_build_version, _ = find_devenv(
                [str(get_python_build_compiler())])
            if python_build_version is not None:
                # We're running 64bit Python and the user has the Visual Studio version used to build Python
                # installed, check for the 64bit compilers
                try:
                    query_vcvarsall(versions_map[version], 'amd64')
                except ValueError:
                    raise EnvironmentError(
                        'Setuptools unable to detect Visual Studio Compilers correctly.\n'
                        'You appear to be running 64bit Python, ensure you install the '
                        '64bit compilers in Visual Studio')
        elif arch != '32bit':
            raise EnvironmentError(
                'Unexpected Python architecture, not able to'
                ' confirm compiler toolchain is present')
Пример #4
0
    def check_compilers():
        # pylint: disable=F0401
        try:
            from distutils.msvccompiler import get_build_version as get_python_build_compiler
            from distutils.msvc9compiler import query_vcvarsall
        except ImportError:
            # We could implement our own checks but distutils should be available, send a warning
            raise EnvironmentError('Failed to import distutils, not able to confirm compiler toolchain is present')
        # pylint: enable=F0401

        _, version, _ = find_devenv()
        if version == None:
            raise EnvironmentError('Failed to find any Visual Studio installed')
        versions_map = {
            '2008': 9.0,
            '2010': 10.0,
            '2012': 11.0,
            '2013': 12.0
        }

        # Turbulenz tools are built 32bit so always check for these compilers
        try:
            query_vcvarsall(versions_map[version], 'x86')
        except ValueError:
            raise EnvironmentError('Setuptools unable to detect Visual Studio Compilers correctly')

        arch, _ = platform.architecture()
        if arch == '64bit':
            _, python_build_version, _ = find_devenv([str(get_python_build_compiler())])
            if python_build_version is not None:
                # We're running 64bit Python and the user has the Visual Studio version used to build Python
                # installed, check for the 64bit compilers
                try:
                    query_vcvarsall(versions_map[version], 'amd64')
                except ValueError:
                    raise EnvironmentError('Setuptools unable to detect Visual Studio Compilers correctly.\n'
                                           'You appear to be running 64bit Python, ensure you install the '
                                           '64bit compilers in Visual Studio')
        elif arch != '32bit':
            raise EnvironmentError('Unexpected Python architecture, not able to'
                                   ' confirm compiler toolchain is present')
Пример #5
0
    def run(self):
        build_ext.run(self)

        # Find the quantlib dll and copy it to the built package
        if sys.platform == "win32":
            # Find the visual studio runtime redist dlls
            dlls = []
            if VC_INCLUDE_REDIST:
                plat_name = msvc9compiler.get_platform()
                plat_spec = msvc9compiler.PLAT_TO_VCVARS[plat_name]

                # look for the compiler executable
                vc_env = msvc9compiler.query_vcvarsall(VC_VERSION, plat_spec)
                for path in vc_env['path'].split(os.pathsep):
                    if os.path.exists(os.path.join(path, "cl.exe")):
                        crt_dir = "Microsoft.VC%d0.CRT" % VC_VERSION
                        redist_dir = os.path.join(path, "..", ".redist", ARCH,
                                                  crt_dir)
                        if not os.path.exists(redist_dir):
                            redist_dir = os.path.join(path, "..", "..",
                                                      "redist", ARCH, crt_dir)
                        break
                else:
                    raise RuntimeError("Can't find cl.exe")

                assert os.path.exists(
                    redist_dir), "Can't find CRT redist dlls '%s'" % redist_dir
                dlls.extend(glob.glob(os.path.join(redist_dir, "msvc*.dll")))

            for libdir in LIBRARY_DIRS:
                if os.path.exists(os.path.join(libdir, QL_LIBRARY + ".dll")):
                    dlls.append(os.path.join(libdir, QL_LIBRARY + ".dll"))
                    break
            else:
                raise AssertionError("%s.dll not found" % QL_LIBRARY)

            for dll in dlls:
                self.copy_file(
                    dll,
                    os.path.join(self.build_lib, "quantlib",
                                 os.path.basename(dll)))

            # Write the list of dlls to be pre-loaded
            filename = os.path.join(self.build_lib, "quantlib",
                                    "preload_dlls.txt")
            log.info("writing preload dlls list to %s", filename)
            if not self.dry_run:
                with open(filename, "wt") as fh:
                    fh.write("\n".join(map(os.path.basename, dlls)))
Пример #6
0
    def run(self):
        build_ext.run(self)

        # Find the quantlib dll and copy it to the built package
        if sys.platform == "win32":
            # Find the visual studio runtime redist dlls
            dlls = []
            if VC_INCLUDE_REDIST:
                plat_name = msvc9compiler.get_platform()
                plat_spec = msvc9compiler.PLAT_TO_VCVARS[plat_name]

                # look for the compiler executable
                vc_env = msvc9compiler.query_vcvarsall(VC_VERSION, plat_spec)
                for path in vc_env['path'].split(os.pathsep):
                    if os.path.exists(os.path.join(path, "cl.exe")):
                        crt_dir = "Microsoft.VC%d0.CRT" % VC_VERSION
                        redist_dir = os.path.join(path, "..", ".redist", ARCH, crt_dir)
                        if not os.path.exists(redist_dir):
                            redist_dir = os.path.join(path, "..", "..", "redist", ARCH, crt_dir)
                        break
                else:
                    raise RuntimeError("Can't find cl.exe")

                assert os.path.exists(redist_dir), "Can't find CRT redist dlls '%s'" % redist_dir
                dlls.extend(glob.glob(os.path.join(redist_dir, "msvc*.dll")))

            for libdir in LIBRARY_DIRS:
                if os.path.exists(os.path.join(libdir, QL_LIBRARY + ".dll")):
                    dlls.append(os.path.join(libdir, QL_LIBRARY + ".dll"))
                    break
            else:
                raise AssertionError("%s.dll not found" % QL_LIBRARY)

            for dll in dlls:
                self.copy_file(dll, os.path.join(self.build_lib, "quantlib", os.path.basename(dll)))

            # Write the list of dlls to be pre-loaded
            filename = os.path.join(self.build_lib, "quantlib", "preload_dlls.txt")
            log.info("writing preload dlls list to %s", filename)
            if not self.dry_run:
                with open(filename, "wt") as fh:
                    fh.write("\n".join(map(os.path.basename, dlls)))
Пример #7
0
    CyOpenGL_extra_link_args = ['-framework', 'OpenGL']
    CyOpenGL_extra_link_args += macOS_link_args
elif sys.platform == 'linux2' or sys.platform == 'linux':
    CyOpenGL_includes += ['/usr/include/GL']
    CyOpenGL_libs += ['GL']
elif sys.platform == 'win32':
    if cc == 'msvc':
        include_dirs = []
        if sys.version_info.major == 2:
            from setuptools.msvc import msvc9_query_vcvarsall
            includes = msvc9_query_vcvarsall(9.0)['include'].split(';')
            include_dirs += includes
            include_dirs += [os.path.join(path, 'gl') for path in includes]
        elif sys.version_info.major == 3 and sys.version_info.minor == 4:
            from distutils.msvc9compiler import query_vcvarsall
            includes = query_vcvarsall(10.0)['include'].split(';')
            include_dirs += includes
            if sys.maxsize <= 2**32:
                include_dirs += [os.path.join(path, 'gl') for path in includes]
        elif sys.version_info.major == 3 and sys.version_info.minor > 4:
            from distutils.msvc9compiler import query_vcvarsall
            includes = query_vcvarsall(14.0)['include'].split(';')
            include_dirs += includes
            include_dirs += [os.path.join(path, 'gl') for path in includes]
        CyOpenGL_includes += include_dirs
        CyOpenGL_extras += ['opengl32.lib']
    else:
        CyOpenGL_includes += ['/mingw/include/GL']
        CyOpenGL_extras += ['/mingw/lib/libopengl32.a']