File: //usr/lib/fm-agent/dependencies/linux/python3.9/jpype/__pycache__/_jvmfinder.cpython-39.pyc
a
��iX2 � @ s� d dl Z d dlZg d�Zzd dlZW n ey: dZY n0 G dd� de�ZG dd� de�Zdd� ZG d d
� d
e �Z
G dd� de
�ZG d
d� de�Zej
fdd�ZddgZG dd� de
�ZdS )� N)�getDefaultJVMPath�JVMNotFoundException�JVMNotSupportedExceptionc @ s e Zd ZdZdS )r aI Exception raised when no JVM was found in the search path.
This exception is raised when the all of the places searched did not
contain a JVM. The locations searched depend on the machine architecture.
To avoid this exception specify the JAVA_HOME environment variable as a
valid jre or jdk root directory.
N��__name__�
__module__�__qualname__�__doc__� r
r
�B/usr/lib/fm-agent/dependencies/linux/python3.9/jpype/_jvmfinder.pyr s r c @ s e Zd ZdZdS )r aj Exception raised when the JVM is not supported.
This exception is raised after a search found a valid Java home directory
was found, but the JVM shared library found is not supported. Typically
this occures when the JVM does not match the architecture of Python
32 vs 64 bit, or the JVM is older than the version used to compile
JPype.
Nr r
r
r
r r + s r c C s2 t jdkrt� } nt jdkr$t� } nt� } | �� S )aO
Retrieves the path to the default or first found JVM library
Returns:
The path to the JVM shared library file
Raises:
JVMNotFoundException: If there was no JVM found in the search path.
JVMNotSupportedException: If the JVM was found was not compatible with
Python due to cpu architecture.
�win32�darwin)�sys�platform�WindowsJVMFinder�DarwinJVMFinder�LinuxJVMFinder�get_jvm_path)�finderr
r
r r 7 s
r c @ sH e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dS )� JVMFinderz'
JVM library finder base class
c C s d| _ d| _| j| jf| _dS )�!
Sets up members
� libjvm.so)�/usr/lib/jvm� /usr/javaN)�_libfile�
_locations�_get_from_java_home�_get_from_known_locations�_methods��selfr
r
r �__init__R s
�zJVMFinder.__init__c C sx d}d}t �|�D ]F\}}}| j|v rt j�|�d }||v rDd}qt j�|| j� S q|rltd�|���td��dS )z�
Recursively looks for the given file
Parameters:
java_home(str): A Java home folder
filename(str): filename: Name of the file to find
Returns:
The first found file path, or None
)ZcacaoZjamvmF� TzySorry '{0}' is known to be broken. Please ensure your JAVA_HOME contains at least another JVM implementation (eg. server)zsSorry no JVM could be found. Please ensure your JAVA_HOME environment variable is pointing to correct installation.N) �os�walkr �path�split�joinr �formatr )r � java_homeZnon_supported_jvmZfound_non_supported_jvm�root�_�names� candidater
r
r �find_libjvm` s
�zJVMFinder.find_libjvmc c s� g }d}|D ]�}t j�|�sqtt �|��D ]f}t j�t j�||��}||v s,t j�|�s\q,t j�|�� � }|D ] }||v rp|�
|� |V q,qpq,qdS )a*
Generator that looks for the first-level children folders that could be
Java installations, according to their name
Parameters:
parents (str[]): A list of parent directories
Returns:
A list of the possible JVM installation folders
)ZjreZjdk�javaN)r# r% �exists�sorted�listdir�realpathr'