|
10 | 10 | """Build helper.""" |
11 | 11 |
|
12 | 12 | import os |
13 | | -from os.path import join as pjoin |
14 | | -import sys |
15 | | -from functools import partial |
16 | 13 |
|
17 | | -# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
18 | | -# update it when the contents of directories change. |
19 | | -if os.path.exists('MANIFEST'): |
20 | | - os.remove('MANIFEST') |
| 14 | +import setuptools |
21 | 15 |
|
22 | | -from setuptools import setup |
23 | | - |
24 | | -# Commit hash writing, and dependency checking |
25 | | -from nisext.sexts import (get_comrec_build, package_check, install_scripts_bat, |
26 | | - read_vars_from) |
27 | | -cmdclass = {'build_py': get_comrec_build('nibabel'), |
28 | | - 'install_scripts': install_scripts_bat} |
29 | | - |
30 | | -# Get project related strings. |
31 | | -INFO = read_vars_from(pjoin('nibabel', 'info.py')) |
32 | | - |
33 | | -# Prepare setuptools args |
34 | | -if 'setuptools' in sys.modules: |
35 | | - extra_setuptools_args = dict( |
36 | | - tests_require=['nose'], |
37 | | - test_suite='nose.collector', |
38 | | - zip_safe=False, |
39 | | - extras_require=dict( |
40 | | - doc='Sphinx>=0.3', |
41 | | - test='nose>=0.10.1'), |
42 | | - ) |
43 | | - pkg_chk = partial(package_check, setuptools_args = extra_setuptools_args) |
44 | | -else: |
45 | | - extra_setuptools_args = {} |
46 | | - pkg_chk = package_check |
47 | | - |
48 | | -# Do dependency checking |
49 | | -pkg_chk('numpy', INFO.NUMPY_MIN_VERSION) |
50 | | -pkg_chk('six', INFO.SIX_MIN_VERSION) |
51 | | -custom_pydicom_messages = {'missing opt': 'Missing optional package "%s"' |
52 | | - ' provided by package "pydicom"' |
53 | | -} |
54 | | -pkg_chk('dicom', |
55 | | - INFO.PYDICOM_MIN_VERSION, |
56 | | - optional='dicom', |
57 | | - messages = custom_pydicom_messages) |
58 | | - |
59 | | -def main(**extra_args): |
60 | | - setup(name='nibabel', |
61 | | - maintainer=INFO.MAINTAINER, |
62 | | - maintainer_email=INFO.MAINTAINER_EMAIL, |
63 | | - description=INFO.DESCRIPTION, |
64 | | - long_description=INFO.LONG_DESCRIPTION, |
65 | | - url=INFO.URL, |
66 | | - download_url=INFO.DOWNLOAD_URL, |
67 | | - license=INFO.LICENSE, |
68 | | - classifiers=INFO.CLASSIFIERS, |
69 | | - author=INFO.AUTHOR, |
70 | | - author_email=INFO.AUTHOR_EMAIL, |
71 | | - platforms=INFO.PLATFORMS, |
72 | | - version=INFO.VERSION, |
73 | | - provides=INFO.PROVIDES, |
74 | | - install_requires=INFO.REQUIRES, |
75 | | - packages = ['nibabel', |
76 | | - 'nibabel.externals', |
77 | | - 'nibabel.externals.tests', |
78 | | - 'nibabel.gifti', |
79 | | - 'nibabel.gifti.tests', |
80 | | - 'nibabel.cifti2', |
81 | | - 'nibabel.cifti2.tests', |
82 | | - 'nibabel.cmdline', |
83 | | - 'nibabel.cmdline.tests', |
84 | | - 'nibabel.nicom', |
85 | | - 'nibabel.freesurfer', |
86 | | - 'nibabel.freesurfer.tests', |
87 | | - 'nibabel.nicom.tests', |
88 | | - 'nibabel.testing', |
89 | | - 'nibabel.tests', |
90 | | - 'nibabel.benchmarks', |
91 | | - 'nibabel.streamlines', |
92 | | - 'nibabel.streamlines.tests', |
93 | | - # install nisext as its own package |
94 | | - 'nisext', |
95 | | - 'nisext.tests'], |
96 | | - # The package_data spec has no effect for me (on python 2.6) -- even |
97 | | - # changing to data_files doesn't get this stuff included in the source |
98 | | - # distribution -- not sure if it has something to do with the magic |
99 | | - # above, but distutils is surely the worst piece of code in all of |
100 | | - # python -- duplicating things into MANIFEST.in but this is admittedly |
101 | | - # only a workaround to get things started -- not a solution |
102 | | - package_data = {'nibabel': |
103 | | - [pjoin('tests', 'data', '*'), |
104 | | - pjoin('externals', 'tests', 'data', '*'), |
105 | | - pjoin('nicom', 'tests', 'data', '*'), |
106 | | - pjoin('gifti', 'tests', 'data', '*'), |
107 | | - pjoin('streamlines', 'tests', 'data', '*'), |
108 | | - ]}, |
109 | | - scripts = [pjoin('bin', 'parrec2nii'), |
110 | | - pjoin('bin', 'nib-ls'), |
111 | | - pjoin('bin', 'nib-dicomfs'), |
112 | | - pjoin('bin', 'nib-nifti-dx'), |
113 | | - pjoin('bin', 'nib-tck2trk'), |
114 | | - pjoin('bin', 'nib-trk2tck'), |
115 | | - pjoin('bin', 'nib-diff'), |
116 | | - ], |
117 | | - cmdclass = cmdclass, |
118 | | - **extra_args |
119 | | - ) |
| 16 | +# Commit hash writing |
| 17 | +from nisext.sexts import get_comrec_build, read_vars_from |
120 | 18 |
|
| 19 | +INFO = read_vars_from(os.path.join('nibabel', 'info.py')) |
121 | 20 |
|
122 | 21 | if __name__ == "__main__": |
123 | | - # Do not use nisext's dynamically updated install_requires |
124 | | - extra_setuptools_args.pop('install_requires', None) |
125 | | - main(**extra_setuptools_args) |
| 22 | + setuptools.setup(name='nibabel', |
| 23 | + version=INFO.VERSION, |
| 24 | + setup_requires=['setuptools>=30.3.0'], |
| 25 | + cmdclass={'build_py': get_comrec_build('nibabel')}) |
0 commit comments