From 9692ff11e97d899fac21e5bec50e95828021d681 Mon Sep 17 00:00:00 2001
From: Christophe Guillon <christophe.guillon@inria.fr>
Date: Wed, 17 Jul 2024 20:08:01 +0200
Subject: [PATCH] [Setup] Allow empty AIDGE_BUILD_GEN type

If AIDGE_BUILD_GEN= is in environment the default build backend
is used.
---
 setup.py | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/setup.py b/setup.py
index 5537b4555..4cd3c18c1 100644
--- a/setup.py
+++ b/setup.py
@@ -41,27 +41,23 @@ class CMakeBuild(build_ext):
 
         os.chdir(str(build_temp))
 
-        compile_type = (
-            "Release"
-            if "AIDGE_PYTHON_BUILD_TYPE" not in os.environ
-            else os.environ["AIDGE_PYTHON_BUILD_TYPE"]
-        )
+        compile_type = os.environ.get("AIDGE_PYTHON_BUILD_TYPE", "Release")
         install_path = (
             os.path.join(sys.prefix, "lib", "libAidge")
             if "AIDGE_INSTALL" not in os.environ
             else os.environ["AIDGE_INSTALL"]
         )
-
-        build_gen = (
-            ["-G", os.environ["AIDGE_BUILD_GEN"]]
-            if "AIDGE_BUILD_GEN" in os.environ
+        build_gen = os.environ.get("AIDGE_BUILD_GEN", "")
+        build_gen_opts = (
+            ["-G", build_gen]
+            if build_gen
             else []
         )
 
         self.spawn(
             [
                 "cmake",
-                *build_gen,
+                *build_gen_opts,
                 str(cwd),
                 "-DTEST=OFF",
                 f"-DCMAKE_INSTALL_PREFIX:PATH={install_path}",
-- 
GitLab