HOME


Mini Shell 1.0
DIR: /usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/python.cpython-312.pyc
�

i��d���ddlmZmZmZmZmZddlmZddlZddl	Z	ddl
Z
Gd�de�ZGd�deee�ZGd�d	ee�Z
y)
�)�Plugin�RedHatPlugin�DebianPlugin�UbuntuPlugin�	PluginOpt)�
RHELPolicyNc�*�eZdZdZdZdZdZdZdZd�Z	y)	�PythonznCaptures information on the installed python runtime(s), as well as
    python modules installed via pip.
    zPython runtime�python)�system)rz	python -Vc���|j|jd��|jd�}|ddk(r0|dj�ddD]}|jd|z��yy)	Nzpython-version)�suggest_filenamezwhereis pip -b�statusr�output�z%s list installed)�add_cmd_output�python_version�exec_cmd�split)�self�pips�pips   �;/usr/lib/python3/dist-packages/sos/report/plugins/python.py�setupzPython.setup!s|��������2B�	�	
��}�}�-�.����>�Q���H�~�+�+�-�a�b�1�
?���#�#�$7�#�$=�>�
?�	�N)
�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_name�profiles�packagesrr�rrr
r
s'���"�J��K��H��H� �N�
?rr
c��eZdZdZdZy)�UbuntuPython�
python3 -V)�python3N)rrrrr#r$rrr&r&.s��!�N��Hrr&c�J��eZdZdZdZeddd��gZ�fd�Zd�Zd	�Z	�xZ
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�descc����|jddg�t|jt�r$|jj	�dk(rd|_tt|�#�y)Nz
python2 -Vr'�z/usr/libexec/platform-python -V)	r�
isinstance�policyr�dist_versionr�superr*r)r�	__class__s �rrzRedHatPython.setupAsN������\�<�8�9��d�k�k�:�.����(�(�*�a�/�"C�D��
�l�D�'�)rc���|jd�rO|jd�5}|jtj|j�d���ddd�yy#1swYyxYw)Nr-zdigests.json�)�indent)�
get_option�collection_file�write�json�dumps�
get_hashes)r�hfiles  r�collectzRedHatPython.collectHs`���?�?�8�$��%�%�n�5�
E�����D�J�J�t���'8��C�D�
E�
E�%�
E�
E�s�5A"�"A+c	�D�dgi}gd�}|D]�}tj|j|��D]�\}}}|D]�}|jd�s�|j||�}	t	|d�5}	tj�}
|	jd�}|r%|
j|�|	jd�}|r�%|
j�}
|dj||
d��ddd�������|S#1swY�xYw#t$r|jd|z�Y��wxYw)N�digests)z/usr/libz
/usr/lib64z/usr/local/libz/usr/local/lib64z.py�rbi)�filepath�sha256z Unable to read python file at %s)
�os�walk�	path_join�endswith�open�hashlibrF�read�update�	hexdigest�append�IOError�
_log_error)rrC�py_paths�py_path�root�_�files�_filerE�f�digest�datas            rr?zRedHatPython.get_hashesMs8���r�
��
�� �	4�G�"$�'�'�$�.�.��*A�"B�
4���a��"�4�E� �>�>�%�0� �#�~�~�d�E�:�H�4�!�(�D�1��Q�%,�^�^�%5�F�#$�6�6�$�<�D�"&� &�
�
�d� 3�'(�v�v�d�|��#'�&,�%5�%5�%7�F�#�I�.�5�5�,4�*0�7����4�
4�	4�,�����#�4����(J�*2�)3�4�4�s1�#C?�/AC3	�<'C3	�#C?�3C<
�8C?�?D	�D	)rrrrr#r�option_listrrAr?�
__classcell__)r6s@rr*r*4s6����O�H��(�E�<�	>��K�
*�E�
!rr*)�sos.report.pluginsrrrrr�sos.policies.distros.redhatrrGr=rLr
r&r*r$rr�<module>r`sE��9�9�2�	���?�V�?�6�6�<���:�6�<�:r