From d9a68fac3bfeb0300cf2975e713ab1cd1cb37b8a Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 11 Mar 2024 13:30:25 -0300 Subject: [PATCH 1/4] Handle module __builtins__ both as dict or module --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3672550e1..13db47077 100644 --- a/setup.py +++ b/setup.py @@ -50,13 +50,18 @@ ) sys.exit(1) +def set_builtin(name, value): + if isinstance(__builtins__, dict): + __builtins__[name] = value + else: + 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()) From 94384d77abd980f82bebc4aab191d8405ba7928c Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Wed, 13 Mar 2024 15:02:42 -0300 Subject: [PATCH 2/4] Double quotes to keep black compliance in setup.py Co-authored-by: Dr. Johannes Pohl --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 13db47077..d3297838d 100644 --- a/setup.py +++ b/setup.py @@ -61,7 +61,7 @@ def finalize_options(self): print("Finalizing options") _build_ext.finalize_options(self) # Prevent numpy from thinking it is still in its setup process: - set_builtin('__NUMPY_SETUP__', False) + set_builtin("__NUMPY_SETUP__", False) import numpy self.include_dirs.append(numpy.get_include()) From ed5c81f091a6a8fa7d2ccaab2c7423e8d01b1253 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Thu, 14 Mar 2024 14:29:01 -0300 Subject: [PATCH 3/4] Comment on why use set_builtin in setup.py Co-authored-by: Dr. Johannes Pohl --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index d3297838d..d35b0605c 100644 --- a/setup.py +++ b/setup.py @@ -54,6 +54,8 @@ 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): From 7db0575c73b76f59e7c2106339ca9c55accacf2c Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Thu, 14 Mar 2024 16:45:26 -0300 Subject: [PATCH 4/4] Extra blank line around function in setup.py --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index d35b0605c..a38ed32ca 100644 --- a/setup.py +++ b/setup.py @@ -50,6 +50,7 @@ ) sys.exit(1) + def set_builtin(name, value): if isinstance(__builtins__, dict): __builtins__[name] = value @@ -58,6 +59,7 @@ def set_builtin(name, value): # see https://github.com/jopohl/urh/issues/1106 setattr(__builtins__, name, value) + class build_ext(_build_ext): def finalize_options(self): print("Finalizing options")