# building, rather than unconditionally in the setup.py import or exec # We may make tripwire versions of build_ext, build_py, install try: from nisext.sexts import package_check, get_comrec_build except ImportError: # No nibabel msg = ('Need nisext package from nibabel installation' ' - please install nibabel first') pybuilder = derror_maker(build_py.build_py, msg) extbuilder = derror_maker(build_ext.build_ext, msg) def package_check(*args, **kwargs): raise RuntimeError(msg + " or try 'python setup_egg.py install'") else: # We have nibabel pybuilder = get_comrec_build('dipy') # Cython is a dependency for building extensions, iff we don't have stamped # up pyx and c files. build_ext = cyproc_exts(EXTS, CYTHON_MIN_VERSION, 'pyx-stamps') # Add openmp flags if they work simple_test_c = """int main(int argc, char** argv) { return(0); }""" omp_test_c = """#include <omp.h> int main(int argc, char** argv) { return(0); }""" extbuilder = add_flag_checking( build_ext, [[['/arch:SSE2'], [], simple_test_c, 'USING_VC_SSE2'], [['-msse2', '-mfpmath=sse'], [], simple_test_c, 'USING_GCC_SSE2'], [['-fopenmp'], ['-fopenmp'], omp_test_c, 'HAVE_OPENMP']], 'dipy') # Installer that checks for install-time dependencies class installer(install.install): def run(self): package_check('numpy', NUMPY_MIN_VERSION) package_check('scipy', SCIPY_MIN_VERSION) package_check('nibabel', NIBABEL_MIN_VERSION)
'selectinf.algorithms.cox_utils', ['selectinf/algorithms/cox_utils.pyx', 'C-software/src/cox_fns.c'], libraries=[], include_dirs=['C-software/src'])) EXTS.append( Extension('selectinf.randomized.selective_MLE_utils', [ 'selectinf/randomized/selective_MLE_utils.pyx', 'C-software/src/selective_mle.c', 'C-software/src/cox_fns.c' ], libraries=[], include_dirs=['C-software/src'])) # Cython is a dependency for building extensions, iff we don't have stamped # up pyx and c files. build_ext, need_cython = cyproc_exts(EXTS, info.CYTHON_MIN_VERSION, 'pyx-stamps') # Add numpy includes when building extension. build_ext = make_np_ext_builder(build_ext) # Check dependencies, maybe add to setuptools lists if need_cython: SetupDependency('Cython', info.CYTHON_MIN_VERSION, req_type='install_requires', heavy=False).check_fill(extra_setuptools_args) SetupDependency('numpy', info.NUMPY_MIN_VERSION, req_type='install_requires', heavy=True).check_fill(extra_setuptools_args) SetupDependency('scipy',
EXTS.append(Extension(modulename, [pyx_src] + other_sources, language=language, **deepcopy(ext_kwargs))) # deepcopy lists # Do our own build and install time dependency checking. setup.py gets called in # many different ways, and may be called just to collect information (egg_info). # We need to set up tripwires to raise errors when actually doing things, like # building, rather than unconditionally in the setup.py import or exec # We may make tripwire versions of build_ext, build_py, install need_cython = True pybuilder = get_comrec_build('dipy') # Cython is a dependency for building extensions, iff we don't have stamped # up pyx and c files. build_ext, need_cython = cyproc_exts(EXTS, info.CYTHON_MIN_VERSION, 'pyx-stamps') # Add openmp flags if they work simple_test_c = """int main(int argc, char** argv) { return(0); }""" omp_test_c = """#include <omp.h> int main(int argc, char** argv) { return(0); }""" extbuilder = add_flag_checking( build_ext, [ [['/arch:SSE2'], [], simple_test_c, 'USING_VC_SSE2'], [['-msse2', '-mfpmath=sse'], [], simple_test_c, 'USING_GCC_SSE2'], [['-fopenmp'], ['-fopenmp'], omp_test_c, 'HAVE_OPENMP']], 'dipy') # Use ext builder to add np.get_include() at build time, not during setup.py # execution. extbuilder = make_np_ext_builder(extbuilder) if need_cython:
from cythexts import cyproc_exts, get_pyx_sdist # Check this version is tested in .travis.yml CYTHON_MIN_VERSION="0.18" ext_modules = [Extension("x86cpu.cpuinfo", [pjoin(*parts) for parts in ( ['x86cpu', 'cpuinfo.pyx'], ['libx86cpu', 'cpuinfo.c'], ['libx86cpu', 'cpuid.c'], ['libx86cpu', 'os_restores_ymm.c'])], include_dirs = ['libx86cpu'])] # Cython is a dependency for building extensions, iff we don't have stamped up # pyx and c files. build_ext, need_cython = cyproc_exts(ext_modules, CYTHON_MIN_VERSION, 'pyx-stamps') cmdclass['build_ext'] = build_ext cmdclass['sdist'] = get_pyx_sdist(cmdclass['sdist']) setup( version=versioneer.get_version(), cmdclass=cmdclass, description='Collect information about x86 CPU', name = 'x86cpu', ext_modules = ext_modules, packages = ['x86cpu', 'x86cpu.tests'], author='Matthew Brett', author_email='*****@*****.**', maintainer='Matthew Brett',
# Do our own build and install time dependency checking. setup.py gets called in # many different ways, and may be called just to collect information (egg_info). # We need to set up tripwires to raise errors when actually doing things, like # building, rather than unconditionally in the setup.py import or exec # We may make tripwire versions of build_ext, build_py, install try: from nisext.sexts import package_check, get_comrec_build except ImportError: # No nibabel msg = "Need nisext package from nibabel installation" " - please install nibabel first" pybuilder = derror_maker(build_py.build_py, msg) extbuilder = derror_maker(build_ext.build_ext, msg) else: # We have nibabel pybuilder = get_comrec_build("dipy") # Cython is a dependency for building extensions, iff we don't have stamped # up pyx and c files. extbuilder = cyproc_exts(EXTS, CYTHON_MIN_VERSION, "pyx-stamps") # Installer that checks for install-time dependencies class installer(install.install): def run(self): package_check("numpy", NUMPY_MIN_VERSION) package_check("scipy", SCIPY_MIN_VERSION) package_check("nibabel", NIBABEL_MIN_VERSION) install.install.run(self) cmdclass = dict( build_py=pybuilder, build_ext=extbuilder, install=installer, install_scripts=install_scripts_bat,
# Check this version is tested in .travis.yml CYTHON_MIN_VERSION = "0.18" ext_modules = [ Extension("x86cpu.cpuinfo", [ pjoin(*parts) for parts in (['x86cpu', 'cpuinfo.pyx'], ['libx86cpu', 'cpuinfo.c'], ['libx86cpu', 'cpuid.c'], ['libx86cpu', 'os_restores_ymm.c']) ], include_dirs=['libx86cpu']) ] # Cython is a dependency for building extensions, iff we don't have stamped up # pyx and c files. build_ext, need_cython = cyproc_exts(ext_modules, CYTHON_MIN_VERSION, 'pyx-stamps') cmdclass['build_ext'] = build_ext cmdclass['sdist'] = get_pyx_sdist(cmdclass['sdist']) setup( version=versioneer.get_version(), cmdclass=cmdclass, description='Collect information about x86 CPU', name='x86cpu', ext_modules=ext_modules, packages=['x86cpu', 'x86cpu.tests'], author='Matthew Brett', author_email='*****@*****.**', maintainer='Matthew Brett', maintainer_email='*****@*****.**', url='http://github.com/matthew-brett/x86cpu',