# 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) 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):
if os.path.exists('MANIFEST'): os.remove('MANIFEST') # For some commands, use setuptools. if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', 'egg_info', 'easy_install', )).intersection(sys.argv)) > 0: # setup_egg imports setuptools setup, thus monkeypatching distutils. import setup_egg from distutils.core import setup # Python 2 to 3 build from nisext.py3builder import build_py # Commit hash writing, and dependency checking from nisext.sexts import get_comrec_build, package_check cmdclass = {'build_py': get_comrec_build('nibabel', build_py)} # Get version and release info, which is all stored in nibabel/info.py ver_file = os.path.join('nibabel', 'info.py') exec(open(ver_file).read()) # Do dependency checking package_check('numpy', NUMPY_MIN_VERSION) custom_pydicom_messages = {'missing opt': 'Missing optional package "%s"' ' provided by package "pydicom"' } package_check('dicom', PYDICOM_MIN_VERSION, optional=True, messages = custom_pydicom_messages) extra_setuptools_args = {}
# For some commands, use setuptools. if len( set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', 'install_egg_info', 'egg_info', 'easy_install', 'bdist_wheel', 'bdist_mpkg')).intersection(sys.argv)) > 0: # setup_egg imports setuptools setup, thus monkeypatching distutils. import setup_egg # noqa from distutils.core import setup # Commit hash writing, and dependency checking from nisext.sexts import get_comrec_build, package_check, install_scripts_bat cmdclass = { 'build_py': get_comrec_build('nibabel'), 'install_scripts': install_scripts_bat } # Get version and release info, which is all stored in nibabel/info.py ver_file = os.path.join('nibabel', 'info.py') exec(open(ver_file).read()) # Prepare setuptools args if 'setuptools' in sys.modules: extra_setuptools_args = dict( tests_require=['nose'], test_suite='nose.collector', zip_safe=False, extras_require=dict(doc='Sphinx>=0.3', test='nose>=0.10.1'), )
if os.path.exists('MANIFEST'): os.remove('MANIFEST') # For some commands, use setuptools. if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', 'install_egg_info', 'egg_info', 'easy_install', 'bdist_wheel', 'bdist_mpkg')).intersection(sys.argv)) > 0: # setup_egg imports setuptools setup, thus monkeypatching distutils. import setup_egg # noqa from distutils.core import setup # Commit hash writing, and dependency checking from nisext.sexts import (get_comrec_build, package_check, install_scripts_bat, read_vars_from) cmdclass = {'build_py': get_comrec_build('nibabel'), 'install_scripts': install_scripts_bat} # Get project related strings. INFO = read_vars_from(pjoin('nibabel', 'info.py')) # Prepare setuptools args if 'setuptools' in sys.modules: extra_setuptools_args = dict( tests_require=['nose'], test_suite='nose.collector', zip_safe=False, extras_require=dict( doc='Sphinx>=0.3', test='nose>=0.10.1'), )
from distutils.core import setup from distutils.extension import Extension # extra_setuptools_args can be defined from the line above, but it can # also be defined here because setup.py has been exec'ed from # setup_egg.py. if not 'extra_setuptools_args' in globals(): extra_setuptools_args = dict() # Import build helpers try: from nisext.sexts import package_check, get_comrec_build except ImportError: raise RuntimeError('Need nisext package from nibabel installation' ' - please install nibabel first') cmdclass = {'build_py': get_comrec_build('dipy')} # Get version and release info, which is all stored in dipy/info.py ver_file = os.path.join('dipy', 'info.py') execfile(ver_file) # We're running via setuptools - specify exta setuptools stuff if 'setuptools' in sys.modules: extra_setuptools_args['extras_require'] = dict( doc=['Sphinx>=1.0'], test=['nose>=0.10.1'], ) # I removed numpy and scipy from install requires because easy_install seems # to want to fetch these if they are already installed, meaning of course # that there's a long fragile and unnecessary compile before the install # finishes.
""" import sys from glob import glob # Import build helpers try: from nisext.sexts import package_check, get_comrec_build except ImportError: raise RuntimeError('Need nisext package from nibabel installation' ' - please install nibabel first') from build_docs import cmdclass, INFO_VARS # Add custom commit-recording build command cmdclass['build_py'] = get_comrec_build('bips') def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options(ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True) # The quiet=True option will silence all of the name setting warnings: # Ignoring attempt to set 'name' (from 'nipy.core' to # 'nipy.core.image') # Robert Kern recommends setting quiet=True on the numpy list, stating # these messages are probably only used in debugging numpy distutils.
# Import build helpers try: from nisext.sexts import package_check, get_comrec_build except ImportError: raise RuntimeError('Need nisext package from nibabel installation' ' - please install nibabel first') from build_helpers import (generate_a_pyrex_source, cmdclass, INFO_VARS) # monkey-patch numpy distutils to use Cython instead of Pyrex from numpy.distutils.command.build_src import build_src build_src.generate_a_pyrex_source = generate_a_pyrex_source # Add custom commit-recording build command from numpy.distutils.command.build_py import build_py cmdclass['build_py'] = get_comrec_build('nipy', build_py) def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options(ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True) # The quiet=True option will silence all of the name setting warnings: # Ignoring attempt to set 'name' (from 'nipy.core' to # 'nipy.core.image') # Robert Kern recommends setting quiet=True on the numpy list, stating # these messages are probably only used in debugging numpy distutils. config.get_version(pjoin('nipy', 'info.py')) # sets config.version
if os.path.exists('MANIFEST'): os.remove('MANIFEST') # For some commands, use setuptools. if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', 'egg_info', 'easy_install', )).intersection(sys.argv)) > 0: # setup_egg imports setuptools setup, thus monkeypatching distutils. import setup_egg from distutils.core import setup # Python 2 to 3 build from nisext.py3builder import build_py # Commit hash writing, and dependency checking from nisext.sexts import get_comrec_build, package_check cmdclass = {'build_py': get_comrec_build('mindboggle', build_py)} # Get version and release info, which is all stored in mindboggle/info.py ver_file = os.path.join('mindboggle', 'info.py') exec(open(ver_file).read()) # Do dependency checking #package_check('numpy', NUMPY_MIN_VERSION) extra_setuptools_args = {} if 'setuptools' in sys.modules: extra_setuptools_args = dict( tests_require=['nose'], test_suite='nose.collector', zip_safe=False, extras_require = dict(
""" import sys from glob import glob # Import build helpers try: from nisext.sexts import package_check, get_comrec_build except ImportError: raise RuntimeError("Need nisext package from nibabel installation" " - please install nibabel first") from build_docs import cmdclass, INFO_VARS # Add custom commit-recording build command cmdclass["build_py"] = get_comrec_build("nipype") def configuration(parent_package="", top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options( ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True ) # The quiet=True option will silence all of the name setting warnings: # Ignoring attempt to set 'name' (from 'nipy.core' to # 'nipy.core.image') # Robert Kern recommends setting quiet=True on the numpy list, stating # these messages are probably only used in debugging numpy distutils. config.get_version("nipype/__init__.py") # sets config.version
# Import build helpers try: from nisext.sexts import package_check, get_comrec_build except ImportError: raise RuntimeError('Need nisext package from nibabel installation' ' - please install nibabel first') from setup_helpers import (generate_a_pyrex_source, cmdclass, INFO_VARS, build_py) # build_py will do 2to3 for Python3 # monkey-patch numpy distutils to use Cython instead of Pyrex from numpy.distutils.command.build_src import build_src build_src.generate_a_pyrex_source = generate_a_pyrex_source # Add custom commit-recording build command cmdclass['build_py'] = get_comrec_build('nipy', build_py) def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options(ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True) # The quiet=True option will silence all of the name setting warnings: # Ignoring attempt to set 'name' (from 'nipy.core' to # 'nipy.core.image') # Robert Kern recommends setting quiet=True on the numpy list, stating # these messages are probably only used in debugging numpy distutils.
""" import sys from glob import glob # Import build helpers try: from nisext.sexts import package_check, get_comrec_build except ImportError: raise RuntimeError('Need nisext package from nibabel installation' ' - please install nibabel first') from build_docs import cmdclass, INFO_VARS # Add custom commit-recording build command cmdclass['build_py'] = get_comrec_build('bips') def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options(ignore_setup_xxx_py=True, assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True) # The quiet=True option will silence all of the name setting warnings: # Ignoring attempt to set 'name' (from 'nipy.core' to # 'nipy.core.image') # Robert Kern recommends setting quiet=True on the numpy list, stating # these messages are probably only used in debugging numpy distutils. config.get_version('bips/__init__.py') # sets config.version
EXTS.append(Extension(modulename, [pyx_src] + other_sources, include_dirs=[np.get_include(), "src"])) # 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,
).intersection(sys.argv) ) > 0 ): # setup_egg imports setuptools setup, thus monkeypatching distutils. import setup_egg from distutils.core import setup # Python 2 to 3 build from nisext.py3builder import build_py # Commit hash writing, and dependency checking from nisext.sexts import get_comrec_build, package_check cmdclass = {"build_py": get_comrec_build("nibabel", build_py)} # Get version and release info, which is all stored in nibabel/info.py ver_file = os.path.join("nibabel", "info.py") exec(open(ver_file).read()) # Do dependency checking package_check("numpy", NUMPY_MIN_VERSION) custom_pydicom_messages = {"missing opt": 'Missing optional package "%s"' ' provided by package "pydicom"'} package_check("dicom", PYDICOM_MIN_VERSION, optional=True, messages=custom_pydicom_messages) extra_setuptools_args = {} if "setuptools" in sys.modules: extra_setuptools_args = dict( tests_require=["nose"], test_suite="nose.collector", zip_safe=False,