Your IP : 216.73.217.13


Current Path : /usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/python.cpython-38.pyc

U

���b	�@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.srcs4eZdZdZdZedddd�gZ�fdd�Z�ZS)	�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)�defaultZdescc
sB|�ddg�t|jt�r.|j��dkr.d|_tt|���|�	d��r>dgi}ddd	d
g}|D]�}t
�|�|��D]�\}}}|D]�}|�||�}|�
d�r�z`t|d��L}	t��}
d
}|	�|�}|r�|
�|�q�q�q�|
��}
|d�||
d��W5QRXWq�tk
�r |�d|�Yq�Xq�qtq`|jt�|�ddd�dS)Nz
python2 -Vr�z/usr/libexec/platform-python -Vr�digestsz/usr/libz
/usr/lib64z/usr/local/libz/usr/local/lib64z.py�rbi)�filepath�sha256z Unable to read python file at %szdigests.jsonT)Zplug_dir)r
�
isinstanceZpolicyrZdist_versionr�superrrZ
get_option�os�walkZ	path_join�endswith�open�hashlibr#�read�updateZ	hexdigest�append�IOErrorZ
_log_errorZadd_string_as_file�json�dumps)
rr Zpy_pathsZpy_path�root�_�filesZfile_r"�fZdigest�chunk�data��	__class__rrrAsT���

����zRedHatPython.setup)	rrrrrrZoption_listr�
__classcell__rrr7rr4s��r)Zsos.report.pluginsrrrrrZsos.policies.distros.redhatrr&r/r*rrrrrrr�<module>s