本文整理汇总了Python中setuptools.Extension类的典型用法代码示例。如果您正苦于以下问题:Python Extension类的具体用法?Python Extension怎么用?Python Extension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Extension类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
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)
开发者ID:REVLWorld,项目名称:pyhacrf,代码行数:7,代码来源:setup.py
示例2: __init__
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)
开发者ID:gregier,项目名称:epub-search,代码行数:8,代码来源:failablebuildext.py
示例3: __init__
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
开发者ID:avalentino,项目名称:pyepr,代码行数:10,代码来源:setup.py
示例4: __init__
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]
开发者ID:CharaD7,项目名称:kivy,代码行数:10,代码来源:setup.py
示例5: __init__
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)
开发者ID:nemurimasu,项目名称:boodler,代码行数:12,代码来源:setup.py
示例6: __init__
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()
开发者ID:stefanholek,项目名称:rl,代码行数:24,代码来源:setup.py
示例7: __init__
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
开发者ID:gevent,项目名称:gevent,代码行数:6,代码来源:_setuputils.py
示例8: print
print("Done!")
if not os.path.isdir(SQLPARSER_DIR):
download_library()
# check again (the user might have downloaded the library)
if os.path.isdir(SQLPARSER_DIR):
parsebridge = Extension('sqlparser',
sources = ['Parser.c', 'Statement.c', 'Node.c', 'ENodeType.c', 'parsebridgemodule.c',
SQLPARSER_DIR + 'ext/node_visitor/node_visitor.c',
SQLPARSER_DIR + 'ext/expr_traverse/expr_traverse.c',
SQLPARSER_DIR + 'ext/modifysql/modifysql.c' ],
include_dirs = [ SQLPARSER_DIR + 'core/',
SQLPARSER_DIR + 'ext/collection/includes/',
SQLPARSER_DIR + 'ext/expr_traverse/',
SQLPARSER_DIR + 'ext/modifysql/',
SQLPARSER_DIR + 'ext/node_visitor/' ],
library_dirs = [ SQLPARSER_DIR + '/lib/' ],
libraries = [ 'gspcollection', 'gspcore' ],
define_macros = [ ('_CRT_SECURE_NO_WARNINGS', None), ('DONT_FIX_FRAGMENTS', None), ],
extra_compile_args = ['-Wno-strict-prototypes'],
)
if sys.platform == 'win32' or sys.platform == 'win64':
parsebridge.extra_link_args = [ '/MANIFEST', '/DEBUG' ]
parsebridge.extra_compile_args = [ '/Zi' ]
setup (name = 'sqlparser',
version = '1.0',
description = 'A package for parsing SQL queries',
开发者ID:oreh,项目名称:python-sqlparser,代码行数:32,代码来源:setup.py
示例9: __init__
def __init__(self, *args, **kwargs):
self.avx2_defs = kwargs.pop("avx2_defs", {})
Extension.__init__(self, *args, **kwargs)
开发者ID:Blosc,项目名称:python-blosc,代码行数:3,代码来源:setup.py
示例10: build_extensions
#.........这里部分代码省略.........
for d in os.environ[k].split(os.path.pathsep):
_add_directory(library_dirs, d)
prefix = dsc.get_config_var("prefix")
if prefix:
_add_directory(library_dirs, os.path.join(prefix, "lib"))
_add_directory(include_dirs, os.path.join(prefix, "include"))
if sys.platform == "darwin":
# fink installation directories
_add_directory(library_dirs, "/sw/lib")
_add_directory(include_dirs, "/sw/include")
# darwin ports installation directories
_add_directory(library_dirs, "/opt/local/lib")
_add_directory(include_dirs, "/opt/local/include")
# if Homebrew is installed, use its lib and include directories
import subprocess
try:
prefix = subprocess.check_output(
['brew', '--prefix']
).strip().decode('latin1')
except:
# Homebrew not installed
prefix = None
if prefix:
# add Homebrew's include and lib directories
_add_directory(library_dirs, os.path.join(prefix, 'lib'))
_add_directory(include_dirs, os.path.join(prefix, 'include'))
elif sys.platform.startswith("linux"):
arch_tp = (plat.processor(), plat.architecture()[0])
if arch_tp == ("x86_64", "32bit"):
# 32 bit build on 64 bit machine.
_add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
else:
for platform_ in arch_tp:
if not platform_:
continue
if platform_ in ["x86_64", "64bit"]:
_add_directory(library_dirs, "/lib64")
_add_directory(library_dirs, "/usr/lib64")
_add_directory(
library_dirs, "/usr/lib/x86_64-linux-gnu")
break
elif platform_ in ["i386", "i686", "32bit"]:
_add_directory(
library_dirs, "/usr/lib/i386-linux-gnu")
break
elif platform_ in ["aarch64"]:
_add_directory(library_dirs, "/usr/lib64")
_add_directory(
library_dirs, "/usr/lib/aarch64-linux-gnu")
break
else:
raise ValueError(
"Unable to identify Linux platform: `%s`" % platform_)
self.compiler.library_dirs = library_dirs + self.compiler.library_dirs
self.compiler.include_dirs = include_dirs + self.compiler.include_dirs
pylib = "python{}".format(sys.version[:3])
if sys.version[:3] == '3.4':
pylib += 'm'
libs = [pylib]
if _find_include_file(self, "jpeglib.h"):
if _find_library_file(self, "jpeg"):
libs.append('jpeg')
else:
raise ValueError("Unable to find libjpeg")
else:
raise ValueError("Unable to find jpeglib.h")
if _find_include_file(self, "boost/thread.hpp"):
if _find_library_file(self, "boost_thread"):
libs.append("boost_thread")
elif _find_library_file(self, "boost_thread-mt"):
libs.append("boost_thread-mt")
else:
raise ValueError("Unable to find libboost_thread")
if _find_library_file(self, "boost_system"):
libs.append("boost_system")
elif _find_library_file(self, "boost_system-mt"):
libs.append("boost_system-mt")
else:
raise ValueError("Unable to find libboost_system")
else:
raise ValueError("Unable to find boost headers")
print(libs)
iwt = Extension('_ImgWorker', sources=['imgworker.cpp'],
include_dirs=self.compiler.include_dirs,
library_dirs=self.compiler.library_dirs,
libraries=libs)
iwt._needs_stub = False
exts = [iwt]
self.extensions[:] = exts
build_ext.build_extensions(self)
开发者ID:caomw,项目名称:imgworker,代码行数:101,代码来源:setup.py
示例11: custom_build_ext
# run the customize_compiler
class custom_build_ext(build_ext):
def build_extensions(self):
customize_compiler_for_nvcc(self.compiler)
build_ext.build_extensions(self)
cmdclass = {}
if sys.platform.startswith('win') and os.path.exists(win_cuda_dir):
arch = int(platform.architecture()[0][0:2])
ts_module = Extension('_trottersuzuki_wrap',
sources=['trottersuzuki/trottersuzuki_wrap.cxx'],
extra_objects=['trottersuzuki/src/common.obj',
'trottersuzuki/src/cpublock.obj',
'trottersuzuki/src/model.obj',
'trottersuzuki/src/solver.obj',
'trottersuzuki/src/hybrid.cu.obj',
'trottersuzuki/src/cc2kernel.cu.obj'],
define_macros=[('CUDA', None)],
library_dirs=[win_cuda_dir+"/lib/x"+str(arch)],
libraries=['cudart', 'cublas'],
include_dirs=[numpy_include])
else:
if sys.platform.startswith('win'):
extra_compile_args = ['-openmp', '-DWIN32']
libraries = None
elif sys.platform.startswith('darwin') and 'CC' not in os.environ:
extra_compile_args = {'cc': []}
libraries = None
else:
extra_compile_args = {'cc': ['-fopenmp']}
if 'CC' in os.environ and 'clang-omp' in os.environ['CC']:
开发者ID:PanPalitta,项目名称:trotter-suzuki-mpi,代码行数:31,代码来源:setup.py
示例12: __init__
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)
开发者ID:rougier,项目名称:freetype-py,代码行数:6,代码来源:setup.py
示例13: Extension
import warnings
try:
from Cython.Distutils import build_ext
from setuptools import setup, Extension
HAVE_CYTHON = True
except ImportError as e:
warnings.warn(e.message)
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
HAVE_CYTHON = False
import numpy
_hdbscan_tree = Extension('hdbscan._hdbscan_tree',
sources=['hdbscan/_hdbscan_tree.pyx'],
include_dirs=[numpy.get_include()])
_hdbscan_linkage = Extension('hdbscan._hdbscan_linkage',
sources=['hdbscan/_hdbscan_linkage.pyx'],
include_dirs=['hdbscan', numpy.get_include()])
_hdbscan_boruvka = Extension('hdbscan._hdbscan_boruvka',
sources=['hdbscan/_hdbscan_boruvka.pyx'],
include_dirs=['hdbscan', numpy.get_include()])
_hdbscan_reachability = Extension('hdbscan._hdbscan_reachability',
sources=['hdbscan/_hdbscan_reachability.pyx'],
include_dirs=[numpy.get_include()])
dist_metrics = Extension('hdbscan.dist_metrics',
sources=['hdbscan/dist_metrics.pyx'],
include_dirs=[numpy.get_include()])
def readme():
开发者ID:pombredanne,项目名称:hdbscan,代码行数:31,代码来源:setup.py
示例14: print
print('Readthedocs environment: %s' % (rtd,))
if 'VSC_SCRATCH' in os.environ.keys():
# we are running on the VSC cluster
zlibdir = os.environ.get('EBROOTZLIB') # SOFTROOTZLIB
libraries = ['z']
library_dirs = [zlibdir + '/lib']
include_dirs = ['.', 'src', npinclude, zlibdir + '/include']
else:
libraries = []
library_dirs = []
include_dirs = ['.', 'src', npinclude]
oalib_module = Extension('_oalib', sources=sources,
include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries, swig_opts=swig_opts
)
compile_options += ['-DNOOMP']
swig_opts += ['-DNOOMP']
oalib_module.extra_compile_args = compile_options
if checkZlib(verbose=1):
if platform.system() == 'Windows':
pass
else:
zlibflag = '-DUSEZLIB'
oalib_module.extra_compile_args += [zlibflag]
swig_opts += [zlibflag]
oalib_module.extra_link_args += ['-lz']
开发者ID:eendebakpt,项目名称:oapackage,代码行数:31,代码来源:setup.py
示例15: expand
if sys.platform == 'win32':
libraries += ['ws2_32']
define_macros += [('FD_SETSIZE', '1024'), ('_WIN32', '1')]
def expand(*lst):
result = []
for item in lst:
for name in sorted(glob(item)):
result.append(name)
return result
CORE = Extension(name='gevent.core',
sources=['gevent/gevent.corecext.c'],
include_dirs=['libev'] if LIBEV_EMBED else [],
libraries=libraries,
define_macros=define_macros,
depends=expand('gevent/callbacks.*', 'gevent/stathelper.c', 'gevent/libev*.h', 'libev/*.*'))
# QQQ libev can also use -lm, however it seems to be added implicitly
ARES = Extension(name='gevent.ares',
sources=['gevent/gevent.ares.c'],
include_dirs=['c-ares'] if CARES_EMBED else [],
libraries=libraries,
define_macros=define_macros,
depends=expand('gevent/dnshelper.c', 'gevent/cares_*.*'))
ARES.optional = True
def make_universal_header(filename, *defines):
defines = [('#define %s ' % define, define) for define in defines]
开发者ID:Squarecap,项目名称:gevent,代码行数:32,代码来源:setup.py
示例16: read
#### PRE-CODE (to figure out, whether Cython is installed or not)
try:
from Cython.Distutils import build_ext
CYTHON_FOUND = True
except ImportError as e:
from distutils.command.build_ext import build_ext
warnings.warn(WARN_CYTHON_NOT_FOUND)
CYTHON_FOUND = False
#### FUNCTIONS
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
### MAIN SETUP
logdet = Extension('logdet',
sources = ['logdet/logdet.pyx', 'logdet/logdet.pxd'],
libraries=['lapack', 'blas'],
extra_compile_args=["-O3"])
configuration = {
'name' : 'logdet',
'version' : '0.1.0', # major.minor.micro
'author' : 'Oskar Maier',
'author_email' : '[email protected]',
'url' : 'https://github.com/loli/logdet',
'license' : 'LICENSE.txt',
'keywords' : 'lapack log-determinant computation',
'long_description' : read('README.rst'),
'classifiers' : [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
开发者ID:loli,项目名称:logdet,代码行数:32,代码来源:setup.py
示例17: __init__
def __init__(self, *args, **kwargs):
Extension.__init__(self, *args, **kwargs)
self._include_dirs = self.include_dirs
del self.include_dirs # restore overwritten property
开发者ID:inducer,项目名称:meshpy,代码行数:4,代码来源:aksetup_helper.py
示例18: open
import subprocess
import sys
from distutils.command import build_ext
from setuptools import Extension, setup
VERSION = re.search("__version__\s*=\s*\"(.*)\"", open('ssdeep.pyx').read(), re.M).group(1)
if sys.version_info[0] == 3:
CYTHON_OPTS = "-3 -f"
else:
CYTHON_OPTS = "-2 -f"
ssdeep_extension = Extension(
include_dirs=["ssdeep"],
name="ssdeep",
sources=["ssdeep.c"]
)
class BuildExtension(build_ext.build_ext):
def build_extension(self, ext):
self.compile_cython()
self.build_ssdeep()
return build_ext.build_ext.build_extension(self, ext)
def build_ssdeep(self):
if len(get_objects()) == 0:
try:
os.chmod(
"ssdeep/configure",
stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO
开发者ID:jnieuviarts,项目名称:python-ssdeep,代码行数:31,代码来源:setup.py
示例19: warn
return filenames
kinectsdk_dir = os.environ.get('KINECTSDK10_DIR', '')
if kinectsdk_dir:
kinectsdk_inc = os.path.join(kinectsdk_dir, 'inc')
kinectsdk_lib = os.path.join(kinectsdk_dir, 'lib', distutils.msvc9compiler.PLAT_TO_VCVARS[get_platform()])
else:
warn("Cannot find KINECTSDK10_DIR environment variable. You will need to install the Kinect for Windows SDK if building.")
pykinectaudio_ext = Extension(
'pykinect.audio.PyKinectAudio',
include_dirs=filter(None, ['src', kinectsdk_inc]),
libraries=['Msdmo', 'dmoguids', 'mf', 'mfuuid', 'mfplat', 'avrt', 'Kinect10'],
library_dirs=filter(None, [kinectsdk_lib]),
sources=[
'src\\stdafx.cpp',
'src\\PyKinectAudio.cpp',
'src\\AudioStream.cpp',
'src\\MediaBuffer.cpp',
],
)
pykinectaudio_ext.headers=[
'src\\AudioStream.h',
'src\\MediaBuffer.h',
'src\\PyKinectAudio.h',
'src\\stdafx.h',
'src\\targetver.h',
]
开发者ID:Afelio,项目名称:PTVS,代码行数:29,代码来源:setup.py
示例20: create_exension
def create_exension():
global EPICSBASE, HOSTARCH
umacros = []
macros = []
cflags = []
lflags = []
dlls = []
extra_objects = []
libraries = ["ca", "Com"]
CMPL = 'gcc'
UNAME = platform.system()
ARCH = platform.architecture()[0]
# platform dependent libraries and macros
if UNAME.lower() == "windows":
UNAME = "WIN32"
static = False
if HOSTARCH in ['win32-x86', 'windows-x64', 'win32-x86-debug', 'windows-x64-debug']:
if not SHARED:
dlls = ['Com.dll', 'ca.dll']
for dll in dlls:
dllpath = os.path.join(EPICSBASE, 'bin', HOSTARCH, dll)
if not os.path.exists(dllpath):
static = True
break
shutil.copy(dllpath,
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src', 'CaChannel'))
macros += [('_CRT_SECURE_NO_WARNINGS', 'None'), ('EPICS_CALL_DLL', '')]
cflags += ['/Z7']
CMPL = 'msvc'
if HOSTARCH in ['win32-x86-static', 'windows-x64-static'] or static:
libraries += ['ws2_32', 'user32', 'advapi32']
macros += [('_CRT_SECURE_NO_WARNINGS', 'None'), ('EPICS_DLL_NO', '')]
umacros += ['_DLL']
cflags += ['/EHsc', '/Z7']
lflags += ['/LTCG']
if HOSTARCH[-5:] == 'debug':
libraries += ['msvcrtd']
lflags += ['/NODEFAULTLIB:libcmtd.lib']
else:
libraries += ['msvcrt']
lflags += ['/NODEFAULTLIB:libcmt.lib']
CMPL = 'msvc'
# GCC compiler
if HOSTARCH in ['win32-x86-mingw', 'windows-x64-mingw']:
macros += [('_MINGW', ''), ('EPICS_DLL_NO', '')]
lflags += ['-static']
CMPL = 'gcc'
if HOSTARCH == 'windows-x64-mingw':
macros += [('MS_WIN64', '')]
CMPL = 'gcc'
elif UNAME.lower() == "darwin":
CMPL = 'clang'
HOSTARCH = 'darwin-x86'
if not SHARED:
extra_objects = [os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib) for lib in libraries]
libraries = []
elif UNAME.lower() == "linux":
CMPL = 'gcc'
if not SHARED:
extra_objects = [os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib) for lib in libraries]
libraries = ['rt']
if subprocess.call('nm %s | grep -q rl_' % os.path.join(EPICSBASE, 'lib', HOSTARCH, 'libCom.a'), shell=True) == 0:
libraries += ['readline']
else:
print("Platform", UNAME, ARCH, " Not Supported")
sys.exit(1)
include_dirs = [os.path.join(EPICSBASE, "include"),
os.path.join(EPICSBASE, "include", "os", UNAME),
os.path.join(EPICSBASE, "include", "compiler", CMPL),
]
ca_module = Extension('CaChannel._ca',
sources=['src/CaChannel/_ca.cpp'],
extra_compile_args=cflags,
include_dirs=include_dirs,
define_macros=macros,
undef_macros=umacros,
extra_link_args=lflags,
extra_objects=extra_objects,
libraries=libraries,
library_dirs=[os.path.join(EPICSBASE, "lib", HOSTARCH)])
if UNAME == "Linux" and SHARED:
ca_module.runtime_library_dirs = [os.path.join(EPICSBASE, "lib", HOSTARCH)]
return [ca_module], dlls
开发者ID:CaChannel,项目名称:CaChannel,代码行数:87,代码来源:setup.py
注:本文中的setuptools.Extension类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论