Current File : //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/unpackaged.cpython-312.pyc
�

-�_g�
��H�ddlmZddlZddlZddlmZmZGd�dee�Zy)�)�PathN)�Plugin�RedHatPluginc��eZdZdZdZd�Zy)�
UnpackagedzDCollects a list of files that are not handled by the package manager�
unpackagedc����d�}d	�fd�	}�fd�}�jd��sy�jd�5}|��g}t�fd��jj	�jj
j
��D��}�D]
}|||�z
}�|D��	cgc]\}}	|	|vs�|��}
}}	||
�}|jdj|��ddd�ycc}	}w#1swYyxYw)
Nc�F�tjdjd�S)z3Return a list of directories in $PATH.
            �PATH�:)�os�environ�split���?/usr/lib/python3/dist-packages/sos/report/plugins/unpackaged.py�get_env_path_listz-Unpackaged.collect.<locals>.get_env_path_lists���:�:�f�%�+�+�C�0�0rc���g}tj|d��D�]\}}}|r|D]}|D�cgc]	}||vs�|��c}|dd�|D]�}�	j||�}	tjtj
|�j�rt|�j�}|j�	j||�tjj|�g���|D]D}�	j||�}|j|tjj|�g��F��|Scc}w#t$rY��wxYw)z�Return a list of all files present on the system, excluding
                any directories listed in `exclude`.

            :param path: the starting path
            :param exclude: list of paths to exclude
            T)�topdownN)
r
�walk�	path_join�stat�S_ISLNK�lstat�st_moder�resolve�	Exception�append�path�realpath)
r�exclude�	file_list�root�dirs�files�exc�d�name�selfs
         �r�all_files_systemz,Unpackaged.collect.<locals>.all_files_systemsD����I�%'�W�W�T�4�%@�
E�!��d�E��&�D��.2�"C��a�s�l�1�"C��Q��D�!�	�D��>�>�$��5�D�!��<�<������(>�(>�?�#'��:�#5�#5�#7�D��$�$�����d�3�R�W�W�5E�5E�d�5K�L��	�!�E�D��>�>�$��5�D��$�$�d�B�G�G�,<�,<�T�,B�%C�D�E�
E�$���#D��%�!� �!�s�	D7�D7�AD<�<	E	�E	c���g}|D]{}�j|�}|�}d}�j|�r>|dkr9tj|�}|d|��z
}|dz
}�j|�r|dkr�9|j	|dz��}|S)z4Format the unpackaged list as a string.
            r�
z -> ��
)r�path_islinkr
�readlinkr)r%�expanded�file�out�linksr)s     �r�
format_outputz)Unpackaged.collect.<locals>.format_output9s�����H��
,���~�~�d�+�������
�&�&�t�,�����;�;�t�,�D��T�$��=�(�C��Q�J�E��&�&�t�,��������d�
�+�
,��OrT)�cmdrc3���K�|]7�t�fd��D��r!tjj�����9y�w)c3�@�K�|]}�j|����y�w�N)�
startswith)�.0�p�xs  �r�	<genexpr>z/Unpackaged.collect.<locals>.<genexpr>.<genexpr>Vs�����8�Q����a��8�s�N)�anyr
rr )r;r=�pathss @�rr>z%Unpackaged.collect.<locals>.<genexpr>Ss6������()��8�%�8�8���� � ��#��s�=A�r9)	�test_predicate�collection_file�set�policy�mangle_package_path�package_manager�	all_files�write�join)
r)rr*r5�ufile�all_fsystem�all_frpmrr=�rp�not_packaged�not_packaged_expandedr@s
`           @r�collectzUnpackaged.collects���	1�
	�:	�(�"�"�t�"�,��
�
!�
!�,�
/�	8�5�%�'�E��K���-1�[�[�-L�-L��K�K�/�/�9�9�;�.���H��
6���/��5�5��
6�-8�O�'�1�b�B�h�<N�A�O�L�O�$1�,�$?�!��K�K���� 5�6�7�	8�	8��P�	8�	8�s$�A0C0�%C*�2C*�6+C0�*C0�0C9N)�__name__�
__module__�__qualname__�
short_desc�plugin_namerQrrrrrs��$�J��K�I8rr)�pathlibrr
r�sos.report.pluginsrrrrrr�<module>rYs#���	��3�O8���O8r