Skip to content

Commit

Permalink
Python bindings: setup.py: improve numpy fixing (fixes #6700)
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Zimmermann authored and rouault committed Nov 16, 2022
1 parent b77481c commit 9f534e7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion swig/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ libraries = ['@GDAL_LIB_OUTPUT_NAME@']
# Function to find numpy's include directory
def get_numpy_include():
# Fix numpy installation using setuptools
__builtins__.__NUMPY_SETUP__ = False
# __builtins__ can be either a dict or a module
def _set_builtin(name, value):
if isinstance(__builtins__, dict):
__builtins__[name] = value
else:
setattr(__builtins__, name, value)

_set_builtin("__NUMPY_SETUP__", False)

import numpy
return numpy.get_include()
Expand Down

0 comments on commit 9f534e7

Please sign in to comment.