Class CPythonSettings

java.lang.Object
nz.org.riskscape.cpython.CPythonSettings

public class CPythonSettings extends Object

Encapsulates some higher level logic around the configured python environment

  • Field Details

  • Constructor Details

    • CPythonSettings

      public CPythonSettings()
  • Method Details

    • defaults

      public static CPythonSettings defaults(Path libDir, String python3bin)

      Returns default settings from just the plugin's library dir and the path to a python interpreter

    • fromIniSection

      public static CPythonSettings fromIniSection(Path pluginInstallPath, Map<String,List<String>> iniSection)

      Build settings from the given iniSection config

      Parameters:
      pluginInstallPath - filesystem path to plugin's installed resources
    • isPython3BinSet

      public boolean isPython3BinSet()
      Returns:
      true if the user has setup python3-bin or we've successfully found python at the default location. Later on we do some more thorough checks that python is working, and it doesn't make sense to do those checks if the user just has the CPython plugin installed because riskscape shipped with it on by default.
    • checkPython3Working

      public boolean checkPython3Working(nz.org.riskscape.problem.ProblemSink problemSink)

      Runs a few checks to get some confidence that our cpython adaptor is going to work properly, logging errors to problemSink

    • newPython3Command

      public List<String> newPython3Command()
      Returns:
      the beginning of a command that can be used to invoke python3, with options but without the adaptor script
    • getPython3Bin

      public String getPython3Bin()
    • getAdaptorPath

      public Path getAdaptorPath()
    • getPython3Options

      public List<String> getPython3Options()
    • getLibDir

      public Path getLibDir()
    • getMaxProcessesPerFunction

      public int getMaxProcessesPerFunction()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object