本文整理匯總了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