本文整理汇总了Python中numpy.distutils.core.Extension方法的典型用法代码示例。如果您正苦于以下问题:Python core.Extension方法的具体用法?Python core.Extension怎么用?Python core.Extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.distutils.core
的用法示例。
在下文中一共展示了core.Extension方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_library
# 需要导入模块: from numpy.distutils import core [as 别名]
# 或者: from numpy.distutils.core import Extension [as 别名]
def add_library(self,name,sources,**build_info):
"""
Add library to configuration.
Parameters
----------
name : str
Name of the extension.
sources : sequence
List of the sources. The list of sources may contain functions
(called source generators) which must take an extension instance
and a build directory as inputs and return a source file or list of
source files or None. If None is returned then no sources are
generated. If the Extension instance has no sources after
processing all source generators, then no extension module is
built.
build_info : dict, optional
The following keys are allowed:
* depends
* macros
* include_dirs
* extra_compiler_args
* extra_f77_compile_args
* extra_f90_compile_args
* f2py_options
* language
"""
self._add_library(name, sources, None, build_info)
dist = self.get_distribution()
if dist is not None:
self.warn('distutils distribution has been initialized,'\
' it may be too late to add a library '+ name)
示例2: append_to
# 需要导入模块: from numpy.distutils import core [as 别名]
# 或者: from numpy.distutils.core import Extension [as 别名]
def append_to(self, extlib):
"""Append libraries, include_dirs to extension or library item.
"""
if is_sequence(extlib):
lib_name, build_info = extlib
dict_append(build_info,
libraries=self.libraries,
include_dirs=self.include_dirs)
else:
from numpy.distutils.core import Extension
assert isinstance(extlib, Extension), repr(extlib)
extlib.libraries.extend(self.libraries)
extlib.include_dirs.extend(self.include_dirs)
示例3: add_library
# 需要导入模块: from numpy.distutils import core [as 别名]
# 或者: from numpy.distutils.core import Extension [as 别名]
def add_library(self,name,sources,**build_info):
"""
Add library to configuration.
Parameters
----------
name : str
Name of the extension.
sources : sequence
List of the sources. The list of sources may contain functions
(called source generators) which must take an extension instance
and a build directory as inputs and return a source file or list of
source files or None. If None is returned then no sources are
generated. If the Extension instance has no sources after
processing all source generators, then no extension module is
built.
build_info : dict, optional
The following keys are allowed:
* depends
* macros
* include_dirs
* extra_compiler_args
* extra_f77_compiler_args
* extra_f90_compiler_args
* f2py_options
* language
"""
self._add_library(name, sources, None, build_info)
dist = self.get_distribution()
if dist is not None:
self.warn('distutils distribution has been initialized,'\
' it may be too late to add a library '+ name)
示例4: configuration
# 需要导入模块: from numpy.distutils import core [as 别名]
# 或者: from numpy.distutils.core import Extension [as 别名]
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('randomkit', parent_package, top_path)
libs = []
if sys.platform == 'win32':
libs.append('Advapi32')
extensions = [Extension('modl.utils.randomkit.random_fast',
sources=['modl/utils/randomkit/random_fast.pyx',
'modl/utils/randomkit/randomkit.c',
'modl/utils/randomkit/distributions.c',
],
language="c++",
include_dirs=[numpy.get_include(),
'modl/utils/randomkit'],
),
Extension('modl.utils.randomkit.sampler',
sources=['modl/utils/randomkit/sampler.pyx'],
language="c++",
include_dirs=[numpy.get_include()]
)]
config.ext_modules += extensions
config.add_subpackage('tests')
return config