Skip to content

Commit 5a33038

Browse files
committed
BLD: only import setuptools in py3k as cython command doesn't currently work
1 parent cbca296 commit 5a33038

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

setup.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33
"""
44
Parts of this file were taken from the pyzmq project
55
(https://github.com/zeromq/pyzmq) and hence are subject to the terms of the
6-
Lesser GPU General Public License.
6+
Lesser GNU General Public License.
77
"""
88

99
from distutils.core import setup, Command
1010
# use setuptools if available
11-
try:
12-
from setuptools import setup
13-
_have_setuptools = True
14-
except ImportError:
15-
_have_setuptools = False
1611

1712
from datetime import datetime
1813
from glob import glob
@@ -21,6 +16,18 @@
2116
import shutil
2217
import warnings
2318

19+
20+
if sys.version_info.major >= 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}
27+
else:
28+
setuptools_args = {}
29+
30+
2431
import numpy as np
2532

2633
# from numpy.distutils.core import setup
@@ -282,9 +289,6 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
282289
include_dirs=[np.get_include()])
283290
extensions = [tseries_ext,
284291
sparse_ext]
285-
286-
setuptools_args = {'use_2to3': True}
287-
288292
# if _have_setuptools:
289293
# setuptools_args["test_suite"] = "nose.collector"
290294

0 commit comments

Comments
 (0)