Skip to content

Commit

Permalink
Edit utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Dec 2, 2024
1 parent 408e5cb commit 4ed6779
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions spine_engine/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,18 +247,19 @@ def inverted(input_):
return output


def get_julia_env(settings):
def get_julia_env(use_jupyter_console, julia_kernel, julia_path, julia_project_path):
"""
Args:
settings (QSettings, AppSettings)
use_jupyter_console (bool): True if Jupyter console is in use
julia_kernel (str): Julia kernel name
julia_path (str): Path to Julia executable
julia_project_path (str): Path to Julia project/environment folder
Returns:
Union[tuple, None]: (julia_exe, julia_project), or None if none found
"""
use_jupyter_console = settings.value("appSettings/useJuliaKernel", defaultValue="0") == "2"
if use_jupyter_console:
kernel_name = settings.value("appSettings/juliaKernel", defaultValue="")
resource_dir = custom_find_kernel_specs().get(kernel_name)
resource_dir = custom_find_kernel_specs().get(julia_kernel)
if resource_dir is None:
return None
filepath = os.path.join(resource_dir, "kernel.json")
Expand All @@ -271,13 +272,11 @@ def get_julia_env(settings):
project_arg = next((arg for arg in kernel_spec["argv"] if arg.startswith("--project=")), None)
project = "" if project_arg is None else project_arg.split("--project=")[1]
return julia, project
julia = settings.value("appSettings/juliaPath", defaultValue="")
if julia == "":
if julia_path == "":
julia = resolve_executable_from_path(JULIA_EXECUTABLE)
if julia == "":
return None
project = settings.value("appSettings/juliaProjectPath", defaultValue="")
return julia, project
return julia_path, julia_project_path


def required_items_for_execution(items, connections, executable_item_classes, execution_permits):
Expand Down

0 comments on commit 4ed6779

Please sign in to comment.