|
11 | 11 |
|
12 | 12 | __docformat__ = 'restructuredtext'
|
13 | 13 |
|
14 |
| -from numpy.distutils.core import setup |
15 |
| -from glob import glob |
16 | 14 | import os
|
| 15 | +import sys |
| 16 | +from glob import glob |
| 17 | + |
| 18 | +# For some commands, use setuptools. |
| 19 | +if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', |
| 20 | + 'bdist_wininst', 'install_egg_info', 'egg_info', 'easy_install', |
| 21 | + )).intersection(sys.argv)) > 0: |
| 22 | + # setup_egg imports setuptools setup, thus monkeypatching distutils. Note |
| 23 | + # that we have to import our own setup after this so we catch the |
| 24 | + # monkeypatched version |
| 25 | + from setup_egg import extra_setuptools_args |
| 26 | + |
| 27 | +# extra_setuptools_args can be defined from the line above, but it can |
| 28 | +# also be defined here because setup.py has been exec'ed from |
| 29 | +# setup_egg.py. |
| 30 | +if not 'extra_setuptools_args' in globals(): |
| 31 | + extra_setuptools_args = dict() |
| 32 | + |
| 33 | + |
| 34 | +def main(**extra_args): |
| 35 | + # Import late so we catch setuptools monkeypatched distutils setup |
| 36 | + from numpy.distutils.core import setup |
| 37 | + setup(name = 'nibabel', |
| 38 | + version = '1.0.0', |
| 39 | + author = 'Matthew Brett and Michael Hanke', |
| 40 | + author_email = 'NiBabel List <pkg-exppsy-pynifti@lists.alioth.debian.org>', |
| 41 | + license = 'MIT License', |
| 42 | + url = 'http://niftilib.sf.net/pynifti', |
| 43 | + description = 'Access a multitude of neuroimaging data formats', |
| 44 | + long_description = "", |
| 45 | + packages = ['nibabel', |
| 46 | + 'nibabel.externals', |
| 47 | + 'nibabel.testing', |
| 48 | + 'nibabel.tests'], |
| 49 | + data_files = [('nibabel/tests/data', |
| 50 | + glob(os.path.join('nibabel', 'tests', 'data', '*')))], |
| 51 | + scripts = [os.path.join('bin', 'parrec2nii')], |
| 52 | + **extra_args |
| 53 | + ) |
| 54 | + |
17 | 55 |
|
18 |
| -setup(name = 'nibabel', |
19 |
| - version = '1.0.0', |
20 |
| - author = 'Matthew Brett and Michael Hanke', |
21 |
| - author_email = 'NiBabel List <pkg-exppsy-pynifti@lists.alioth.debian.org>', |
22 |
| - license = 'MIT License', |
23 |
| - url = 'http://niftilib.sf.net/pynifti', |
24 |
| - description = 'Access a multitude of neuroimaging data formats', |
25 |
| - long_description = "", |
26 |
| - packages = ['nibabel', |
27 |
| - 'nibabel.externals', |
28 |
| - 'nibabel.testing', |
29 |
| - 'nibabel.tests'], |
30 |
| - data_files = [('nibabel/tests/data', |
31 |
| - glob(os.path.join('nibabel', 'tests', 'data', '*')))], |
32 |
| - scripts = [os.path.join('bin', 'parrec2nii')] |
33 |
| - ) |
| 56 | +if __name__ == "__main__": |
| 57 | + main(**extra_setuptools_args) |
0 commit comments