Ejemplo n.º 1
0
            break
    else:
        raise RuntimeError(
            'unable to read the version from immutables/_version.py')

if platform.python_implementation() == 'CPython':
    if os.environ.get("DEBUG_IMMUTABLES") == '1':
        define_macros = []
        undef_macros = ['NDEBUG']
    else:
        define_macros = [('NDEBUG', '1')]
        undef_macros = []

    ext_modules = [
        setuptools.Extension("immutables._map", ["immutables/_map.c"],
                             extra_compile_args=CFLAGS,
                             define_macros=define_macros,
                             undef_macros=undef_macros)
    ]
else:
    ext_modules = []

with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
    readme = f.read()

setuptools.setup(
    name='immutables',
    version=VERSION,
    description='Immutable Collections',
    long_description=readme,
    python_requires='>=3.5',
    classifiers=[
Ejemplo n.º 2
0
    packages=setuptools.find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    install_requires=[
        'bibtexparser>=1.2.0',
        'tqdm>=4.46.0',
        'palettable>=3.3.0',
        'numba>=0.51.2',
        'plotly>=4.11.0',
        'nltk>=3.5',
        'matplotlib>=3.2.2',
        'ads>=0.12.3',
        'numpy>=1.19.1',
        'pytest>=6.0.1',
        'scipy>=1.5.0',
        'simple-augment>=1.0',
        'mock>=4.0.2',
        'pandas>=1.1.4',
        'verdict>=1.1.4',
    ],
    ext_modules = [
        setuptools.Extension(
            'cartography',
            [ './cc/backend/cartography.cpp' ],
        ),
    ],
)
Ejemplo n.º 3
0
import os, os.path, sys, glob

HERE = os.path.dirname(sys.argv[0]) or "."

if len(sys.argv) <= 1: sys.argv.append("install")

import setuptools

version = open(os.path.join(HERE,
                            "__init__.py")).read().split('VERSION = "',
                                                         1)[1].split('"', 1)[0]

try:
    import Cython.Build
    extensions = [
        setuptools.Extension("rdfxml_2_ntriples_pyx",
                             ["rdfxml_2_ntriples_pyx.pyx"]),
        setuptools.Extension("owlxml_2_ntriples_pyx",
                             ["owlxml_2_ntriples_pyx.pyx"]),
    ]
    extensions = Cython.Build.cythonize(extensions)
except:
    extensions = []

setuptools.setup(
    name="Owlready2",
    version=version,
    license="LGPLv3+",
    description=
    "A package for ontology-oriented programming in Python: load OWL 2.0 ontologies as Python objects, modify them, save them, and perform reasoning via HermiT. Includes an optimized RDF quadstore.",
    long_description=open(os.path.join(HERE, "README.rst")).read(),
    author="Lamy Jean-Baptiste (Jiba)",
Ejemplo n.º 4
0
    extras_require={
        "dev": ["check-manifest"],
        "test": ["pytest"],
    },
    package_data={},
    data_files=[],
    entry_points={  # Optional
        # "console_scripts": [
        #     "sample=sample:main",
        # ],
    },
    ext_modules=[
        setuptools.Extension(
            "fixprs.ext2",
            extra_compile_args=[
                "-std=c++17",
                "-UNDEBUG",  # FIXME
            ],
            include_dirs=[
                "./vendor/fast_double_parser/include",
                "./vendor/ThreadPool",
                *get_numpy_include_dirs(),
            ],
            sources=glob.glob("src/fixprs/ext2/*.cc"),
            library_dirs=[],
            libraries=[],
            depends=glob.glob("src/fixprs/ext2/*.hh"),
        ),
    ],
)
Ejemplo n.º 5
0
cmdclass = {
    'create_version': create_version,
    'cmake_build': cmake_build,
    'build_py': build_py,
    'develop': develop,
    'build_ext': build_ext,
    'typecheck': mypy_type_check,
}

################################################################################
# Extensions
################################################################################

ext_modules = [
    setuptools.Extension(name=str('onnx.onnx_cpp2py_export'), sources=[])
]

################################################################################
# Packages
################################################################################

# no need to do fancy stuff so far
packages = setuptools.find_packages()

install_requires.extend([
    'protobuf',
    'numpy',
    'six',
    'typing>=3.6.4',
    'typing-extensions>=3.6.2.1',
Ejemplo n.º 6
0
# to spam compiler output with it.
if sys.platform == 'win32':
    x_comp_args.update(['-DTHREADING', '-D_CRT_SECURE_NO_WARNINGS'])
else:
    x_comp_args.update(['-DTHREADING', '-Wno-deprecated-declarations'])

# Don't try to run swig on the ancient platforms
if swig_version(REQUIRED_SWIG_VERSION):
    lib_sources = ['SWIG/_m2crypto.i']
else:
    lib_sources = ['SWIG/_m2crypto_wrap.c']

m2crypto = setuptools.Extension(
    name='M2Crypto._m2crypto',
    sources=lib_sources,
    extra_compile_args=list(x_comp_args),
    # Uncomment to build Universal Mac binaries
    # extra_link_args =
    #     ['-Wl,-search_paths_first'],
)


class Clean(clean):
    def __init__(self, dist):
        clean.__init__(self, dist)

    def initialize_options(self):
        clean.initialize_options(self)
        self.all = True

    def finalize_options(self):
        clean.finalize_options(self)
Ejemplo n.º 7
0
                    'src/fortran/shadow_pre_sync.f90',
                    'src/fortran/shadow_pre_sync_urgent.f90',
                    'src/fortran/shadow_preprocessors.f90',
                    'src/fortran/shadow_postprocessors.f90',
                    'src/fortran/shadow_bind_f.f90',
                    'src/fortran/shadow_crl.f90',
                ],
                'macros': [(compile_options, 1)],
                'include_dirs': ['src/def', 'src/fortran', 'src/c'],
                # Can't use extra_compiler_args, because applied to all
                # compilers, and some flags are only used. See BuildClib
            }),
    ],
    cmdclass={
        'build_clib': BuildClib,
        'build_src': NullCommand,
    },
    install_requires=INSTALL_REQUIRES,
    ext_modules=[
        setuptools.Extension(
            name='Shadow.ShadowLib',
            sources=['src/c/shadow_bind_python.c'],
            include_dirs=['src/c', 'src/def',
                          numpy.get_include()],
            extra_link_args=extra_link_args,
            library_dirs=library_dirs,
            libraries=['shadow3c', 'gfortran'],
        ),
    ],
)
Ejemplo n.º 8
0
import setuptools
from os.path import dirname, isdir, join
import os
import re
import subprocess
import sys
sys.path.append('hdf5maker')
from version import get_version
with open("README.md", "r", encoding="utf-8") as fh:
    long_description = fh.read()

c_ext = setuptools.Extension(
    "_hdf5maker",
    sources=["src/raw_file.c", "src/hdf5maker.c"],
    libraries=[
        'c',
    ],
    #   include_dirs=[np.get_include(),],
    extra_compile_args=[],
)

setuptools.setup(
    name="hdf5maker",
    version='2021.3.10.dev0',
    author="Erik Frojdh",
    author_email="*****@*****.**",
    description="Eiger raw file to hdf5 converter",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/slsdetectorgroup/hdf5maker",
    packages=setuptools.find_packages(),
Ejemplo n.º 9
0
    def __str__(self):
        import pybind11

        return pybind11.get_include(self.user)


ext_modules = [
    setuptools.Extension(
        "nle.nethack.helper",
        ["win/rl/helper.cc"],
        include_dirs=[
            # Path to pybind11 headers
            get_pybind_include(),
            get_pybind_include(user=True),
            "include",
        ],
        language="c++",
        # Warning: This should stay in sync with the Makefiles, otherwise
        # off-by-one errors might happen. E.g. there's a MAIL deamon only
        # if the MAIL macro is set.
        extra_compile_args=["-DNOCLIPPING", "-DNOMAIL", "-DNOTPARMDECL"],
        # This requires `make`ing NetHack before.
        extra_link_args=["src/monst.o", "src/decl.o", "src/drawing.o"],
    )
]


class BuildExt(setuptools.command.build_ext.build_ext):
    """A custom build extension for adding compiler-specific options."""

    c_opts = {"msvc": ["/EHsc"], "unix": []}
Ejemplo n.º 10
0
import setuptools
import numpy

try:
    from Cython.Build import cythonize
    HAS_CYTHON = True
except ImportError:
    HAS_CYTHON = False

extensions = [
    setuptools.Extension('zplib.image._sample_texture',
                         sources=[
                             'zplib/image/_sample_texture.' +
                             ('pyx' if HAS_CYTHON else 'c')
                         ],
                         include_dirs=[numpy.get_include()])
]

if HAS_CYTHON:
    extensions = cythonize(extensions)

setuptools.setup(
    name='zplib',
    version='1.5',
    description='basic zplab tools',
    packages=setuptools.find_packages(),
    package_data={'zplab.image': ['_label_colors.npy']},
    ext_modules=extensions,
    install_requires=['cffi>=1.0.0', 'numpy', 'scipy'],
    setup_requires=['cffi>=1.0.0'],
    cffi_modules=[
Ejemplo n.º 11
0
    """
    Get setuptools command class
    :return:
    """
    setup_versioneer()
    clean_cache()
    import versioneer
    return versioneer.get_cmdclass()


with open('README.rst') as readme_file:
    readme = readme_file.read()

extensions = [
    setuptools.Extension(
        'pytriplib',
        sources=[os.path.join('pytrip', 'lib', 'filter_point.c')],
        extra_compile_args=['-fpic'])
]

setuptools.setup(
    name='pytrip98',
    version=get_version(),
    packages=setuptools.find_packages(exclude="tests"),
    url='https://github.com/pytrip/pytrip',
    license='GPL',
    author='Jakob Toftegaard, Niels Bassler, Leszek Grzanka',
    author_email='*****@*****.**',
    description='PyTRiP',
    long_description=readme + '\n',
    classifiers=[
        # How mature is this project? Common values are
Ejemplo n.º 12
0
Archivo: setup.py Proyecto: heginga/TC
    keywords=['openvswitch', 'ovs', 'OVSDB'],
    license='Apache 2.0',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Topic :: Database :: Front-Ends',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'Topic :: System :: Networking',
        'License :: OSI Approved :: Apache Software License',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
    ],
    ext_modules=[
        setuptools.Extension("ovs._json",
                             sources=["ovs/_json.c"],
                             libraries=['openvswitch'])
    ],
    cmdclass={'build_ext': try_build_ext},
)

try:
    setuptools.setup(**setup_args)
except BuildFailed:
    BUILD_EXT_WARNING = ("WARNING: The C extension could not be compiled, "
                         "speedups are not enabled.")
    print("*" * 75)
    print(BUILD_EXT_WARNING)
    print("Failure information, if any, is above.")
    print("Retrying the build without the C extension.")
    print("*" * 75)
Ejemplo n.º 13
0
libraries = []

d = prober.probe()

# Linux & FreeBSD require linking against the realtime libs
# This causes an error on other platforms
if "REALTIME_LIB_IS_NEEDED" in d:
    libraries.append("rt")

ext_modules = [
    distutools.Extension(
        "posix_ipc",
        source_files,
        libraries=libraries,
        depends=[
            "posix_ipc_module.c",
            "probe_results.h",
        ],
        # extra_compile_args=['-E']
    )
]

distutools.setup(name=name,
                 version=VERSION,
                 description=description,
                 long_description=long_description,
                 author=author,
                 author_email=author_email,
                 maintainer=maintainer,
                 url=url,
                 download_url=download_url,
Ejemplo n.º 14
0
def make_extensions(options, compiler, use_cython):
    """Produce a list of Extension instances which passed to cythonize()."""

    no_cuda = options['no_cuda']
    settings = build.get_compiler_setting()

    include_dirs = settings['include_dirs']

    settings['include_dirs'] = [
        x for x in include_dirs if path.exists(x)]
    settings['library_dirs'] = [
        x for x in settings['library_dirs'] if path.exists(x)]
    if sys.platform != 'win32':
        settings['runtime_library_dirs'] = settings['library_dirs']
    if sys.platform == 'darwin':
        args = settings.setdefault('extra_link_args', [])
        args.append(
            '-Wl,' + ','.join('-rpath,' + p
                              for p in settings['library_dirs']))
        # -rpath is only supported when targetting Mac OS X 10.5 or later
        args.append('-mmacosx-version-min=10.5')

    # This is a workaround for Anaconda.
    # Anaconda installs libstdc++ from GCC 4.8 and it is not compatible
    # with GCC 5's new ABI.
    settings['define_macros'].append(('_GLIBCXX_USE_CXX11_ABI', '0'))

    # In the environment with CUDA 7.5 on Ubuntu 16.04, gcc5.3 does not
    # automatically deal with memcpy because string.h header file has
    # been changed. This is a workaround for that environment.
    # See details in the below discussions:
    # https://github.com/BVLC/caffe/issues/4046
    # https://groups.google.com/forum/#!topic/theano-users/3ihQYiTRG4E
    settings['define_macros'].append(('_FORCE_INLINES', '1'))

    if options['linetrace']:
        settings['define_macros'].append(('CYTHON_TRACE', '1'))
        settings['define_macros'].append(('CYTHON_TRACE_NOGIL', '1'))
    if no_cuda:
        settings['define_macros'].append(('CUPY_NO_CUDA', '1'))

    ret = []
    for module in MODULES:
        print('Include directories:', settings['include_dirs'])
        print('Library directories:', settings['library_dirs'])

        if not no_cuda:
            err = False
            if not check_library(compiler,
                                 includes=module['include'],
                                 include_dirs=settings['include_dirs']):
                utils.print_warning(
                    'Include files not found: %s' % module['include'],
                    'Skip installing %s support' % module['name'],
                    'Check your CFLAGS environment variable')
                err = True
            elif not check_library(compiler,
                                   libraries=module['libraries'],
                                   library_dirs=settings['library_dirs']):
                utils.print_warning(
                    'Cannot link libraries: %s' % module['libraries'],
                    'Skip installing %s support' % module['name'],
                    'Check your LDFLAGS environment variable')
                err = True
            elif('check_method' in module and
                 not module['check_method'](compiler, settings)):
                err = True

            if err:
                if module['name'] == 'cuda':
                    raise Exception('Your CUDA environment is invalid. '
                                    'Please check above error log.')
                else:
                    # Other modules are optional. They are skipped.
                    continue

        s = settings.copy()
        if not no_cuda:
            s['libraries'] = module['libraries']

        if module['name'] == 'cusolver':
            compile_args = s.setdefault('extra_compile_args', [])
            link_args = s.setdefault('extra_link_args', [])
            # openmp is required for cusolver
            if compiler.compiler_type == 'unix' and sys.platform != 'darwin':
                # In mac environment, openmp is not required.
                compile_args.append('-fopenmp')
                link_args.append('-fopenmp')
            elif compiler.compiler_type == 'msvc':
                compile_args.append('/openmp')

        if not no_cuda and module['name'] == 'thrust':
            if build.get_nvcc_path() is None:
                utils.print_warning(
                    'Cannot find nvcc in PATH.',
                    'Skip installing thrust support.')
                continue

        for f in module['file']:
            name = module_extension_name(f)
            sources = module_extension_sources(f, use_cython, no_cuda)
            extension = setuptools.Extension(name, sources, **s)
            ret.append(extension)

    return ret
Ejemplo n.º 15
0
    if os.path.isdir("src"):
        shutil.rmtree("src")
    shutil.copytree("../src","src")

extra_compile_args = []
if ccompiler.get_default_compiler() == "msvc":
    extra_compile_args.append("/utf-8")
else:
    extra_compile_args.append('-std=c++11')


sxtwl_module = setuptools.Extension('_sxtwl',
                         include_dirs=['src'],
                         sources=['sxtwl_wrap.cxx',
                          'src/eph.cpp', 
                          'src/JD.cpp',
                          'src/SSQ.cpp',
                          'src/lunar.cpp',                      
                          ], 
                          extra_compile_args=extra_compile_args, 
)


setuptools.setup(
    name="sxtwl",
    version="1.0.8",
    author="yuangu",
    author_email="*****@*****.**",
    description="sxtwl_cpp warpper for python",
    long_description=long_description,
    long_description_content_type="text/markdown",
    license = "BSD",   
Ejemplo n.º 16
0
#!/usr/bin/env python

import setuptools
from Cython.Build import cythonize
import numpy as np
import glob

kwargs = {
    'include_dirs': [np.get_include()],
    'extra_compile_args': ['-O3', '-funroll-loops'],
    'extra_link_args': [],
    'language': 'c++',
    'define_macros': [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
}
extensions = [
    setuptools.Extension('data.' + name[5:-4], sources=[name], **kwargs)
    for name in glob.glob('data/*.pyx')
]
directives = {'profile': False}

ext_modules = cythonize(extensions,
                        annotate=True,
                        compiler_directives=directives)

setuptools.setup(ext_modules=ext_modules)
Ejemplo n.º 17
0
    'mahotas._interpolate':
    ['mahotas/_interpolate.cpp', 'mahotas/_filters.cpp'],
    'mahotas._labeled': ['mahotas/_labeled.cpp', 'mahotas/_filters.cpp'],
    'mahotas._morph': ['mahotas/_morph.cpp', 'mahotas/_filters.cpp'],
    'mahotas._thin': ['mahotas/_thin.cpp'],
    'mahotas.features._lbp': ['mahotas/features/_lbp.cpp'],
    'mahotas.features._surf': ['mahotas/features/_surf.cpp'],
    'mahotas.features._texture':
    ['mahotas/features/_texture.cpp', 'mahotas/_filters.cpp'],
    'mahotas.features._zernike': ['mahotas/features/_zernike.cpp'],
}

ext_modules = [
    setuptools.Extension(key,
                         sources=sources,
                         undef_macros=undef_macros,
                         define_macros=define_macros,
                         include_dirs=[numpy.get_include()])
    for key, sources in extensions.items()
]

packages = setuptools.find_packages()

package_dir = {
    'mahotas.tests': 'mahotas/tests',
    'mahotas.demos': 'mahotas/demos',
}
package_data = {
    'mahotas.tests': ['data/*'],
    'mahotas.demos': ['data/*'],
}
Ejemplo n.º 18
0
            opts.append("-msse4.2")
        opts.append("-O3")

        for ext in self.extensions:
            ext.extra_compile_args = opts
        build_ext.build_extensions(self)


check_build_dependencies()

ext_modules = [
    setuptools.Extension(
        'pyEM2',
        sources=glob.glob(os.path.join("src", "pyEM2*.cpp")) +
        (glob.glob("ExpressionMatrix2/src/*.cpp") if not IS_DEV_BUILD else []),
        include_dirs=get_include_dirs() +
        [os.path.join("ExpressionMatrix2", "src")],
        library_dirs=(["ExpressionMatrix2"] if IS_DEV_BUILD else []) +
        get_library_dirs(),
        libraries=(["em2"] if IS_DEV_BUILD else []) + get_libraries(),
        language="c++")
]

setuptools.setup(
    name='pyEM2',
    version=__version__,
    ext_modules=ext_modules,
    install_requires=['pybind11>=2.2'],
    cmdclass={'build_ext': BuildExt},
    zip_safe=False,
)
Ejemplo n.º 19
0
# we have to add the paths were g3log's .so files were installed, so that the linker can find them.
# alternatively, one could add an option to the /usr/bin/env command in each script:
#  -S LD_LIBRARY_PATH="/usr/local/lib64;/usr/local/lib"
# but the later solution is less convenient.
link_args.extend(['-Wl,-rpath=/usr/local/lib', '-Wl,-rpath=/usr/local/lib64'])

# https://docs.python.org/3/distutils/setupscript.html#describing-extension-modules
ext_modules = [
    setuptools.Extension(
        '_g3logPython',
        ['g3logPython/g3logPython.cpp'],
        include_dirs=[
            # Path to pybind11 headers
            get_pybind_include(),
            get_pybind_include(user=True),
            '/usr/local/include/',
        ],
        libraries=[
            'stdc++', 'g3log', 'g3logrotate', 'g3syslog', 'g3logBindings'
        ],
        extra_compile_args=compile_args,
        extra_link_args=link_args,
        language='c++'),
]

#
for sE in ext_modules:
    print('Extension ', sE.name)
    print('    libraries: ', sE.libraries)
    print('    extra link args: ', sE.extra_link_args)
Ejemplo n.º 20
0
def make_extensions(options, compiler, use_cython):
    """Produce a list of Extension instances which passed to cythonize()."""

    no_cuda = options['no_cuda']
    settings = build.get_compiler_setting()

    include_dirs = settings['include_dirs']

    settings['include_dirs'] = [
        x for x in include_dirs if path.exists(x)]
    settings['library_dirs'] = [
        x for x in settings['library_dirs'] if path.exists(x)]

    # Adjust rpath to use CUDA libraries in `cupy/_lib/*.so`) from CuPy.
    use_wheel_libs_rpath = (
        0 < len(options['wheel_libs']) and not PLATFORM_WIN32)

    # This is a workaround for Anaconda.
    # Anaconda installs libstdc++ from GCC 4.8 and it is not compatible
    # with GCC 5's new ABI.
    settings['define_macros'].append(('_GLIBCXX_USE_CXX11_ABI', '0'))

    # In the environment with CUDA 7.5 on Ubuntu 16.04, gcc5.3 does not
    # automatically deal with memcpy because string.h header file has
    # been changed. This is a workaround for that environment.
    # See details in the below discussions:
    # https://github.com/BVLC/caffe/issues/4046
    # https://groups.google.com/forum/#!topic/theano-users/3ihQYiTRG4E
    settings['define_macros'].append(('_FORCE_INLINES', '1'))

    if options['linetrace']:
        settings['define_macros'].append(('CYTHON_TRACE', '1'))
        settings['define_macros'].append(('CYTHON_TRACE_NOGIL', '1'))
    if no_cuda:
        settings['define_macros'].append(('CUPY_NO_CUDA', '1'))

    available_modules = []
    if no_cuda:
        available_modules = [m['name'] for m in MODULES]
    else:
        available_modules = preconfigure_modules(compiler, settings)
        if 'cuda' not in available_modules:
            raise Exception('Your CUDA environment is invalid. '
                            'Please check above error log.')

    ret = []
    for module in MODULES:
        if module['name'] not in available_modules:
            continue

        s = settings.copy()
        if not no_cuda:
            s['libraries'] = module['libraries']

        compile_args = s.setdefault('extra_compile_args', [])
        link_args = s.setdefault('extra_link_args', [])

        if module['name'] == 'cusolver':
            compile_args = s.setdefault('extra_compile_args', [])
            link_args = s.setdefault('extra_link_args', [])
            # openmp is required for cusolver
            if compiler.compiler_type == 'unix' and not PLATFORM_DARWIN:
                # In mac environment, openmp is not required.
                compile_args.append('-fopenmp')
                link_args.append('-fopenmp')
            elif compiler.compiler_type == 'msvc':
                compile_args.append('/openmp')

        for f in module['file']:
            name = module_extension_name(f)

            rpath = []
            if not options['no_rpath']:
                # Add library directories (e.g., `/usr/local/cuda/lib64`) to
                # RPATH.
                rpath += s['library_dirs']

            if use_wheel_libs_rpath:
                # Add `cupy/_lib` (where shared libraries included in wheels
                # reside) to RPATH.
                # The path is resolved relative to the module, e.g., use
                # `$ORIGIN/_lib` for `cupy/cudnn.so` and `$ORIGIN/../_lib` for
                # `cupy/cuda/cudnn.so`.
                depth = name.count('.') - 1
                rpath.append('{}{}/_lib'.format(_rpath_base(), '/..' * depth))

            if not PLATFORM_WIN32:
                s['runtime_library_dirs'] = rpath
            if PLATFORM_DARWIN:
                args = s.setdefault('extra_link_args', [])
                args.append(
                    '-Wl,' + ','.join('-rpath,' + p
                                      for p in s['library_dirs']))
                # -rpath is only supported when targetting Mac OS X 10.5 or
                # later
                args.append('-mmacosx-version-min=10.5')

            sources = module_extension_sources(f, use_cython, no_cuda)
            extension = setuptools.Extension(name, sources, **s)
            ret.append(extension)

    return ret
Ejemplo n.º 21
0
#!/usr/bin/env python

import os
import sys

import distutils.errors
import setuptools

if not hasattr(sys, "hexversion") or sys.hexversion < 0x02040000:
    raise distutils.errors.DistutilsError("Python 2.4 or newer is required")

if os.name == "posix":
    from setup_posix import get_config
else:  # assume windows
    from setup_windows import get_config

metadata, options = get_config()
metadata['ext_modules'] = [
    setuptools.Extension(sources=['_mysql.c'], **options)
]
metadata['long_description'] = metadata['long_description'].replace(r'\n', '')
setuptools.setup(**metadata)
Ejemplo n.º 22
0
        c.set("build-system", 'build-backend', '"setuptools.build_meta"')
        with open("pyproject.toml", "w") as pyproject:
            c.write(pyproject)
        # run the rest of the packaging
        _sdist.run(self)


class build_ext(_build_ext):
    """A `build_ext` that disables optimizations if compiled in debug mode.
    """
    def build_extension(self, ext):
        if self.debug:
            ext.extra_compile_args.append("-O0")
            if sys.implementation.name == "cpython":
                ext.define_macros.append(("CYTHON_TRACE_NOGIL", 1))
        _build_ext.build_extension(self, ext)


setuptools.setup(
    cmdclass=dict(sdist=sdist, build_ext=build_ext),
    ext_modules=cythonize(
        setuptools.Extension(
            "pyhcrf._algorithms",
            ["pyhcrf/_algorithms.pyx"],
            include_dirs=[numpy.get_include()],
            extra_compile_args=["-Wall"],
        ),
        annotate=True,
    ),
)
Ejemplo n.º 23
0
else:
    folder = "mac"  # OS is Mac

sources = []
for c_source_file in os.listdir(folder):  # Walk the folder with C files.
    if c_source_file.endswith(".c"):  # Collect all C files.
        sources.append(str(pathlib.Path(folder) / c_source_file))


class NoSuffixBuilder(build_ext):
    def get_ext_filename(self, ext_name):  # NO Suffix
        filename = super().get_ext_filename(ext_name)
        return filename.replace(sysconfig.get_config_var('EXT_SUFFIX'),
                                "") + pathlib.Path(filename).suffix


setuptools.setup(cmdclass={"build_ext": NoSuffixBuilder},
                 ext_modules=[
                     setuptools.Extension(
                         name="faster_than_requests",
                         sources=sources,
                         include_dirs=[folder],
                         extra_link_args=["-s"],
                         extra_compile_args=[
                             "-flto", "-ffast-math", "-march=native",
                             "-mtune=native", "-O3",
                             "-fsingle-precision-constant"
                         ],
                     )
                 ])
Ejemplo n.º 24
0
import os
import shutil
import setuptools

# NOTE: You must run cython --cplus ./ext/src/third_party/mc/_mesher.pyx before setup
# if _mesher.cpp does not exist.

third_party_dir = './ext/third_party'

setuptools.setup(
    setup_requires=['pbr'],
    pbr=True,
    ext_modules=[
        setuptools.Extension(
            'igneous._mesher',
            sources=[
                os.path.join(third_party_dir, name)
                for name in ('mc/_mesher.cpp', 'mc/cMesher.cpp')
            ],
            depends=[os.path.join(third_party_dir, 'mc/cMesher.h')],
            language='c++',
            include_dirs=[
                os.path.join(third_party_dir, name)
                for name in ('zi_lib/', 'mc/')
            ],
            extra_compile_args=[
                '-std=c++11', '-O3'
            ])  #don't use  '-fvisibility=hidden', python can't see init module
    ],
)
Ejemplo n.º 25
0
    description='An asyncio PosgtreSQL driver',
    classifiers=[
        'License :: OSI Approved :: Apache Software License',
        'Intended Audience :: Developers',
        'Programming Language :: Python :: 3 :: Only',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Operating System :: POSIX',
        'Operating System :: MacOS :: MacOS X',
        'Operating System :: Microsoft :: Windows',
        'Development Status :: 4 - Beta',
    ],
    platforms=['POSIX'],
    author='MagicStack Inc',
    author_email='*****@*****.**',
    license='Apache License, Version 2.0',
    packages=['asyncpg'],
    provides=['asyncpg'],
    include_package_data=True,
    ext_modules=[
        setuptools.Extension(
            "asyncpg.protocol.protocol",
            ["asyncpg/protocol/record/recordobj.c",
             "asyncpg/protocol/protocol.pyx"],
            extra_compile_args=CFLAGS,
            extra_link_args=LDFLAGS)
    ],
    cmdclass={'build_ext': build_ext},
    test_suite='setup.discover_tests',
)
Ejemplo n.º 26
0
# TODO Can we remove any of these?
python_required = [
    'matplotlib',
    'meshcat',
    'numpy',
    'pydot',
    'PyYAML',
    'scipy',
]

if os.uname()[0].lower() == 'linux':
    # This is intended to help force a binary, rather than platform-agnostic,
    # wheel, but only works on Ubuntu; clang is not happy about being asked to
    # make a library with no sources.
    ext_modules = [
        setuptools.Extension(name='drake',
                             sources=[]),
    ]
else:
    ext_modules = []


# Distribution which always forces a binary package with platform name.
class BinaryDistribution(Distribution):
    def is_pure(self):
        return False

    def has_ext_modules(self):
        return True


def find_data_files(*patterns):
Ejemplo n.º 27
0
import os, os.path, sys, glob

HERE = os.path.dirname(sys.argv[0]) or "."

if len(sys.argv) <= 1: sys.argv.append("install")

import setuptools

version = open(os.path.join(HERE,
                            "__init__.py")).read().split('VERSION = "',
                                                         1)[1].split('"', 1)[0]

try:
    import Cython.Build
    extensions = [
        setuptools.Extension("owlready2_optimized",
                             ["owlready2_optimized.pyx"]),
    ]
    extensions = Cython.Build.cythonize(
        extensions, compiler_directives={"language_level": 3})
except:
    extensions = []

setuptools.setup(
    name="Owlready2",
    version=version,
    license="LGPLv3+",
    description=
    "A package for ontology-oriented programming in Python: load OWL 2.0 ontologies as Python objects, modify them, save them, and perform reasoning via HermiT. Includes an optimized RDF quadstore.",
    long_description=open(os.path.join(HERE, "README.rst")).read(),
    author="Lamy Jean-Baptiste (Jiba)",
    author_email="*****@*****.**",
Ejemplo n.º 28
0
long_description = (root_dir / 'README.rst').read_text(encoding='utf-8')

exec((root_dir / 'src' / 'websockets' / 'version.py').read_text(encoding='utf-8'))

py_version = sys.version_info[:2]

if py_version < (3, 6):
    raise Exception("websockets requires Python >= 3.6.")

packages = ['websockets', 'websockets/extensions']

ext_modules = [
    setuptools.Extension(
        'websockets.speedups',
        sources=['src/websockets/speedups.c'],
        optional=not (root_dir / '.cibuildwheel').exists(),
    )
]

setuptools.setup(
    name='websockets',
    version=version,
    description=description,
    long_description=long_description,
    url='https://github.com/aaugustin/websockets',
    author='Aymeric Augustin',
    author_email='*****@*****.**',
    license='BSD',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
Ejemplo n.º 29
0
    external_deps_dir = os.environ['RL_PYTHON_EXT_DEPS']
else:
    print(
        "RL_PYTHON_EXT_DEPS environment variable must be set with the path to retrieve dependencies from"
    )
    sys.exit(1)

extension_module = setuptools.Extension(
    'rl_client._rl_client',
    sources=glob.glob('*.cc'),
    library_dirs=[],
    include_dirs=['../../include/'],
    libraries=['pthread', 'dl'],
    extra_compile_args=['-std=c++11'],
    extra_objects=[
        '../../build/rlclientlib/librlclientlib.a',
        '../../build/ext_libs/vowpal_wabbit/vowpalwabbit/libvw.a',
        '../../build/ext_libs/vowpal_wabbit/vowpalwabbit/liballreduce.a',
        external_deps_dir + 'libcpprest.a',
        external_deps_dir + 'libboost_system.a',
        external_deps_dir + 'libboost_program_options.a',
        external_deps_dir + 'libssl.a', external_deps_dir + 'libcrypto.a',
        external_deps_dir + 'libz.a'
    ])

setuptools.setup(
    version='0.1.2',
    name='rl_client',
    url='https://github.com/JohnLangford/vowpal_wabbit',
    description='Python binding for reinforcement learning client library',
    long_description=long_description,
Ejemplo n.º 30
0
 description='Python CLIF hidden_base example',
 url='https://github.com/google/clif',
 author='CLIF authors',
 author_email='*****@*****.**',
 install_requires=['enum34;python_version<"3.4"'],
 ext_modules=[
     setuptools.Extension(
         'hidden_base',
         [
             # CLIF-generated sources
             'python/hidden_base.cc',
             'python/hidden_base_init.cc',
             # 'clif_runtime',
             user_home + '/opt/clif/python/runtime.cc',
             user_home + '/opt/clif/python/slots.cc',
             user_home + '/opt/clif/python/types.cc',
         ],
         include_dirs=[
             # Path to clif runtime headers
             user_home + '/opt',
             # Path to examples in CLIF installation.
             user_home + '/opt/clif/examples',
         ],
         extra_compile_args=['-std=c++11'],
     ),
     setuptools.Extension(
         'base',
         [
             # CLIF-generated sources
             'python/base.cc',
             'python/base_init.cc',