def __init__(self, *args, **kwargs): for name, default in [("extra_pyxtract_cmds", []), ("lib_type", "dynamic")]: setattr(self, name, kwargs.get(name, default)) if name in kwargs: del kwargs[name] Extension.__init__(self, *args, **kwargs)
def BuildExtension(sources, output_dir, extension_name): from distutils import log from distutils.core import Distribution, Extension import os import tempfile build_dir = tempfile.mkdtemp() # Source file paths must be relative to current path. cwd = os.getcwd() src_files = [os.path.relpath(filename, cwd) for filename in sources] ext = Extension(extension_name, src_files) if os.name == 'nt': _FixDistutilsMsvcCompiler() # VS 2010 does not generate manifest, see http://bugs.python.org/issue4431 ext.extra_link_args = ['/MANIFEST'] dist = Distribution({ 'ext_modules': [ext] }) dist.script_args = ['build_ext', '--build-temp', build_dir, '--build-lib', output_dir] dist.parse_command_line() log.set_threshold(log.DEBUG) dist.run_commands() dist.script_args = ['clean', '--build-temp', build_dir, '--all'] dist.parse_command_line() log.set_threshold(log.DEBUG) dist.run_commands()
def get_extensions(): sources = ["lacosmicx/_lacosmicx.pyx", "lacosmicx/laxutils.c"] include_dirs = [numpy.get_include(), '.'] libraries = [] ext = Extension(name="_lacosmicx", sources=sources, include_dirs=include_dirs, libraries=libraries, language="c", extra_compile_args=['-g', '-O3', '-funroll-loops', '-ffast-math']) has_openmp, outputs = check_openmp() if has_openmp: ext.extra_compile_args.append('-fopenmp') ext.extra_link_args = ['-g', '-fopenmp'] else: log.warn('OpenMP was not found. ' 'lacosmicx will be compiled without OpenMP. ' '(Use the "-v" option of setup.py for more details.)') log.debug(('(Start of OpenMP info)\n' 'compiler stdout:\n{0}\n' 'compiler stderr:\n{1}\n' '(End of OpenMP info)').format(*outputs)) return [ext]
def __init__(self, root = ""): path = join(root, 'Onboard', 'osk') sources = [join(path, x) for x in self.sources] depends = [join(path, x) for x in self.depends] defines = self.defines # dconf had an API change between 0.12 and 0.13, tell osk major, minor, revision = get_pkg_version("dconf") if major == 0 and minor <= 12: defines.append(("DCONF_API_0", 0)) print("found dconf version {}.{}.{}".format(major, minor, revision)) Extension.__init__(self, MODULE_NAME_OSK, sources = sources, depends = depends, define_macros = defines, extra_compile_args = [ "-Wdeclaration-after-statement", "-Werror=declaration-after-statement"], **pkgconfig('gdk-3.0', 'x11', 'xi', 'xtst', 'xkbfile', 'dconf', 'libcanberra', 'hunspell') )
def no_cythonize(extensions, **_ignore): new_extensions = [] for extension in extensions: curr_lang = extension.language if curr_lang is None: curr_lang = "c" curr_lang = "c++" ext_copy = \ Extension(extension.name, extension.sources, language=curr_lang, include_dirs=extension.include_dirs, library_dirs=extension.library_dirs) sources = [] for sfile in ext_copy.sources: path, ext = os.path.splitext(sfile) new_sfile = sfile if ext in ('.pyx', '.py'): if extension.language == 'c++': ext = '.cpp' else: ext = '.c' new_sfile = path + ext sources.append(new_sfile) ext_copy.sources[:] = sources print "BUILDING %s" %(ext_copy.language) new_extensions.append(ext_copy) return new_extensions
def __init__(self, system_libraries): """extra_link_args is a list of argument strings from pkg-config, or None if we're to use the standard libcdio libraries""" self.__library_manifest__ = [] sources = [] libraries = set() extra_link_args = [] if (system_libraries.present("libcdio_paranoia")): if (system_libraries.guaranteed_present("libcdio_paranoia")): libraries.update(set(["libcdio", "libcdio_cdda", "libcdio_paranoia"])) else: extra_link_args.extend( system_libraries.extra_link_args("libcdio_paranoia")) sources.append("src/cdiomodule.c") self.__library_manifest__.append(("libcdio", "CDDA data extraction", True)) else: self.__library_manifest__.append(("libcdio", "CDDA data extraction", False)) Extension.__init__( self, 'audiotools.cdio', sources=sources, libraries=list(libraries), extra_link_args=extra_link_args)
def __init__(self, *args, **kwargs): # bypass the patched init if possible if Extension.__bases__: base, = Extension.__bases__ base.__init__(self, *args, **kwargs) else: Extension.__init__(self, *args, **kwargs)
def __init__(self): Extension.__init__(self, 'audiotools.verify', sources=['src/verify.c', 'src/bitstream.c', 'src/buffer.c', 'src/func_io.c'])
def __init__(self): Extension.__init__(self, "audiotools.verify", sources=["src/verify.c", "src/bitstream.c", "src/buffer.c", "src/func_io.c"])
def run_distutils(self, test_directory, module, workdir, incdir): cwd = os.getcwd() os.chdir(workdir) try: build_extension = build_ext(distutils_distro) build_extension.include_dirs = INCLUDE_DIRS[:] if incdir: build_extension.include_dirs.append(incdir) build_extension.finalize_options() ext_include_dirs = [] for match, get_additional_include_dirs in EXT_DEP_INCLUDES: if match(module): ext_include_dirs += get_additional_include_dirs() self.copy_related_files(test_directory, workdir, module) extension = Extension( module, sources = self.find_source_files(workdir, module), include_dirs = ext_include_dirs, extra_compile_args = CFLAGS, ) if self.language == 'cpp': extension.language = 'c++' build_extension.extensions = [extension] build_extension.build_temp = workdir build_extension.build_lib = workdir build_extension.run() finally: os.chdir(cwd)
def get_extensions(): med_sources = [str(os.path.join(UTIL_DIR, "median_utils.pyx")), str(os.path.join(UTIL_DIR, "quick_select.c"))] include_dirs = ['numpy', UTIL_DIR] libraries = [] ext_med = Extension(name=str('banzai.utils.median_utils'), sources=med_sources, include_dirs=include_dirs, libraries=libraries, language="c", extra_compile_args=['-g', '-O3', '-funroll-loops', '-ffast-math']) has_openmp, outputs = check_openmp() if has_openmp: if setup_helpers.get_compiler_option() == 'msvc': ext_med.extra_compile_args.append('-openmp') else: ext_med.extra_compile_args.append('-fopenmp') ext_med.extra_link_args = ['-g', '-fopenmp'] else: log.warn('OpenMP was not found. ' 'banzai will be compiled without OpenMP. ' '(Use the "-v" option of setup.py for more details.)') log.debug(('(Start of OpenMP info)\n' 'compiler stdout:\n{0}\n' 'compiler stderr:\n{1}\n' '(End of OpenMP info)').format(*outputs)) return [ext_med]
def __init__(self, system_libraries): self.__library_manifest__ = [] sources = [] libraries = set() extra_compile_args = [] extra_link_args = [] if system_libraries.present("libdvd-audio"): if system_libraries.guaranteed_present("libdvd-audio"): libraries.update(set(["libdvd-audio"])) else: extra_compile_args.extend( system_libraries.extra_compile_args("libdvd-audio")) extra_link_args.extend( system_libraries.extra_link_args("libdvd-audio")) sources.extend(["src/dvdamodule.c", "src/framelist.c", "src/pcm_conv.c"]) self.__library_manifest__.append(("libdvd-audio", "DVD-Audio data extraction", True)) else: self.__library_manifest__.append(("libdvd-audio", "DVD-Audio data extraction", False)) Extension.__init__( self, "audiotools.dvda", sources=sources, libraries=list(libraries), extra_compile_args=extra_compile_args, extra_link_args=extra_link_args)
def __init__(self, name, sources, **kwargs): # the goal is to rely on original Extension # to do so we convert the .py to .cpp with pythran # and register the .cpp in place of the .py # That's stage 0, and it's enough if you get the source # from github and `python setup.py install it` # # *But* if you want to distribute the source through # `python setup.py sdist` then the .py no longer exists # and only the .cpp is distributed. That's stage 1 cxx_sources = [] for source in sources: base, ext = os.path.splitext(source) output_file = base + '.cpp' # target name # stage 0 when we have the .py if os.path.exists(source): stage = 0 # stage 1 otherwise. `.cpp' should already be there # as generated upon stage 0 else: assert os.path.exists(output_file) stage = 1 ext = '.cpp' source = output_file # stage-dependant processing if stage == 0: tc.compile_pythranfile(source, output_file, module_name=name, cpponly=True) cxx_sources.append(output_file) extension_args = cfg.make_extension() Extension.__init__(self, name, cxx_sources, **extension_args)
def __init__(self, source_dir, include_dirs, library_dirs): if winbuild: apr1 = 0 for dir in library_dirs: if os.path.exists(os.path.join(dir, 'libapr-1.lib')): apr1 = 1 if apr1: libraries = ['libhttpd', 'libapr-1', 'libaprutil-1', 'ws2_32'] else: libraries = ['libhttpd', 'libapr', 'libaprutil', 'ws2_32'] else: libraries = ['apr-0', 'aprutil-0'] Extension.__init__(self, "mod_python_so", sources = [os.path.join(source_dir, source_file) for source_file in modpy_src_files], include_dirs=include_dirs, libraries = libraries, library_dirs=library_dirs ) if winbuild: self.define_macros.extend([('WIN32', None),('NDEBUG', None),('_WINDOWS', None)]) self.sources.append(os.path.join(source_dir, "Version.rc")) else: # TODO: fix this to autodetect if required... self.include_dirs.append("/usr/include/apr-0") # this is a hack to prevent build_ext from trying to append "initmod_python" to the export symbols self.export_symbols = finallist(self.export_symbols)
def __init__(self): Extension.__init__(self, "audiotools.bitstream", sources=["src/mod_bitstream.c", "src/bitstream.c", "src/buffer.c", "src/func_io.c", "src/huffman.c"])
def __init__(self): Extension.__init__(self, 'audiotools.bitstream', sources=['src/mod_bitstream.c', 'src/bitstream.c', 'src/buffer.c', 'src/func_io.c', 'src/huffman.c'])
def __init__(self, system_libraries): """extra_link_args is a list of argument strings from pkg-config, or None if we're to use the standard libcdio libraries""" self.__library_manifest__ = [] sources = [] libraries = set() extra_compile_args = [] extra_link_args = [] if system_libraries.present("libcdio_paranoia"): if system_libraries.guaranteed_present("libcdio_paranoia"): libraries.update(set(["libcdio", "libcdio_cdda", "libcdio_paranoia"])) try: if tuple(int(s) for s in system_libraries.configfile.get( "Libraries", "libcdio_paranoia_version")) < (0, 90): paranoia_version = [("OLD_PARANOIA", None)] else: paranoia_version = [] except (KeyError, ValueError): paranoia_version = [] else: extra_compile_args.extend( system_libraries.extra_compile_args("libcdio_paranoia")) extra_link_args.extend( system_libraries.extra_link_args("libcdio_paranoia")) if system_libraries.lib_version("libcdio_paranoia") < (0, 90): paranoia_version = [("OLD_PARANOIA", None)] else: paranoia_version = [] sources.extend(["src/cdiomodule.c", "src/framelist.c", "src/pcm_conv.c"]) self.__library_manifest__.append(("libcdio", "CDDA data extraction", True)) else: self.__library_manifest__.append(("libcdio", "CDDA data extraction", False)) paranoia_version = [] Extension.__init__( self, "audiotools.cdio", sources=sources, libraries=list(libraries), extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, define_macros=paranoia_version)
def __init__(self, *args, **kw): # Add a custom 'target_desc' option, which matches CCompiler # (is there a better way? if "target_desc" in kw: self.target_desc = kw['target_desc'] del kw['target_desc'] else: self.target_desc = "executable" Extension.__init__(self, *args, **kw)
def __init__(self, name, sources, **kwds): Extension.__init__(self,name,sources,**kwds) if not hasattr(self, 'swig_opts'): # distutils < 2.4 self.swig_opts = [] dirs = self.include_dirs for source in sources: dir = os.path.dirname(source) if dir not in dirs: dirs.insert(0,dir)
def __init__(self, source_dir, include_dirs): Extension.__init__(self, "mod_python._psp", [os.path.join(source_dir, source_file) for source_file in ("psp_string.c", "psp_parser.c", "_pspmodule.c")], include_dirs=include_dirs ) if winbuild: self.define_macros.extend([('WIN32', None), ('NDEBUG', None), ('_WINDOWS', None)])
def __init__(self): Extension.__init__(self, 'audiotools.replaygain', sources=['src/replaygain.c', 'src/pcmconv.c', 'src/array.c', 'src/bitstream.c', 'src/buffer.c', 'src/func_io.c'])
def __init__(self): Extension.__init__(self, 'audiotools._ogg', sources=['src/ogg.c', 'src/ogg_crc.c', 'src/mod_ogg.c', 'src/bitstream.c', 'src/func_io.c', 'src/buffer.c'])
def __init__(self): Extension.__init__(self, "audiotools.replaygain", sources=["src/replaygain.c", "src/pcmconv.c", "src/array.c", "src/bitstream.c", "src/buffer.c", "src/func_io.c"])
def __init__(self): Extension.__init__(self, "audiotools._ogg", sources=["src/ogg.c", "src/ogg_crc.c", "src/mod_ogg.c", "src/bitstream.c", "src/func_io.c", "src/buffer.c"])
def __init__(self,*args,**kw): _Extension.__init__(self,*args,**kw) sources = [] for s in self.sources: if s.endswith('.pyx'): sources.append(s[:-3]+'c') else: sources.append(s) self.sources = sources
def __init__(self, *args, **kw): Extension.__init__(self, *args, **kw) if not has_cython: s = [] for f in self.sources: name = f[0 : -len("py")] s.append(name + "c") self.sources = s
def __init__(self, *args, **kwargs): Extension.__init__(self, *args, **kwargs) self.cython_directives = { 'c_string_encoding': 'utf-8', 'profile': 'USE_PROFILE' in os.environ, 'embedsignature': 'USE_EMBEDSIGNATURE' in os.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]
def __init__(self): Extension.__init__(self, "audiotools.bitstream", sources=["src/mod_bitstream.c", "src/bitstream.c", "src/buffer.c", "src/func_io.c", "src/mini-gmp.c", "src/huffman.c"], define_macros=[("HAS_PYTHON", None)])
def get_ext_modules(): if not cython_available: print 'nocy' eio_extension = Extension('eio', ['eio.c'], libraries=['pthread']) else: print 'cy' eio_extension = Extension('eio', ['eio.pyx'], libraries=['pthread']) eio_extension.configure = configure_eio return [eio_extension]
def __init__(self): Extension.__init__(self, "audiotools.replaygain", sources=["src/replaygain.c", "src/framelist.c", "src/pcmreader.c", "src/bitstream.c", "src/buffer.c", "src/func_io.c", "src/mini-gmp.c"], define_macros=[("HAS_PYTHON", None)])
classifiers = [ 'Development Status :: 5 - Production/Stable', 'Operating System :: POSIX :: Linux', 'License :: OSI Approved :: MIT License', 'Intended Audience :: Developers', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Topic :: Software Development', 'Topic :: Home Automation', 'Topic :: System :: Hardware' ] setup(name='RPi.GPIO', version='0.5.8', author='Ben Croston', author_email='*****@*****.**', description='A module to control Raspberry Pi GPIO channels', long_description=open('README.txt').read() + open('CHANGELOG.txt').read(), license='MIT', keywords='Raspberry Pi GPIO', url='http://sourceforge.net/projects/raspberry-gpio-python/', classifiers=classifiers, packages=['RPi'], ext_modules=[ Extension('RPi.GPIO', [ 'source/py_gpio.c', 'source/c_gpio.c', 'source/cpuinfo.c', 'source/event_gpio.c', 'source/soft_pwm.c', 'source/py_pwm.c', 'source/common.c', 'source/constants.c' ]) ])
## Uncomment below to measure reciprocal_to_normal_squared_openmp performance # define_macros = [('MEASURE_R2N', None)] ## ## This is for the test of libflame ## # use_libflame = False # if use_libflame: # sources.append('c/anharmonic/flame_wrapper.c') # extra_link_args.append('../libflame-bin/lib/libflame.a') # include_dirs_libflame = ['../libflame-bin/include'] # include_dirs += include_dirs_libflame extension_phono3py = Extension('anharmonic._phono3py', include_dirs=include_dirs, extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, define_macros=define_macros, sources=sources) packages_phono3py = [ 'anharmonic', 'anharmonic.other', 'anharmonic.phonon3', 'anharmonic.cui' ] scripts_phono3py = ['scripts/phono3py', 'scripts/kaccum', 'scripts/gaccum'] ######################## # _lapackepy extension # ######################## include_dirs_lapackepy = [ 'c/harmonic_h', ] + include_dirs_numpy sources_lapackepy = [
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from distutils.core import setup, Extension nmap = Extension('nmap', sources = ['nmap/nmap.py', 'nmap/__init__.py', 'nmap/example.py']) from nmap import * # Install : python setup.py install # Register : python setup.py register # platform = 'Unix', # download_url = 'http://xael.org/norman/python/python-nmap/', setup ( name = 'python-nmap', version = nmap.__version__, author = 'Alexandre Norman', author_email = '*****@*****.**', license ='gpl-3.0.txt', keywords="nmap, portscanner, network, sysadmin", # Get more strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers platforms=[ "Operating System :: OS Independent", ], classifiers=[ "Development Status :: 5 - Production/Stable", "Programming Language :: Python",
if platform == "linux" or platform == "linux2": environ[ "CC"] = v8_dir + '/third_party/llvm-build/Release+Asserts/bin/clang' environ[ "CXX"] = v8_dir + '/third_party/llvm-build/Release+Asserts/bin/clang++' libraries += ['rt'] library_dirs += [v8_dir + '/out/x64.release/obj.target/src'] elif platform == "darwin": library_dirs += [v8_dir + '/out/x64.release'] v8eval_module = Extension('_v8eval', sources=[py_v8eval_dir + '/v8eval_wrap.cxx'], libraries=libraries, include_dirs=include_dirs, library_dirs=library_dirs, extra_compile_args=['-O3', '-std=c++11']) # make description description = 'Run JavaScript engine V8 in Python' long_description = description try: import pypandoc long_description = pypandoc.convert('README.md', 'rst') except ImportError: pass # setup v8eval package setup(name='v8eval', version='0.2.11',
def read(*filenames): return open(os.path.join(os.path.dirname(__file__), *filenames)).read() setup(name = 'pyephem', version = __version__, description = 'Scientific-grade astronomy routines', long_description = read('README'), license = 'LGPL', author = 'Brandon Craig Rhodes', author_email = '*****@*****.**', url = 'http://rhodesmill.org/pyephem/', classifiers = [ 'Development Status :: 6 - Mature', 'Intended Audience :: Science/Research', 'License :: OSI Approved ::' ' GNU Library or Lesser General Public License (LGPL)', 'Topic :: Scientific/Engineering :: Astronomy', ], packages = [ 'ephem', 'ephem.tests' ], package_dir = { '': 'src' }, package_data = { 'ephem': ['doc/*.rst', 'tests/jpl/*.txt', 'tests/usno/*.txt', ],}, ext_modules = [ Extension('ephem._libastro', ['extensions/_libastro.c'] + libastro_files + libastro_data, include_dirs=['libastro-' + libastro_version], )], )
from distutils.core import setup, Extension module1 = Extension('usbrelay_py', libraries=['usbrelay'], library_dirs=['./', '/usr/lib', '/usr/lib64'], sources=['libusbrelay_py.c']) setup(name='usbrelay_py', version='1.0', description='USB Relay board control from Python', author="Sean Mollet", author_email="*****@*****.**", ext_modules=[module1])
return pybind11.get_include() except ImportError: print( "pybind11 not found. Please either install it manually, or install via pip rather than through setuptools directly." ) sys.exit(1) if dual_build: ext_modules = [ Extension( name='opentimspy_support', sources=[ join("opentims++", "sqlite", "sqlite3.c"), join("opentims++", "zstd", "zstddeclib.c") ], extra_compile_args=get_cflags(asan=False, warnings=False, std_flag=False), libraries='' if windows else 'pthread dl'.split(), include_dirs=[get_pybind_include()], ), Extension(name='opentimspy_cpp', sources=[ join("opentims++", "opentims_pybind11.cpp"), join("opentims++", "tof2mz_converter.cpp"), join("opentims++", "scan2inv_ion_mobility_converter.cpp"), ], extra_compile_args=get_cflags(asan=build_asan, std_flag=True), libraries='pthread dl'.split(),
from distutils.core import setup, Extension include_dirs = [] ext_modules = [] py_modules = ['fitfun_ctypes'] cmdclass = dict() try: import numpy as np except ImportError: pass else: include_dirs.append(np.get_include()) module_accel = Extension('accel', sources=['accelmodule.c']) module_fitfun = Extension('fitfun', sources=['fitfunmodule.c'], libraries=['fitfun']) ext_modules.extend([module_accel, module_fitfun]) try: import fitfun_cffi ext_modules.append(fitfun_cffi.ffi.verifier.get_extension()) py_modules.append('fitfun_cffi') except ImportError: pass try: from Cython.Distutils import build_ext
from distutils.core import setup, Extension module1 = Extension('fib', sources=['fibmodule.c']) setup(name='PackageName', version='1.0', description='This is a demo package', ext_modules=[module1])
from distutils.core import setup, Extension module1 = Extension( 'spam', # define_macros = [('MAJOR_VERSION', '1'), ('MINOR_VERSION', '0')], # include_dirs = ['/usr/local/include'], # libraries = [''], # library_dirs = ['/usr/local/lib'], sources=['spam.c']) setup(name='spam', version='1.0', description='This is a spam package', author='Martin v. Loewis', author_email='*****@*****.**', url='https://docs.python.org/extending/building', long_description='''This is really just a spam package.''', ext_modules=[module1])
from distutils.core import setup, Extension, os saga_module = Extension('_saga_api', sources=['saga_api_wrap.cxx'], include_dirs=['./'], library_dirs=[os.environ['SAGA_LIB']], libraries=['saga_api'], extra_compile_args=[ '-D_FILE_OFFSET_BITS=64', '-D_LARGE_FILES', '-D_LARGEFILE_SOURCE=1', '-D_TYPEDEF_BYTE', '-D_TYPEDEF_WORD', '-D_SAGA_API_EXPORTS', '-D_SAGA_PYTHON' ]) setup(name='SAGA Python API', version='1.0', description='', ext_modules=[saga_module])
from distutils.core import setup, Extension import os scws_dir = os.path.abspath("scws/libscws") scws_sources = [ "%s/%s" % (scws_dir, f) for f in [ "charset.c", "crc32.c", "darray.c", "lock.c", "pool.c", "rule.c", "scws.c", "xdb.c", "xdict.c", "xtree.c" ] ] scws_module = Extension(name='scws', sources=[ 'pyscws.c', ] + scws_sources, language='c', include_dirs=['/usr/include/python2.7', '.', scws_dir], library_dirs=['/usr/local/lib'], libraries=['python'], extra_compile_args=[]) setup( name='scws', version='0.0.1', url='http://code.google.com/p/pyscws/', description='a python package for scws', author_email= '[email protected], [email protected], [email protected]', ext_modules=[scws_module], packages=['scwsseg'], package_data={'scwsseg': ['data/*.txt', 'data/ext_stopword.dic']},
from sphinx.setup_command import BuildDoc cmdclass['build_sphinx'] = BuildDoc except ImportError: print('W: [python%s] Sphinx import error.' % sys.version[:3]) # The apt_pkg module. files = [ 'apt_pkgmodule.cc', 'acquire.cc', 'cache.cc', 'cdrom.cc', 'configuration.cc', 'depcache.cc', 'generic.cc', 'hashes.cc', 'hashstring.cc', 'indexfile.cc', 'indexrecords.cc', 'metaindex.cc', 'pkgmanager.cc', 'pkgrecords.cc', 'pkgsrcrecords.cc', 'policy.cc', 'progress.cc', 'sourcelist.cc', 'string.cc', 'tag.cc', 'lock.cc', 'acquire-item.cc', 'python-apt-helpers.cc', 'cachegroup.cc', 'orderlist.cc' ] files = sorted(['python/' + fname for fname in files], key=lambda s: s[:-3]) apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]) # The apt_inst module files = [ "python/apt_instmodule.cc", "python/generic.cc", "python/arfile.cc", "python/tarfile.cc" ] apt_inst = Extension("apt_inst", files, libraries=["apt-pkg", "apt-inst"]) # Replace the leading _ that is used in the templates for translation if len(sys.argv) > 1 and sys.argv[1] == "build": if not os.path.exists("build/data/templates/"): os.makedirs("build/data/templates") for template in glob.glob('data/templates/*.info.in'): source = open(template, "r") build = open("build/" + template[:-3], "w")
from distutils.core import setup, Extension module = Extension('myModule', sources=['myModule.c']) setup(name='PackageName', version='1.0', description='This is a package for myModule', ext_modules=[module])
from distutils.core import setup, Extension from Cython.Build import cythonize ext = Extension( "pylsh", sources=["clsh.pyx", "lsh.cpp"], language="c++", extra_compile_args=["-std=c++11", "-std=gnu++11"], ) setup( name="pylsh", ext_modules=cythonize(ext, language='c++'), )
from distutils.core import setup, Extension import string setup( name='obexftp', version='0.22', author='Christian Zuckschwerdt', author_email='*****@*****.**', url='http://www.openobex.org/', description='ObexFTP python bindings', download_url='http://triq.net/obexftp/', package_dir={'obexftp': '.'}, packages=['obexftp'], ext_package='obexftp', ext_modules=[ Extension( '_obexftp', ['python_wrap.c'], include_dirs=['../..'], extra_link_args=string.split( '-L../../obexftp/.libs -lobexftp -L../../multicobex/.libs -lmulticobex -L../../bfb/.libs -lbfb -lopenobex -lbluetooth -lbluetooth ' ), # static: extra_link_args = string.split('../../obexftp/.libs/libobexftp.a ../../multicobex/.libs/libmulticobex.a ../../bfb/.libs/libbfb.a -lopenobex -lbluetooth -lbluetooth '), ) ], )
HERE = os.path.abspath(os.path.dirname(__file__)) def get_description(): """Get long description.""" with open(os.path.join(HERE, 'README.rst'), 'r') as f: data = f.read() return data if sys.platform == "win32": extensions = [ Extension("menuinst.windows.winshortcut", sources=["menuinst/windows/winshortcut.cpp"], include_dirs=["menuinst"], libraries=[ "comctl32", "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32", "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32" ]) ] install_requires = ['pywin32'] else: extensions = [] install_requires = [] setup( name="menuinst", url="https://github.com/ContinuumIO/menuinst", version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), description="cross platform install of menu items",
from distutils.core import setup, Extension # # The directory in which the true bliss is hiding # blissdir = './bliss-0.50' # The essential bliss source files blisssrcs = [ 'graph.cc', 'heap.cc', 'orbit.cc', 'partition.cc', 'timer.cc', 'uintseqhash.cc' ] blisssrcs = [blissdir + '/' + src for src in blisssrcs] module1 = Extension('intpybliss', define_macros=[('MAJOR_VERSION', '0'), ('MINOR_VERSION', '50beta')], include_dirs=[blissdir], sources=['intpyblissmodule.cc'] + blisssrcs) setup( name='IntPyBliss', version='0.50beta', description='This is an internal PyBliss package', author='Tommi Junttila', #author_email = '', #url = 'http://www.python.org/doc/current/ext/building.html', long_description=''' This is an internal PyBliss package. Should never be used directly. ''', ext_modules=[module1])
from distutils.core import setup, Extension import os.path import sys cmatcher = Extension('cmatcher', sources=['cmatcher.c'], libraries=[], include_dirs=['../request'], library_dirs=[], extra_link_args=[], extra_compile_args=[]) setup(name='cmatcher', version='1.0', description='', ext_modules=[cmatcher])
from distutils.core import setup, Extension module1 = Extension('system_module', include_dirs=['./include/'], sources=['system_module_wrapper.c']) all_modules = [module1] setup(name='SystemModule', version='1.0', author="CongVM", author_email="*****@*****.**", description='This is a demo package', ext_modules=all_modules)
from distutils.core import setup, Extension from setuptools import find_packages import sysconfig extra_compile_args = sysconfig.get_config_var('CFLAGS').split() extra_compile_args += ["-std=c++11", "-Wall", "-Wextra", "-O3", "-fPIC", "-ffast-math", "-shared"] extra_compile_args = [e for e in extra_compile_args if e not in ['-O2']] trainer = Extension('train', sources = ['sompy3/train.cc'], language='c++11', extra_compile_args=extra_compile_args) # '/usr/local/lib' setup( name="SOMPY3", version="0.9", description="Self Organizing Maps Minimal Working Package", author="Andreas Loos", packages=find_packages(), install_requires=['numpy >= 1.7', 'scipy >= 0.9', 'scikit-learn >= 0.16', 'numexpr >= 2.5'], ext_modules = [trainer] )
from distutils.core import setup, Extension spam_module = Extension('spam', sources=['spammodule.c']) setup(name='Spam', version='1.0', description='Sample module.', ext_modules=[spam_module])
# Jython can't compile C extensions compile_extension = False if '__pypy__' in sys.builtin_module_names: # Pypy can't compile C extensions compile_extension = False if compile_extension: setup_args.update( dict( ext_modules=[ Extension( "coverage.tracer", sources=[ "coverage/ctracer/datastack.c", "coverage/ctracer/filedisp.c", "coverage/ctracer/module.c", "coverage/ctracer/tracer.c", ], ), ], cmdclass={ 'build_ext': ve_build_ext, }, )) # Py3.x-specific details. if sys.version_info >= (3, 0): setup_args.update(dict(use_2to3=False, ))
""" setup.py file for SWIG example """ from distutils.core import setup, Extension covid19_module = Extension( "_covid19", sources=[ "covid19_wrap.c", "constant.c", "demographics.c", "disease.c", "individual.c", "input.c", "interventions.c", "model.c", "network.c", "params.c", "utilities.c", ], extra_compile_args=[ "-g", "-Wall", "-fmessage-length=0", "-I$(INC);", "-O0" ], extra_link_args=["-lgsl", "-lgslcblas", "-lm", "-O3"], ) setup(name="covid19", version="0.1", author="SWIG Docs", description= """Individual-based model for modelling of a COVID-19 outbreak""",
from distutils.core import setup, Extension module = Extension('myModule', sources=['options.c', 'myapi.c', 'py_extension.c']) setup(name='ThePackageName', version='1.0', description='Python extension wrapping a command line tool', ext_modules=[module])
def create_ext_modules(src_dir): """Returns list of ext modules to be used in distutils.setup().""" # Submodules of the package to be installed # Only a path relative to the |src_dir| is needed modules = { 'mouse' : {'files' : ['autopy-mouse-module.c', 'mouse.c', 'deadbeef_rand.c', 'py-convenience.c', 'screen.c']}, 'bitmap' : {'files' : ['autopy-bitmap-module.c', 'py-convenience.c', 'py-bitmap-class.c', 'MMBitmap.c', 'io.c', 'bmp_io.c', 'png_io.c', 'str_io.c', 'snprintf.c', 'screengrab.c', 'screen.c', 'pasteboard.c', 'color_find.c', 'bitmap_find.c', 'UTHashTable.c', 'MMPointArray.c', 'zlib_util.c', 'base64.c', ], 'libraries' : ['png', 'z']}, 'color' : {'files' : ['autopy-color-module.c', 'MMBitmap.c']}, 'screen' : {'files' : ['autopy-screen-module.c', 'screen.c', 'screengrab.c', 'MMBitmap.c']}, 'key' : {'files' : ['autopy-key-module.c', 'keypress.c', 'keycode.c', 'deadbeef_rand.c', 'py-convenience.c']}, 'alert' : {'files' : ['autopy-alert-module.c', 'alert.c']} } # Global compilation/linkage flags. lflags = warning_flags = [] if not USE_WINDOWS: # gcc-specific flags warning_flags = [ '-Wall', '-Wparentheses', # '-Wsign-compare', '-Winline', '-Wbad-function-cast', '-Wdisabled-optimization', '-Wshadow', ] lflags = [ # '-std=c89', # '-pedantic', # Don't use gcc extensions ] cflags = lflags + warning_flags macros = [ # Remove assert()'s. ('NDEBUG', 1), # Determine endian-ness at runtime for C pre-processor at # pre-compile time :). ('MM_LITTLE_ENDIAN' if sys.byteorder == 'little' else 'MM_BIG_ENDIAN', None), ] libdirs = [] # Library dirs incdirs = [] # Include dirs # Parse platform-specific options if USE_MAC: def add_framework(module, framework): """Appends lflags module for linking to the given framework.""" module.setdefault('lflags', []).extend(['-framework', framework]) # Add frameworks for appropriate modules for module in 'mouse', 'key', 'alert': add_framework(modules[module], 'CoreFoundation') for module in 'mouse', 'key', 'screen', 'bitmap': add_framework(modules[module], 'ApplicationServices') for module in 'screen', 'bitmap': add_framework(modules[module], 'OpenGL') add_framework(modules['key'], 'Carbon') # Add OS X-specific #define's. macros.append(('IS_MACOSX', None)) elif USE_X11: for module in 'mouse', 'key', 'screen', 'bitmap': modules[module]['files'].append('xdisplay.c') modules[module].setdefault('libraries', []).append('X11') for module in 'mouse', 'key': modules[module].setdefault('libraries', []).append('Xtst') for dir in '/usr/X11/lib', '/usr/X1186/lib': if os.path.exists(dir): libdirs.append(dir) modules['alert']['files'].append('snprintf.c') # Add X11-specific #define's. macros.append(('USE_X11', None)) elif USE_WINDOWS: def add_lib(module_dict, lib): """Adds both standard and MSVC flag to link to library.""" modules[module].setdefault('libraries', []).append(lib) # The "libraries" option doesn't appear to cater to MSVC, so we # have to add this flag separately: modules[module].setdefault('lflags', []).append(lib + '.lib') for module in 'mouse', 'key', 'screen', 'bitmap', 'alert': add_lib(modules[module], 'user32') for module in 'screen', 'bitmap': add_lib(modules[module], 'Gdi32') # MSVC doesn't use same lib names as everybody else. for wrong_lib in 'png', 'z': modules['bitmap']['libraries'].remove(wrong_lib) for right_lib in 'libpng', 'zlib': add_lib(modules['bitmap'], right_lib) # We store Windows libraries and headers in our own custom folder. win_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'windows') # Libraries are statically compiled for their architecture. win_dir = os.path.join(win_dir, 'win64' if platform.architecture()[0] == '64bit' else 'win32') if not os.path.isdir(win_dir): raise IOError('windows directory not found at: "%s"' % win_dir) libdirs.append(win_dir) incdirs.append(win_dir) # Add Windows-specific macros. macros.extend([ ('IS_WINDOWS', None), # Ignore warnings for using standard C functions. ('_CRT_SECURE_NO_DEPRECATE', None), ]) # Define Extensions formally for distutils ext_modules = [] for key in modules: # Add src directory to module filenames attributes = modules[key] files = [os.path.join(src_dir, filename) for filename in attributes['files']] # Get module-specific args extra_link_args = attributes.get('lflags', []) + lflags libraries = attributes.get('libraries', []) ext_modules.append(Extension(name=key, sources=files, define_macros=macros, include_dirs=incdirs, library_dirs=libdirs, libraries=libraries, language='c', extra_compile_args=cflags, extra_link_args=extra_link_args)) return ext_modules
# -*- coding: utf-8 -*- from distutils.core import setup, Extension _sha3 = Extension('_sha3', include_dirs=['src/', 'src/64'], sources=[ 'sha3.c', 'src/KeccakHash.c', 'src/KeccakSponge.c', 'src/64/KeccakF-1600-opt64.c' ]) setup(name='_sha3', version='0.2', description='SHA-3 implementation for Python', author=u'Björn Edström', author_email='*****@*****.**', url='https://github.com/bjornedstrom/python-sha3', ext_modules=[_sha3], packages=['sha3'])
from distutils.core import setup, Extension VERSION = "0.8.1" # Remember to change netfilterqueue.pyx when version changes. try: # Use Cython from Cython.Distutils import build_ext cmd = {"build_ext": build_ext} ext = Extension( "netfilterqueue", sources=["netfilterqueue.pyx",], libraries=["netfilter_queue"], ) except ImportError: # No Cython cmd = {} ext = Extension( "netfilterqueue", sources = ["netfilterqueue.c"], libraries=["netfilter_queue"], ) setup( cmdclass = cmd, ext_modules = [ext], name="NetfilterQueue", version=VERSION, license="MIT", author="Matthew Fox", author_email="*****@*****.**", url="https://github.com/kti/python-netfilterqueue",
# coding=utf-8 # Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals from setuptools import setup, find_packages from distutils.core import Extension c_module = Extension(str('c_greet'), sources=[str('c_greet.c')]) cpp_module = Extension(str('cpp_greet'), sources=[str('cpp_greet.cpp')]) setup( name='fasthello', version='1.0.0', ext_modules=[c_module, cpp_module], packages=find_packages(), )
from distutils.core import setup, Extension import numpy.distutils.misc_util setup( ext_modules=[ Extension("_countTriplet", ["_countTriplet.c", "countTriplet.c"]) ], include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs(), )