From b60f85cb484c13cb668a4a45214612b325147776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net>
Date: Wed, 17 Jul 2024 19:02:46 +0200
Subject: [PATCH] DISABLE_JULIA environment variable

---
 src/taggingbackends/explorer.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/taggingbackends/explorer.py b/src/taggingbackends/explorer.py
index 6ce6cb4..b725637 100644
--- a/src/taggingbackends/explorer.py
+++ b/src/taggingbackends/explorer.py
@@ -11,22 +11,26 @@ import tempfile
 from collections import defaultdict
 
 JULIA_PROJECT = os.environ.get('JULIA_PROJECT', '')
+DISABLE_JULIA = os.environ.get('DISABLE_JULIA', '')
 
 try:
     from julia import Julia
 except:
-    logging.warning(f"PyCall not found in JULIA_PROJECT={JULIA_PROJECT}; \
+    if not isempty(DISABLE_JULIA):
+        logging.warning(f"PyCall not found in JULIA_PROJECT={JULIA_PROJECT}; \
 please see https://gitlab.pasteur.fr/nyx/TaggingBackends#recommended-installation")
 else:
     try:
         Julia(compiled_modules=False)
     except:
-        logging.warning("Failed to set PyCall with compiled_modules=False")
+        if not isempty(DISABLE_JULIA):
+            logging.warning("Failed to set PyCall with compiled_modules=False")
     try:
         from julia import TaggingBackends
         from julia import PlanarLarvae
-    except ImportError:
-        logging.warning(f"TaggingBackends not found in JULIA_PROJECT={JULIA_PROJECT}; \
+    except:
+        if not isempty(DISABLE_JULIA):
+            logging.warning(f"TaggingBackends not found in JULIA_PROJECT={JULIA_PROJECT}; \
 please see https://gitlab.pasteur.fr/nyx/TaggingBackends#recommended-installation")
 
 def getlogger(name):
-- 
GitLab