Skip to content

Commit eb22342

Browse files
gregglindwesm
authored andcommitted
re #520, more setup.py additions
1 parent d035d9d commit eb22342

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

setup.py

+27-17
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,52 @@
66
Lesser GNU General Public License.
77
"""
88

9-
from distutils.core import setup, Command
10-
# use setuptools if available
11-
129
from datetime import datetime
1310
from glob import glob
1411
import os
1512
import sys
1613
import shutil
1714
import warnings
1815

16+
try:
17+
from setuptools import setup, Command
18+
_have_setuptools = True
19+
except:
20+
from distutils.core import setup, Command
21+
_have_setuptools = False
22+
1923

24+
setuptools_kwargs = {}
2025
if sys.version_info[0] >= 3:
21-
try:
22-
from setuptools import setup
23-
_have_setuptools = True
24-
except ImportError:
25-
raise ImportError('require setuptools/distribute for Py3k')
26-
setuptools_args = {'use_2to3': True,
26+
27+
setuptools_kwargs = {'use_2to3': True,
2728
'zip_safe': False,
2829
'install_requires': ['python-dateutil > 2','numpy'],
2930
}
31+
if not _have_setuptools:
32+
sys.exit("need setuptools/distribute for Py3k"
33+
"\n$ pip install distribute")
34+
3035
else:
31-
setuptools_args = {
36+
setuptools_kwargs = {
3237
'install_requires': ['python-dateutil < 2','numpy'],
3338
}
39+
if not _have_setuptools:
40+
try:
41+
import numpy
42+
import dateutil
43+
setuptools_kwargs = {}
44+
except ImportError:
45+
sys.exit("install requires: 'python-dateutil < 2','numpy'. use pip or easy_install."
46+
"\n $ pip install 'python-dateutil < 2' 'numpy'")
3447

3548
try:
3649
import numpy as np
3750
except ImportError:
3851
nonumpy_msg = ("# numpy needed to finish setup. run:\n\n"
39-
"pip install numpy \n# or easy_install numpy\n")
40-
print nonumpy_msg
41-
import sys
42-
sys.exit()
52+
" $ pip install numpy # or easy_install numpy\n")
53+
sys.exit(nonumpy_msg)
4354

44-
# from numpy.distutils.core import setup
4555

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

337347
# if _have_setuptools:
338-
# setuptools_args["test_suite"] = "nose.collector"
348+
# setuptools_kwargs["test_suite"] = "nose.collector"
339349

340350
write_version_py()
341351
setup(name=DISTNAME,
@@ -371,4 +381,4 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
371381
long_description=LONG_DESCRIPTION,
372382
classifiers=CLASSIFIERS,
373383
platforms='any',
374-
**setuptools_args)
384+
**setuptools_kwargs)

0 commit comments

Comments
 (0)