HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/sos/report/plugins/__pycache__/python.cpython-39.opt-1.pyc
a

\��h*�@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 -VcCsT|j|jdd�|�d�}|ddkrP|d��dd�D]}|�|�d��q:dS)	Nzpython-version)Zsuggest_filenamezwhereis pip -b�statusr�output�z -v list installed)�add_cmd_output�python_versionZexec_cmd�split)�selfZpipsZpip�r�=/usr/lib/python3.9/site-packages/sos/report/plugins/python.py�setup!s�
zPython.setupN)
�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZprofiles�packagesrrrrrrrsrc@seZdZdZdZdS)�UbuntuPython�
python3 -V)�python3N)rrrrrrrrrr.srcsDeZdZdZdZedddd�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	Zpython36Zpython2rzplatform-python�hashesFz#collect hashes for all python files)�defaultZdesccs<|�ddg�t|jt�r.|j��dkr.d|_t���dS)Nz
python2 -Vr�z/usr/libexec/platform-python -V)r�
isinstanceZpolicyrZdist_versionr�superr)r��	__class__rrrAs�zRedHatPython.setupcCsP|�d�rL|�d��(}|�tj|��dd��Wd�n1sB0YdS)Nrzdigests.json�)�indent)Z
get_optionZcollection_file�write�json�dumps�
get_hashes)rZhfilerrr�collectHs
zRedHatPython.collectcCs�dgi}gd�}|D]�}t�|�|��D]�\}}}|D]�}|�d�sFq6|�||�}zvt|d��X}	t��}
|	�d�}|r�|
�|�|	�d�}qr|
�	�}
|d�
||
d��Wd�n1s�0YWq6ty�|�d|���Yq60q6q(q|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�walkZ	path_join�endswith�open�hashlibr/�read�updateZ	hexdigest�append�IOErrorZ
_log_error)rr,Zpy_pathsZpy_path�root�_�filesZ_filer.�fileZdigest�datarrrr*Ms4�


�*�zRedHatPython.get_hashes)rrrrrrZoption_listrr+r*�
__classcell__rrr#rr4s��r)r4r(r0Zsos.report.pluginsrrrrrZsos.policies.distros.redhatrrrrrrrr�<module>s