当前位置: 首页>>代码示例>>Python>>正文


Python sysconfig.get_python_inc方法代码示例

本文整理汇总了Python中distutils.sysconfig.get_python_inc方法的典型用法代码示例。如果您正苦于以下问题:Python sysconfig.get_python_inc方法的具体用法?Python sysconfig.get_python_inc怎么用?Python sysconfig.get_python_inc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distutils.sysconfig的用法示例。


在下文中一共展示了sysconfig.get_python_inc方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_python_inc

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def test_get_python_inc(self):
        inc_dir = sysconfig.get_python_inc()
        # This is not much of a test.  We make sure Python.h exists
        # in the directory returned by get_python_inc() but we don't know
        # it is the correct file.
        self.assertTrue(os.path.isdir(inc_dir), inc_dir)
        python_h = os.path.join(inc_dir, "Python.h")
        self.assertTrue(os.path.isfile(python_h), python_h) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_sysconfig.py

示例2: configuration

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
    from numpy.distutils.system_info import get_info
    from distutils.sysconfig import get_python_inc

    config = Configuration('spatial', parent_package, top_path)

    config.add_data_dir('tests')
    config.add_data_dir('benchmarks')

    qhull_src = ['geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c',
                 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c',
                 'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c',
                 'userprintf.c', 'userprintf_rbox.c']
    qhull_src = [join('qhull', 'src', x) for x in qhull_src]

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())

    cfg = dict(get_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)
    cfg.setdefault('define_macros', []).append(('qh_QHpointer','1'))
    config.add_extension('qhull',
                         sources=['qhull.c'] + qhull_src,
                         **cfg)

    config.add_extension('ckdtree', sources=['ckdtree.c'])  # FIXME: cython

    config.add_extension('_distance_wrap',
        sources=[join('src', 'distance_wrap.c'), join('src', 'distance.c')],
        include_dirs=[get_numpy_include_dirs()])

    return config 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:37,代码来源:setup.py

示例3: run

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def run(self):
        relpath = os.path.relpath(self.tick_dir, self.cpp_build_dir)
        cmake_exe = os.environ.get('TICK_CMAKE', 'cmake')

        inc_dir = sysconfig.get_python_inc()
        cmake_cmd = [cmake_exe,
                     '-DPYTHON_INCLUDE_DIR={}'.format(inc_dir),
                     '-DTICK_REBUILD_LIBS=OFF',
                     '-DBENCHMARK=OFF',
                     relpath + '/../lib']

        if TICK_CMAKE_GENERATOR is not None:
            cmake_cmd.extend(['-G', '{}'.format(TICK_CMAKE_GENERATOR)])

        # Feed the path to the built C++ extensions so CMake does not have to
        # build them again
        for mod in tick_modules:
            full_path = os.path.abspath(
                os.path.join(mod.module_ref.build, mod.module_ref.lib_filename))

            cmake_cmd.append(
                '-DTICK_LIB_{}={}'.format(mod.ext_name.upper(), full_path))

        define_macros = []
        if 'define_macros' in blas_info and \
                any(key == 'HAVE_CBLAS' for key, _ in blas_info['define_macros']):
            cmake_cmd.append('-DUSE_BLAS=ON')

        os.makedirs(os.path.join(self.cpp_build_dir, 'cpptest'), exist_ok=True)
        subprocess.check_call(cmake_cmd, cwd=self.cpp_build_dir)

        make_cmd = ['make', 'VERBOSE=1', 'all', '-j{}'.format(self.build_jobs)]
        subprocess.check_call(make_cmd, cwd=self.cpp_build_dir) 
开发者ID:X-DataInitiative,项目名称:tick,代码行数:35,代码来源:setup.py

示例4: compile

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def compile(self):
        # Select the correct Makefile to be used
        makefile = "Makefile"
        if self.architecture == "x86_64":
            makefile = "Makefile_64bit"

        import distutils.sysconfig as sysconfig
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        SolverInstaller.run("make -C %s -f %s PYTHON_INCL=-I%s" %
                            (self.extract_path, makefile, PYTHON_INCLUDE_DIR)) 
开发者ID:pysmt,项目名称:pysmt,代码行数:12,代码来源:bdd.py

示例5: compile

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def compile(self):
        # Override default Python library, include, and interpreter
        # path into Boolector's CMake because CMake can get confused
        # if multiple interpreters are available, especially python 2
        # vs python 3.
        import distutils.sysconfig as sysconfig
        import sys
        PYTHON_LIBRARY = os.environ.get('PYSMT_PYTHON_LIBDIR')
        if not PYTHON_LIBRARY:
            PYTHON_LIBRARY = sysconfig.get_config_var('LIBDIR')
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        PYTHON_EXECUTABLE = sys.executable
        CMAKE_OPTS = ' -DPYTHON_LIBRARY=' + PYTHON_LIBRARY
        CMAKE_OPTS += ' -DPYTHON_INCLUDE_DIR=' + PYTHON_INCLUDE_DIR
        CMAKE_OPTS += ' -DPYTHON_EXECUTABLE=' + PYTHON_EXECUTABLE

        # Unpack
        SolverInstaller.untar(os.path.join(self.base_dir, self.archive_name),
                              self.extract_path)

        # Build lingeling
        SolverInstaller.run("bash ./contrib/setup-lingeling.sh",
                            directory=self.extract_path)

        # Build Btor
        SolverInstaller.run("bash ./contrib/setup-btor2tools.sh",
                            directory=self.extract_path)


        # Build Boolector Solver
        SolverInstaller.run("bash ./configure.sh --python",
                            directory=self.extract_path,
                            env_variables={"CMAKE_OPTS": CMAKE_OPTS})

        SolverInstaller.run("make -j2",
                            directory=os.path.join(self.extract_path, "build")) 
开发者ID:pysmt,项目名称:pysmt,代码行数:38,代码来源:btor.py

示例6: compile

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def compile(self):
        # Build ANTLR

        SolverInstaller.run("bash %s" % os.path.join("contrib", "get-antlr-3.4"),
                            directory=self.extract_path)

        # Build ABC
        # SolverInstaller.run("bash get-abc",
        #                     directory=os.path.join(self.extract_path, "contrib"))
        # Build GLPK
        # We could configure with --gpl --best, but this takes forever to build

        # Inject Python library and include paths into CMake because CVC4 search
        # system can be fooled in some systems
        import distutils.sysconfig as sysconfig
        PYTHON_LIBRARY = os.environ.get('PYSMT_PYTHON_LIBDIR')
        if not PYTHON_LIBRARY:
            PYTHON_LIBRARY = sysconfig.get_config_var('LIBDIR')
        PYTHON_INCLUDE_DIR = sysconfig.get_python_inc()
        SolverInstaller.run(['sed', '-i',
                             's|cmake_opts=""|cmake_opts="-DPYTHON_LIBRARY=' + PYTHON_LIBRARY + ' -DPYTHON_INCLUDE_DIR=' + PYTHON_INCLUDE_DIR + '"|g',
                             './configure.sh'], directory=self.extract_path)

        # Configure and build CVC4
        config_cmd = "./configure.sh --language-bindings=python \
                                     --python%s" % self.python_version[0]

        if os.path.exists(sys.executable+"-config"):
            pyconfig = {"PYTHON_CONFIG": sys.executable+"-config"}
        else:
            pyconfig = {}

        SolverInstaller.run(config_cmd, directory=self.extract_path,
                            env_variables=pyconfig)
        SolverInstaller.run("make", directory=self.build_path,
                            env_variables=pyconfig)
        # SolverInstaller.run("make install", directory=self.build_path,
        #                     env_variables=pyconfig) 
开发者ID:pysmt,项目名称:pysmt,代码行数:40,代码来源:cvc4.py

示例7: getInclude

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def getInclude():
    dirName = get_python_inc()
    return [dirName, os.path.dirname(dirName), np.get_include()] 
开发者ID:zudi-lin,项目名称:pytorch_connectomics,代码行数:5,代码来源:setup.py

示例8: bazel_build

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def bazel_build(self, ext):
    with open('WORKSPACE', 'r') as f:
      workspace_contents = f.read()

    with open('WORKSPACE', 'w') as f:
      f.write(re.sub(
          r'(?<=path = ").*(?=",  # May be overwritten by setup\.py\.)',
          sysconfig.get_python_inc().replace(os.path.sep, posixpath.sep),
          workspace_contents))

    if not os.path.exists(self.build_temp):
      os.makedirs(self.build_temp)

    bazel_argv = [
        'bazel',
        'build',
        ext.bazel_target,
        '--symlink_prefix=' + os.path.join(self.build_temp, 'bazel-'),
        '--compilation_mode=' + ('dbg' if self.debug else 'opt'),
    ]

    if IS_WINDOWS:
      # Link with python*.lib.
      for library_dir in self.library_dirs:
        bazel_argv.append('--linkopt=/LIBPATH:' + library_dir)

    self.spawn(bazel_argv)

    shared_lib_suffix = '.dll' if IS_WINDOWS else '.so'
    ext_bazel_bin_path = os.path.join(
        self.build_temp, 'bazel-bin',
        ext.relpath, ext.target_name + shared_lib_suffix)
    ext_dest_path = self.get_ext_fullpath(ext.name)
    ext_dest_dir = os.path.dirname(ext_dest_path)
    if not os.path.exists(ext_dest_dir):
      os.makedirs(ext_dest_dir)
    shutil.copyfile(ext_bazel_bin_path, ext_dest_path) 
开发者ID:deepmind,项目名称:tree,代码行数:39,代码来源:setup.py

示例9: sdist

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def sdist(self):
        """Returns a class that can be used as a replacement for the
        ``sdist`` command in ``setuptools`` and that will clean up
        ``vendor/source/igraph`` before running the original ``sdist``
        command.
        """
        from setuptools.command.sdist import sdist
        from distutils.sysconfig import get_python_inc

        buildcfg = self

        class custom_sdist(sdist):
            def run(self):
                # Clean up vendor/source/igraph with git
                cwd = os.getcwd()
                try:
                    os.chdir(os.path.join("vendor", "source", "igraph"))
                    if os.path.exists(".git"):
                        retcode = subprocess.call("git clean -dfx", shell=True)
                        if retcode:
                            print("Failed to clean vendor/source/igraph with git")
                            print("")
                            return False
                finally:
                    os.chdir(cwd)

                # Run the original sdist command
                sdist.run(self)

        return custom_sdist 
开发者ID:igraph,项目名称:python-igraph,代码行数:32,代码来源:setup.py

示例10: python_config

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def python_config (self):
		cflags = self._getitem('default', 'python_cflags', None)
		ldflags = self._getitem('default', 'python_ldflags', None)
		if cflags or ldflags:
			return (cflags.strip('\r\n\t '), ldflags.strip('\r\n\t '))
		pythoninc, pythonlib = [], []
		import distutils.sysconfig
		sysconfig = distutils.sysconfig
		inc1 = sysconfig.get_python_inc()
		inc2 = sysconfig.get_python_inc(plat_specific = True)
		pythoninc.append('-I' + self.pathtext(inc1))
		if inc2 != inc1:
			pythoninc.append('-I' + self.pathtext(inc2))
		pyver = sysconfig.get_config_var('VERSION')
		getvar = sysconfig.get_config_var
		if not pyver:
			v1, v2 = sys.version_info[:2]
			pyver = self.unix and '%s.%s'%(v1, v2) or '%s%s'%(v1, v2)
		lib1 = getvar('LIBS')
		pythonlib.extend(lib1 and lib1.split() or [])
		prefix = sys.prefix
		if os.path.exists(prefix):
			if not pythoninc:
				n1 = os.path.join(prefix, 'include/python%s'%pyver)
				n2 = os.path.join(prefix, 'include')
				if os.path.exists(n1 + '/Python.h'):
					pythoninc.append('-I' + self.pathtext(n1))
				elif os.path.exists(n2 + '/Python.h'):
					pythoninc.append('-I' + self.pathtext(n2))
			if not pythonlib:
				n1 = os.path.join(prefix, 'lib/python%s'%pyver)
				n2 = os.path.join(n1, 'config')
				n3 = os.path.join(prefix, 'libs')
				fn1 = 'libpython' + pyver + '.a'
				fn2 = 'libpython' + pyver + '.dll.a'
				done = False
				for ff in (fn1, fn2):
					for nn in (n1, n2, n3):
						if os.path.exists(nn + '/' + ff):
							pythonlib.append('-L' + self.pathtext(nn))
							done = True
							break
					if done:
						break
		lib2 = getvar('SYSLIBS')
		pythonlib.extend(lib2 and lib2.split() or [])
		if not getvar('Py_ENABLE_SHARED'):
			if getvar('LIBPL'):
				pythonlib.insert(0, '-L' + getvar('LIBPL'))
		if not getvar('PYTHONFRAMEWORK'):
			if getvar('LINKFORSHARED'):
				pythonlib.extend(getvar('LINKFORSHARED').split())
		pythonlib.append('-lpython' + pyver)
		cflags = ' '.join(pythoninc)
		ldflags = ' '.join(pythonlib)
		return cflags, ldflags
	
	# 最终完成 java配置 
开发者ID:skywind3000,项目名称:emake,代码行数:60,代码来源:emake.py

示例11: test_embeddable

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import get_python_inc [as 别名]
def test_embeddable(self):
        import subprocess
        import ctypes
        from distutils import ccompiler, sysconfig

        with open('embed_pil.c', 'w') as fh:
            fh.write("""
#include "Python.h"

int main(int argc, char* argv[])
{
    char *home = "%s";
#if PY_MAJOR_VERSION >= 3
    wchar_t *whome = Py_DecodeLocale(home, NULL);
    Py_SetPythonHome(whome);
#else
    Py_SetPythonHome(home);
#endif

    Py_InitializeEx(0);
    Py_DECREF(PyImport_ImportModule("PIL.Image"));
    Py_Finalize();

    Py_InitializeEx(0);
    Py_DECREF(PyImport_ImportModule("PIL.Image"));
    Py_Finalize();

#if PY_MAJOR_VERSION >= 3
    PyMem_RawFree(whome);
#endif

    return 0;
}
        """ % sys.prefix.replace('\\', '\\\\'))

        compiler = ccompiler.new_compiler()
        compiler.add_include_dir(sysconfig.get_python_inc())

        libdir = (sysconfig.get_config_var('LIBDIR') or
                  sysconfig.get_python_inc().replace('include', 'libs'))
        print(libdir)
        compiler.add_library_dir(libdir)
        objects = compiler.compile(['embed_pil.c'])
        compiler.link_executable(objects, 'embed_pil')

        env = os.environ.copy()
        env["PATH"] = sys.prefix + ';' + env["PATH"]

        # do not display the Windows Error Reporting dialog
        ctypes.windll.kernel32.SetErrorMode(0x0002)

        process = subprocess.Popen(['embed_pil.exe'], env=env)
        process.communicate()
        self.assertEqual(process.returncode, 0) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:56,代码来源:test_image_access.py


注:本文中的distutils.sysconfig.get_python_inc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。