Skip to content

Commit

Permalink
NF - added setuptools commands
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-brett committed Jul 24, 2010
1 parent 630dacf commit 275d441
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 27 deletions.
60 changes: 42 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,47 @@

__docformat__ = 'restructuredtext'

from numpy.distutils.core import setup
from glob import glob
import os
import sys
from glob import glob

# 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. Note
# that we have to import our own setup after this so we catch the
# monkeypatched version
from setup_egg import extra_setuptools_args

# 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()


def main(**extra_args):
# Import late so we catch setuptools monkeypatched distutils setup
from numpy.distutils.core import setup
setup(name = 'nibabel',
version = '1.0.0',
author = 'Matthew Brett and Michael Hanke',
author_email = 'NiBabel List <[email protected]>',
license = 'MIT License',
url = 'http://niftilib.sf.net/pynifti',
description = 'Access a multitude of neuroimaging data formats',
long_description = "",
packages = ['nibabel',
'nibabel.externals',
'nibabel.testing',
'nibabel.tests'],
data_files = [('nibabel/tests/data',
glob(os.path.join('nibabel', 'tests', 'data', '*')))],
scripts = [os.path.join('bin', 'parrec2nii')],
**extra_args
)


setup(name = 'nibabel',
version = '1.0.0',
author = 'Matthew Brett and Michael Hanke',
author_email = 'NiBabel List <[email protected]>',
license = 'MIT License',
url = 'http://niftilib.sf.net/pynifti',
description = 'Access a multitude of neuroimaging data formats',
long_description = "",
packages = ['nibabel',
'nibabel.externals',
'nibabel.testing',
'nibabel.tests'],
data_files = [('nibabel/tests/data',
glob(os.path.join('nibabel', 'tests', 'data', '*')))],
scripts = [os.path.join('bin', 'parrec2nii')]
)
if __name__ == "__main__":
main(**extra_setuptools_args)
29 changes: 20 additions & 9 deletions setup_egg.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
from setuptools import setup
execfile('setup.py')
"""Wrapper to run setup.py using setuptools."""

from setuptools import setup

################################################################################
# Call the setup.py script, injecting the setuptools-specific arguments.

extra_setuptools_args = dict(
tests_require=['nose'],
test_suite='nose.collector',
zip_safe=False,
)


if __name__ == '__main__':
execfile('setup.py', dict(__name__='__main__',
extra_setuptools_args=extra_setuptools_args))



0 comments on commit 275d441

Please sign in to comment.