HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/sos/report/plugins/__pycache__/python.cpython-310.pyc
o

-�_g'�@szddlZddlZddlZddlmZmZmZmZmZddl	m
Z
Gdd�de�ZGdd�deee�ZGdd	�d	ee�Z
dS)
�N)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPlugin�	PluginOpt)�
RHELPolicyc@s,eZdZdZdZdZdZdZdZdd�Z	d	S)
�PythonznCaptures information on the installed python runtime(s), as well as
    python modules installed via pip.
    zPython runtime�python)�system)r	z	python -VcCsX|j|jdd�|�d�}|ddkr(|d��dd�D]}|�|�d��qdSdS)	Nzpython-version)�suggest_filenamezwhereis pip -b�statusr�output�z list installed)�add_cmd_output�python_version�exec_cmd�split)�self�pips�pip�r�;/usr/lib/python3/dist-packages/sos/report/plugins/python.py�setup!s�
�zPython.setupN)
�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_name�profiles�packagesrrrrrrrsrc@seZdZdZdZdS)�UbuntuPython�
python3 -V)�python3N)rrrrr rrrrr!.sr!csDeZdZdZdZedddd�gZ�fdd�Zd	d
�Zdd�Z	�Z
S)
�RedHatPythona In addition to the base information, on Red Hat family distributions the
    python plugin also supports the 'hashes' option. If enabled, this plugin
    will generate a json-formatted listing of all pyfiles within the
    distribution-standard python package installation locations.
    )r	�python36�python2r#zplatform-python�hashesFz#collect hashes for all python files)�default�desccs<|�ddg�t|jt�r|j��dkrd|_t���dS)Nz
python2 -Vr"�z/usr/libexec/platform-python -V)r�
isinstance�policyr�dist_versionr�superr)r��	__class__rrrAs
zRedHatPython.setupcCsV|�d�r)|�d��}|�tj|��dd��Wd�dS1s"wYdSdS)Nr'zdigests.json�)�indent)�
get_option�collection_file�write�json�dumps�
get_hashes)r�hfilerrr�collectHs

"��zRedHatPython.collectcCs�dgi}gd�}|D]n}t�|�|��D]c\}}}|D][}|�d�s#q|�||�}z<t|d��-}	t��}
|	�d�}|rG|
�|�|	�d�}|s;|
�	�}
|d�
||
d��Wd�n1s_wYWqtyv|�d|���Yqwqq
|S)	z! Get the hashes for Python files �digests)z/usr/libz
/usr/lib64z/usr/local/libz/usr/local/lib64z.py�rbi)�filepath�sha256NzUnable to read python file at )
�os�walk�	path_join�endswith�open�hashlibr>�read�update�	hexdigest�append�IOError�
_log_error)rr;�py_paths�py_path�root�_�files�_filer=�file�digest�datarrrr8Ms@�



�
�������zRedHatPython.get_hashes)rrrrr r�option_listrr:r8�
__classcell__rrr/rr$4s��r$)rDr6r?�sos.report.pluginsrrrrr�sos.policies.distros.redhatrrr!r$rrrr�<module>s