本文整理汇总了Python中Cython.Distutils.build_ext方法的典型用法代码示例。如果您正苦于以下问题:Python Distutils.build_ext方法的具体用法?Python Distutils.build_ext怎么用?Python Distutils.build_ext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cython.Distutils
的用法示例。
在下文中一共展示了Distutils.build_ext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_package
# 需要导入模块: from Cython import Distutils [as 别名]
# 或者: from Cython.Distutils import build_ext [as 别名]
def setup_package():
metadata = dict(name=spfeas_name,
maintainer=maintainer,
maintainer_email=maintainer_email,
description=description,
license=license_file,
version=__version__,
long_description=long_description,
author=author_file,
packages=get_packages(),
package_data=get_package_data(),
ext_modules=cythonize(get_pyx_list()),
include_dirs=[np.get_include()],
cmdclass=dict(build_ext=build_ext),
zip_safe=False,
download_url=git_url,
install_requires=required_packages,
entry_points=get_console_dict())
setup(**metadata)
示例2: __getitem__
# 需要导入模块: from Cython import Distutils [as 别名]
# 或者: from Cython.Distutils import build_ext [as 别名]
def __getitem__(self, key):
if key != 'build_ext':
return super(LazyBuildExtCommandClass, self).__getitem__(key)
from Cython.Distutils import build_ext as cython_build_ext
import numpy
# Cython_build_ext isn't a new-style class in Py2.
class build_ext(cython_build_ext, object):
"""
Custom build_ext command that lazily adds numpy's include_dir to
extensions.
"""
def build_extensions(self):
"""
Lazily append numpy's include directory to Extension includes.
This is done here rather than at module scope because setup.py
may be run before numpy has been installed, in which case
importing numpy and calling `numpy.get_include()` will fail.
"""
numpy_incl = numpy.get_include()
for ext in self.extensions:
ext.include_dirs.append(numpy_incl)
super(build_ext, self).build_extensions()
return build_ext
示例3: __getitem__
# 需要导入模块: from Cython import Distutils [as 别名]
# 或者: from Cython.Distutils import build_ext [as 别名]
def __getitem__(self, key):
if key != 'build_ext':
return super(LazyBuildExtCommandClass, self).__getitem__(key)
from Cython.Distutils import build_ext as cython_build_ext
import numpy
# Cython_build_ext isn't a new-style class in Py2.
class build_ext(cython_build_ext, object):
"""
Custom build_ext command that lazily adds numpy's include_dir to
extensions.
"""
def build_extensions(self):
"""
Lazily append numpy's include directory to Extension includes.
This is done here rather than at module scope because setup.py
may be run before numpy has been installed, in which case
importing numpy and calling `numpy.get_include()` will fail.
"""
numpy_incl = numpy.get_include()
for ext in self.extensions:
ext.include_dirs.append(numpy_incl)
super(build_ext, self).build_extensions()
return build_ext
示例4: _get_ext_modules
# 需要导入模块: from Cython import Distutils [as 别名]
# 或者: from Cython.Distutils import build_ext [as 别名]
def _get_ext_modules():
#build cython files
# python3 setup.py build_ext --inplace
path_parts = [MODULE_NAME, 'analysis', 'ske_create', 'segWormPython', 'cython_files']
cython_path = os.path.join(*path_parts)
cython_path_e = os.path.join(MODULE_NAME, 'analysis', 'stage_aligment')
def _add_path(f_list):
return [os.path.join(cython_path, x) for x in f_list]
def _get_mod_path(name):
return '.'.join(path_parts + [name])
ext_files = {
"circCurvature" : ["circCurvature.pyx", "c_circCurvature.c"],
"curvspace" : ["curvspace.pyx", "c_curvspace.c"]
}
include_dirs = [numpy.get_include()]
ext_modules = cythonize(os.path.join(cython_path, "*_cython.pyx"))
ext_modules += cythonize(os.path.join(cython_path_e, "*.pyx"))
ext_modules += [Extension(_get_mod_path(name),
sources=_add_path(files),
include_dirs=include_dirs)
for name, files in ext_files.items()]
return ext_modules
示例5: get_ext_modules
# 需要导入模块: from Cython import Distutils [as 别名]
# 或者: from Cython.Distutils import build_ext [as 别名]
def get_ext_modules(use_cython=USE_CYTHON):
global cmdclass
python_header_dir = get_python_header_dir()
if use_cython:
try:
from Cython.Distutils import build_ext
except ImportError:
stderr.write('\"cython\" is not installed. Forcing \"USE_CYTHON\" '
'to \"False\" in order to install.\n')
use_cython = False
if use_cython:
ext_modules = [Extension('src.features',
['src/features.pyx'],
include_dirs=[python_header_dir]),
Extension('src.experiments',
['src/experiments.pyx'],
include_dirs=[python_header_dir]),
Extension('src.datasets',
['src/datasets.pyx'],
include_dirs=[python_header_dir]),
Extension('src.mongodb',
['src/mongodb.pyx'],
include_dirs=[python_header_dir])]
cmdclass.update({'build_ext': build_ext})
return ext_modules
ext_modules = [Extension('src.features',
['src/features.c'],
include_dirs=[python_header_dir]),
Extension('src.experiments',
['src/experiments.pyx'],
include_dirs=[python_header_dir]),
Extension('src.datasets',
['src/datasets.c'],
include_dirs=[python_header_dir]),
Extension('src.mongodb',
['src/mongodb.c'],
include_dirs=[python_header_dir])]
return ext_modules