diff --git a/setup.py b/setup.py index 3672550e1..a38ed32ca 100644 --- a/setup.py +++ b/setup.py @@ -51,12 +51,21 @@ sys.exit(1) +def set_builtin(name, value): + if isinstance(__builtins__, dict): + __builtins__[name] = value + else: + # to support https://github.com/pypa/build + # see https://github.com/jopohl/urh/issues/1106 + setattr(__builtins__, name, value) + + class build_ext(_build_ext): def finalize_options(self): print("Finalizing options") _build_ext.finalize_options(self) # Prevent numpy from thinking it is still in its setup process: - __builtins__.__NUMPY_SETUP__ = False + set_builtin("__NUMPY_SETUP__", False) import numpy self.include_dirs.append(numpy.get_include())