Beispiel #1
0
    def run(self):
        # Inline imports because we need setuptools to install this module first
        from Cython.Build import cythonize
        from Cython.Build.Dependencies import create_extension_list

        # Get a list of Extension objects from Cython
        source_files = create_extension_list(['**/*.pyx', '**/*.py'])[0]

        # A bug in the latest version of Cython makes it spit out these harmelss warnings; silence those
        for f in source_files:
            f.extra_compile_args = [
                '-Wno-unneeded-internal-declaration',
                '-Wno-unused-function'
            ]

        # Run the regular build_ext command with the Cythonized files
        self.extensions = cythonize(source_files)
        build_ext.run(self)
Beispiel #2
0
        from Cython.Compiler.Main import Context
        from Cython.Compiler.Options import CompilationOptions, default_options

        c_options = CompilationOptions(default_options)
        ctx = Context.from_options(c_options)
    except ImportError:
        from Cython.Compiler.Main import Context, CompilationOptions, default_options

        c_options = CompilationOptions(default_options)
        ctx = c_options.create_context()

    import glob
    pyx_files = glob.glob(os.path.join('src_c', 'cython', 'pygame', '*.pyx')) + \
                glob.glob(os.path.join('src_c', 'cython', 'pygame', '**', '*.pyx'))

    pyx_files, pyx_meta = create_extension_list(pyx_files, ctx=ctx)
    deps = create_dependency_tree(ctx)

    queue = []

    for ext in pyx_files:
        pyx_file = ext.sources[0]  # TODO: check all sources, extension

        c_file = os.path.splitext(pyx_file)[0].split(os.path.sep)
        del c_file[1:3]  # output in src_c/
        c_file = os.path.sep.join(c_file) + '.c'

        # update outdated .c files
        if os.path.isfile(c_file):
            c_timestamp = os.path.getmtime(c_file)
            if c_timestamp < deps.timestamp(pyx_file):
Beispiel #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Matěj Laitl <*****@*****.**>
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.

from Cython.Build.Dependencies import create_extension_list

from distutils.core import setup
from os.path import basename, dirname, join, splitext
import re

from support.dist import CeygenDistribution


modules = create_extension_list(["ceygen/*.pyx", "ceygen/tests/*.pyx"])
for module in modules:
    module.language = "c++"

# list of pxd files that belong to a corresponding module directly in the ceygen package
ceygen_pxds = [splitext(basename(m.sources[0]))[0] + ".pxd" for m in modules if re.match("ceygen\.[^.]*$", m.name)]

with open(join(dirname(__file__), "README.rst")) as file:
    long_description = file.read()

setup(
    packages=["ceygen", "ceygen.tests"],
    package_data={"ceygen": ceygen_pxds},
    distclass=CeygenDistribution,
    ext_modules=modules,
    include_dirs=["/usr/include/eigen3"],  # default overridable by setup.cfg
Beispiel #4
0
from Cython.Distutils import build_ext
from Cython.Build import cythonize
from Cython.Build.Dependencies import create_extension_list
#
libNADIAIncludeDir = os.path.join('..', '..', 'include')
libNADIALibDir = os.path.join('..', '..', 'lib')

# added gvr
libHDFIncludeDir = '/usr/local/hdf4/include'
libHDFLibDir = '/usr/local/hdf4/lib'

DoublePrecision = '0'

os.environ["LD_RUN_PATH"] = os.path.join('..', '..', 'lib')

modules = create_extension_list([os.path.join('pyNADIA', '*.pyx')])

for module in modules:
    module.language = "c++"
    module.include_dirs = [
        ".", libNADIAIncludeDir, libHDFIncludeDir, libHDFLibDir
    ]
    module.libraries = [
        'tiff', 'm', 'df', 'z', 'mfhdf', 'stdc++', 'jpeg', 'NADIA'
    ]
    module.library_dirs = [libNADIALibDir, libHDFLibDir]
    module.runtime_library_dirs = [libNADIALibDir]
    module.package = "pyNADIA"
    print module.name

setup(
Beispiel #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Matěj Laitl <*****@*****.**>
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.

from Cython.Build.Dependencies import create_extension_list

from distutils.core import setup
from os.path import basename, dirname, join, splitext
import re

from support.dist import CeygenDistribution


modules = create_extension_list(['ceygen/*.pyx', 'ceygen/tests/*.pyx'])
for module in modules:
    module.language = "c++"

# list of pxd files that belong to a corresponding module directly in the ceygen package
ceygen_pxds = [splitext(basename(m.sources[0]))[0] + '.pxd' for m in modules if re.match('ceygen\.[^.]*$', m.name)]

with open(join(dirname(__file__) ,'README.rst')) as file:
    long_description = file.read()

setup(
    packages=['ceygen', 'ceygen.tests'],
    package_data={'ceygen': ceygen_pxds},
    distclass=CeygenDistribution,
    ext_modules=modules,
    include_dirs=['/usr/include/eigen3'],  # default overridable by setup.cfg