HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/python.cpython-38.pyc
U

i��d�@szddlmZmZmZmZmZddlmZddlZddl	Z	ddl
Z
Gdd�de�ZGdd�deee�ZGdd	�d	ee�Z
dS)
�)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPlugin�	PluginOpt)�
RHELPolicyNc@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 -VcCsR|j|jdd�|�d�}|ddkrN|d��dd�D]}|�d|�q:dS)	Nzpython-version)Zsuggest_filenamezwhereis pip -bZstatusr�output�z%s list installed)�add_cmd_output�python_versionZexec_cmd�split)�selfZpipsZpip�r�;/usr/lib/python3/dist-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|_tt|���dS)Nz
python2 -Vr�z/usr/libexec/platform-python -V)	r
�
isinstanceZpolicyrZdist_versionr�superrr)r��	__class__rrrAs�zRedHatPython.setupc	Cs<|�d�r8|�d��}|�tj|��dd��W5QRXdS)Nrzdigests.json�)�indent)Z
get_optionZcollection_file�write�json�dumps�
get_hashes)rZhfilerrr�collectHs
zRedHatPython.collectcCs�dgi}ddddg}|D]�}t�|�|��D]�\}}}|D]�}|�d�sJq:|�||�}zbt|d��N}	t��}
|	�d�}|r�|
�|�|	�d�}qv|
�	�}
|d�
||
d	��W5QRXWq:tk
r�|�d
|�Yq:Xq:q,q|S)N�digestsz/usr/libz
/usr/lib64z/usr/local/libz/usr/local/lib64z.py�rbi)�filepath�sha256z Unable to read python file at %s)
�os�walkZ	path_join�endswith�open�hashlibr.�read�updateZ	hexdigest�append�IOErrorZ
_log_error)rr+Zpy_pathsZpy_path�root�_�filesZ_filer-�fZdigest�datarrrr)Ms>��


��zRedHatPython.get_hashes)rrrrrrZoption_listrr*r)�
__classcell__rrr"rr4s��r)Zsos.report.pluginsrrrrrZsos.policies.distros.redhatrr/r'r3rrrrrrr�<module>s