Skip to content

Commit

Permalink
re #520, more setup.py additions
Browse files Browse the repository at this point in the history
  • Loading branch information
gregglind authored and wesm committed Jan 6, 2012
1 parent d035d9d commit eb22342
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,52 @@
Lesser GNU General Public License.
"""

from distutils.core import setup, Command
# use setuptools if available

from datetime import datetime
from glob import glob
import os
import sys
import shutil
import warnings

try:
from setuptools import setup, Command
_have_setuptools = True
except:
from distutils.core import setup, Command
_have_setuptools = False


setuptools_kwargs = {}
if sys.version_info[0] >= 3:
try:
from setuptools import setup
_have_setuptools = True
except ImportError:
raise ImportError('require setuptools/distribute for Py3k')
setuptools_args = {'use_2to3': True,

setuptools_kwargs = {'use_2to3': True,
'zip_safe': False,
'install_requires': ['python-dateutil > 2','numpy'],
}
if not _have_setuptools:
sys.exit("need setuptools/distribute for Py3k"
"\n$ pip install distribute")

else:
setuptools_args = {
setuptools_kwargs = {
'install_requires': ['python-dateutil < 2','numpy'],
}
if not _have_setuptools:
try:
import numpy
import dateutil
setuptools_kwargs = {}
except ImportError:
sys.exit("install requires: 'python-dateutil < 2','numpy'. use pip or easy_install."
"\n $ pip install 'python-dateutil < 2' 'numpy'")

try:
import numpy as np
except ImportError:
nonumpy_msg = ("# numpy needed to finish setup. run:\n\n"
"pip install numpy \n# or easy_install numpy\n")
print nonumpy_msg
import sys
sys.exit()
" $ pip install numpy # or easy_install numpy\n")
sys.exit(nonumpy_msg)

# from numpy.distutils.core import setup

from distutils.extension import Extension
from distutils.command.build import build
Expand Down Expand Up @@ -335,7 +345,7 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
extensions.extend([sandbox_ext])

# if _have_setuptools:
# setuptools_args["test_suite"] = "nose.collector"
# setuptools_kwargs["test_suite"] = "nose.collector"

write_version_py()
setup(name=DISTNAME,
Expand Down Expand Up @@ -371,4 +381,4 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
long_description=LONG_DESCRIPTION,
classifiers=CLASSIFIERS,
platforms='any',
**setuptools_args)
**setuptools_kwargs)

0 comments on commit eb22342

Please sign in to comment.