Skip to content

Commit 50de0ce

Browse files
committed
Python 3 fixes
1 parent fdea45f commit 50de0ce

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

setupext.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -711,11 +711,19 @@ class Numpy(SetupPackage):
711711

712712
@staticmethod
713713
def include_dirs_hook():
714-
import __builtin__
715-
if hasattr(__builtin__, '__NUMPY_SETUP__'):
716-
del __builtin__.__NUMPY_SETUP__
717-
import numpy
718-
reload(numpy)
714+
if sys.version_info[0] >= 3:
715+
import builtins
716+
if hasattr(builtins, '__NUMPY_SETUP__'):
717+
del builtins.__NUMPY_SETUP__
718+
import imp
719+
import numpy
720+
imp.reload(numpy)
721+
else:
722+
import __builtin__
723+
if hasattr(__builtin__, '__NUMPY_SETUP__'):
724+
del __builtin__.__NUMPY_SETUP__
725+
import numpy
726+
reload(numpy)
719727

720728
ext = Extension('test', [])
721729
ext.include_dirs.append(numpy.get_include())

unit/test_clean_install.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ python.tmp/bin/python setup.py install
1313
python.tmp/bin/python -c "import matplotlib"
1414
rm -rf python.tmp
1515

16-
# Tests that pip works
17-
16+
set -e
17+
cd ..
1818
rm -rf build
1919
rm -rf numpy*
2020
rm -rf python.tmp
21-
python unit/virtualenv.py python.tmp
22-
python.tmp/bin/pip install .
23-
python.tmp/bin/python -c "import matplotlib"
21+
python3 unit/virtualenv.py python.tmp
22+
python.tmp/bin/python3 setup.py install
23+
python.tmp/bin/python3 -c "import matplotlib"
2424
rm -rf python.tmp

0 commit comments

Comments
 (0)