https://github.com/ESMValGroup/ESMValTool
Raw File
Tip revision: 6cdb51ff139b704aa9e8d3bc8b42a5b689b0eb43 authored by Elizaveta Malinina on 18 September 2023, 22:42:06 UTC
adding pre-finalized recipe and raw version of diagnostics
Tip revision: 6cdb51f
__init__.py
"""Install Julia dependencies."""
import subprocess
import sys
from pathlib import Path


class Install:
    """Install extra dependencies.

    Diagnostics written in Julia need extra dependencies. Use this
    command to install them.

    Note that Julia must be pre-installed before running this command.
    """

    @staticmethod
    def _run(cmd, script):
        root = Path(__file__).parent
        try:
            subprocess.check_output(
                [cmd, str(root / script)],
                stderr=subprocess.STDOUT,
                universal_newlines=True,
            )
        except subprocess.CalledProcessError as exc:
            print(exc.stdout)
            print("installation failed")
            sys.exit(1)
        else:
            print("Installation successful")

    def Julia(self):  # noqa: N802
        """Install dependencies needed to run Julia diagnostics."""
        print("installing Julia packages, please wait...")
        script = Path("Julia") / "setup.jl"
        self._run("julia", script)
back to top