本文整理汇总了Python中setuptools.Extension.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Extension.__init__方法的具体用法?Python Extension.__init__怎么用?Python Extension.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.Extension
的用法示例。
在下文中一共展示了Extension.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
from numpy import get_include
from numpy.distutils.misc_util import get_info
kwargs.update(get_info('npymath'))
kwargs['include_dirs'] += [get_include()]
Extension.__init__(self, *args, **kwargs)
示例2: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
if 'error' in kwargs:
self.error = kwargs['error']
del kwargs['error']
args = ('Cannot be built', [])
_Extension.__init__(self, *args, **kwargs)
示例3: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Extension.__init__(self, *args, **kwargs)
self.cython_directives = {
'c_string_encoding': 'utf-8',
'profile': 'USE_PROFILE' in environ,
'embedsignature': 'USE_EMBEDSIGNATURE' in environ}
# XXX with pip, setuptools is imported before distutils, and change
# our pyx to c, then, cythonize doesn't happen. So force again our
# sources
self.sources = args[1]
示例4: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self._include_dirs = []
eprsrcdir = kwargs.pop('eprsrcdir', None)
Extension.__init__(self, *args, **kwargs)
if not any('epr_' in src for src in self.sources):
self.sources.extend(self._extra_sources(eprsrcdir))
self.setup_requires_cython = False
示例5: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, key, **opts):
self.boodler_key = key
modname = 'boodle.cboodle_'+key
ls = ['audev-'+key, 'cboodle-'+key, 'noteq', 'sample']
ls = [ ('src/cboodle/' + val + '.c') for val in ls ]
avail = opts.pop('available', None)
if (avail):
self.ext_available = avail
Extension.__init__(self, modname, ls, **opts)
示例6: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, name):
# Describe the extension
sources = [
'rl/readline.c',
'rl/stringarray.c',
'rl/unicode.c',
'rl/iterator.c',
'rl/modulestate.c',
]
Extension.__init__(self, name, sources)
# Use include and library dirs from Python build
self.use_include_dirs()
self.use_library_dirs()
# Use Mac Python library dir
if sys.platform == 'darwin':
if sys_path_contains('/Library/Frameworks/Python.framework'):
self.library_dirs.append(
'/Library/Frameworks/Python.framework/Versions/%d.%d/lib' % sys.version_info[:2])
self.use_static_readline()
self.suppress_warnings()
self.strip_debug_symbols()
示例7: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
if 'define_macros' in kwargs or 'undef_macros' in kwargs:
raise DistutilsOptionError('D does not support macros, so the'
' "define_macros" and "undef_macros" arguments are not'
' supported. Instead, consider using the "Version Condition"'
' and "Debug Condition" conditional compilation features'
' documented at http://www.digitalmars.com/d/version.html'
'\n Version flags can be passed to the compiler via the'
' "version_flags" keyword argument to DExtension; debug flags'
' via the "debug_flags" keyword argument. For example, when'
' used with the DMD compiler,'
'\n DExtension(..., version_flags=["a", "b"])'
'\nwill cause'
'\n -version=a -version=b'
'\nto be passed to the compiler.'
)
# If the user has requested any version_flags or debug_flags, we use
# the distutils 'define_macros' keyword argument to carry them (they're
# later unpacked in the dcompiler module).
define_macros = []
if 'version_flags' in kwargs or 'debug_flags' in kwargs:
if 'version_flags' in kwargs:
for flag in kwargs['version_flags']:
define_macros.append((flag, 'version'))
del kwargs['version_flags']
if 'debug_flags' in kwargs:
for flag in kwargs['debug_flags']:
define_macros.append((flag, 'debug'))
del kwargs['debug_flags']
# Pass in the extension name so the compiler class can know it
if 'name' in kwargs:
define_macros.append((kwargs['name'], 'name'))
elif len(args) > 0:
define_macros.append((args[0], 'name'))
# Pass in the 'tango' flag, also
with_tango = kwargs.pop('tango', False)
if with_tango:
define_macros.append(('Pyd_with_Tango', 'version'))
kwargs['define_macros'] = define_macros
# Similarly, pass in with_pyd, &c, via define_macros.
if 'raw_only' in kwargs:
kwargs['with_pyd'] = False
kwargs['with_st'] = False
kwargs['with_meta'] = False
kwargs['with_main'] = False
del kwargs['raw_only']
with_pyd = kwargs.pop('with_pyd', True)
with_st = kwargs.pop('with_st', False) # 5/23/07 st off by default.
# StackThreads doesn't work with Tango at the moment.
if with_tango:
with_st = False
with_meta = kwargs.pop('with_meta', True)
with_main = kwargs.pop('with_main', True)
if with_pyd and not with_meta:
raise DistutilsOptionError(
'Cannot specify with_meta=False while using Pyd. Specify'
' raw_only=True or with_pyd=False if you want to compile a raw Python/C'
' extension.'
)
if with_main and not with_pyd:
# The special PydMain function should only be used when using Pyd
with_main = False
define_macros.append(((with_pyd, with_st, with_meta, with_main), 'aux'))
std_Extension.__init__(self, *args, **kwargs)
示例8: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Extension.__init__(self, *args, **kwargs)
self._include_dirs = self.include_dirs
del self.include_dirs # restore overwritten property
示例9: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
save_sources = kwargs.get('sources', None)
_Extension.__init__(self, *args, **kwargs)
self.sources = save_sources
示例10: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.libraries = []
self.define_macros = []
# Python 2 has this as an old-style class for some reason
# so super() doesn't work.
_Extension.__init__(self, *args, **kwargs) # pylint:disable=no-member,non-parent-init-called
示例11: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.avx2_defs = kwargs.pop("avx2_defs", {})
Extension.__init__(self, *args, **kwargs)
示例12: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.export_include = kwargs.pop('export_include', [])
Extension.__init__(self, *args, **kwargs)
示例13: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.condition = kwargs.pop("condition", lambda builder: True)
Extension.__init__(self, *args, **kwargs)
示例14: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, name, cmd, cwd=".", output_dir=".", env=None):
Extension.__init__(self, name, sources=[])
self.cmd = cmd
self.cwd = path.normpath(cwd)
self.output_dir = path.normpath(output_dir)
self.env = env or dict(os.environ)
示例15: __init__
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
packages = kwargs.pop('pkg_config', [])
for package in packages:
options = self.__options_for_package(package, kwargs)
_Extension.__init__(self, *args, **kwargs)