# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1659007489 -7200
# Node ID 7f5659b1eeb84707108b7c9bb27091cdef6eae28
# Parent  6d3cb1ab1ef73fe709d173bd30939580d532a1e1
LocalRuntime: Allow overriding local runtime python binary path using BEREMIZPYTHONPATH environment variable.

diff -r 6d3cb1ab1ef7 -r 7f5659b1eeb8 LocalRuntimeMixin.py
--- a/LocalRuntimeMixin.py	Wed Jul 27 21:34:23 2022 +0200
+++ b/LocalRuntimeMixin.py	Thu Jul 28 13:24:49 2022 +0200
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
+
+import os
 import sys
 import tempfile
 import random
@@ -7,6 +9,11 @@
 from util.ProcessLogger import ProcessLogger
 from util.paths import Bpath
 
+LocalRuntimeInterpreterPath = \
+    os.environ["BEREMIZPYTHONPATH"] \
+    if os.environ.has_key("BEREMIZPYTHONPATH") \
+    else sys.executable
+
 class LocalRuntimeMixin():
 
     def __init__(self, log, use_gui=True):
@@ -27,7 +34,7 @@
             self.local_runtime = ProcessLogger(
                 self.local_runtime_log,
                 "\"%s\" \"%s\" -p %s -i localhost %s %s" % (
-                    sys.executable,
+                    LocalRuntimeInterpreterPath,
                     Bpath("Beremiz_service.py"),
                     self.runtime_port,
                     {False: "-x 0", True: "-x 1"}[self.use_gui],