Package ghidra.python

Class PythonUtils


  • public class PythonUtils
    extends java.lang.Object
    Python utility method class.
    • Field Summary

      Fields 
      ChangeModifier and Type Field Description
      static java.lang.String PYTHON_CACHEDIR  
      MODIFIEDstatic java.lang.String PYTHON_NAME  
      static java.lang.String PYTHON_SRC  
    • Constructor Summary

      Constructors 
      ChangeConstructor Description
      PythonUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      ChangeModifier and Type Method Description
      static java.io.File setupPythonCacheDir​(TaskMonitor monitor)
      Sets up the python cache directory.
      static java.io.File setupPythonHomeDir()
      Sets up the python home directory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PYTHON_NAME MODIFIED

        constant: "jython-2.7.1" → "jython-2.7.2"
        -static java.lang.String PYTHON_NAME
        +static java.lang.String PYTHON_NAME
        public static final java.lang.String PYTHON_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • PythonUtils

        public PythonUtils()
    • Method Detail

      • setupPythonHomeDir

        public static java.io.File setupPythonHomeDir()
                                               throws java.io.IOException
        Sets up the python home directory. This is the directory that has the "Lib" directory in it.
        Returns:
        The python home directory.
        Throws:
        java.io.IOException - If there was a disk-related problem setting up the home directory.
      • setupPythonCacheDir

        public static java.io.File setupPythonCacheDir​(TaskMonitor monitor)
                                                throws CancelledException,
                                                       java.io.IOException
        Sets up the python cache directory. This is a temporary space that python source files get compiled to and cached. It should NOT be in the Ghidra installation directory, because some installations will not have the appropriate directory permissions to create new files in.
        Parameters:
        monitor - A monitor to use during the cache directory setup.
        Returns:
        The python cache directory.
        Throws:
        java.io.IOException - If there was a disk-related problem setting up the cache directory.
        CancelledException - If the user cancelled the setup.