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'), ) pkg_chk = partial(package_check, setuptools_args = extra_setuptools_args) else: extra_setuptools_args = {} pkg_chk = package_check
# See COPYING file distributed along with the NiBabel package for the # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """Build helper.""" import sys import os from setuptools import setup # nisext is nipy setup extensions, which we're mostly moving away from # get_comrec_build stores the current commit in COMMIT_HASH.txt at build time # read_vars_from evaluates a python file and makes variables available from nisext.sexts import get_comrec_build, read_vars_from INFO = read_vars_from(os.path.join('nibabel', 'info.py')) # Give setuptools a hint to complain if it's too old a version # 30.3.0 allows us to put most metadata in setup.cfg # Should match pyproject.toml SETUP_REQUIRES = ['setuptools >= 30.3.0'] # This enables setuptools to install wheel on-the-fly SETUP_REQUIRES += ['wheel'] if 'bdist_wheel' in sys.argv else [] if __name__ == "__main__": setup(name='nibabel', version=INFO.VERSION, setup_requires=SETUP_REQUIRES, cmdclass={'build_py': get_comrec_build('nibabel')})