示例#1
0
    def build_extension(self, ext: setuptools.Extension) -> None:
        ctx = cupy_builder.get_context()

        # Compile "*.cu" files into object files.
        sources_cpp, extra_objects = compile_device_code(ctx, ext)

        # Remove device code from list of sources, and instead add compiled
        # object files to link.
        ext.sources = sources_cpp  # type: ignore[attr-defined]
        ext.extra_objects += extra_objects  # type: ignore[attr-defined]

        # Let setuptools do the rest of the build process, i.e., compile
        # "*.cpp" files and link object files generated from "*.cu".
        super().build_extension(ext)
示例#2
0
            os.path.join(here, 'src', 'sha1.c'),
            os.path.join(here, 'src', 'sort.c'),
        ],
        extra_compile_args=['-std=c99'],
    ),
}

# collect extensions
for module, kwargs in modules.items():
    kwargs = dict(extension_kwargs, **kwargs)
    kwargs.setdefault('sources', [source_extension(module)])
    kwargs['sources'] = prepare_sources(kwargs['sources'])
    ext = Extension('{0}.{1}'.format(PACKAGE, module), **kwargs)
    if suffix == '.pyx' and ext.sources[0].endswith('.c'):
        # undo setuptools stupidly clobbering cython sources:
        ext.sources = kwargs['sources']
    extensions.append(ext)


#-----------------------------------------------------------------------------
# Description, version and other meta information.
#-----------------------------------------------------------------------------

re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
re_vers = re.compile(r'VERSION\s*=\s*\((.*?)\)')
re_doc = re.compile(r'^"""(.+?)"""')
rq = lambda s: s.strip("\"'")


def add_default(m):
    attr_name, attr_value = m.groups()
示例#3
0
文件: setup.py 项目: Youddha/pyart
            source_extension('tree'),
            os.path.join(here, 'src', 'art.c'),
        ],
        extra_compile_args=['-std=c99'],
    ),
}

# collect extensions
for module, kwargs in modules.items():
    kwargs = dict(extension_kwargs, **kwargs)
    kwargs.setdefault('sources', [source_extension(module)])
    kwargs['sources'] = prepare_sources(kwargs['sources'])
    ext = Extension('{0}.{1}'.format(PACKAGE, module), **kwargs)
    if suffix == '.pyx' and ext.sources[0].endswith('.c'):
        # undo setuptools stupidly clobbering cython sources:
        ext.sources = kwargs['sources']
    extensions.append(ext)

#-----------------------------------------------------------------------------
# Description, version and other meta information.
#-----------------------------------------------------------------------------

re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
re_vers = re.compile(r'VERSION\s*=\s*\((.*?)\)')
re_doc = re.compile(r'^"""(.+?)"""')
rq = lambda s: s.strip("\"'")


def add_default(m):
    attr_name, attr_value = m.groups()
    return ((attr_name, rq(attr_value)), )
示例#4
0
文件: setup.py 项目: loli/logdet
        'Environment :: Console',
        'Environment :: Other Environment',
        'Intended Audience :: Developers',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: GNU General Public License (GPL)',
        'Operating System :: POSIX',
        'Operating System :: Unix',
        'Programming Language :: Python',        
        'Programming Language :: Cython',
        'Programming Language :: C',
        'Topic :: Scientific/Engineering :: Mathematics',
        'Topic :: Software Development'
    ],
    
    'install_requires' : [
        "numpy >= 1.6.1",
    ],
                 
    'zip_safe' : False,
    
    # extention building part
    'ext_modules' : [logdet],
    'cmdclass' : {'build_ext': build_ext}
}

if not CYTHON_FOUND:
    logdet.sources = ['logdet/logdet.c']

setup(**configuration)