mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
#11463 Look for resinsight_executable in JSON
Search for resinsight_executable in JSON-file located at ./share/rips/rips_config.json
This commit is contained in:
parent
acfbd94263
commit
84a07eed2b
@ -12,6 +12,8 @@ import logging
|
|||||||
import time
|
import time
|
||||||
import tempfile
|
import tempfile
|
||||||
import signal
|
import signal
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
import grpc
|
import grpc
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ from .generated.generated_classes import CommandRouter
|
|||||||
|
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class Instance:
|
class Instance:
|
||||||
@ -121,6 +124,18 @@ class Instance:
|
|||||||
if launch_port != -1:
|
if launch_port != -1:
|
||||||
requested_port = launch_port
|
requested_port = launch_port
|
||||||
|
|
||||||
|
if not resinsight_executable:
|
||||||
|
filename = Path(sys.prefix) / "share" / "rips" / "rips_config.json"
|
||||||
|
if filename.is_file():
|
||||||
|
f = open(filename)
|
||||||
|
data = json.load(f)
|
||||||
|
resinsight_executable = data["resinsight_executable"]
|
||||||
|
if resinsight_executable:
|
||||||
|
print(
|
||||||
|
"In './share/rips/rips_config.json', found resinsight_executable:",
|
||||||
|
resinsight_executable,
|
||||||
|
)
|
||||||
|
|
||||||
if not resinsight_executable:
|
if not resinsight_executable:
|
||||||
resinsight_executable_from_env = os.environ.get("RESINSIGHT_EXECUTABLE")
|
resinsight_executable_from_env = os.environ.get("RESINSIGHT_EXECUTABLE")
|
||||||
if not resinsight_executable_from_env:
|
if not resinsight_executable_from_env:
|
||||||
|
Loading…
Reference in New Issue
Block a user