📂 FileMgr
📍
/
usr
/
lib
/
python3
/
dist-packages
/
sos
/
report
/
plugins
/
__pycache__
✏️ /usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/unpackaged.cpython-312.pyc
✕ Tutup
� G%@i� � �H � d dl mZ d dlZd dlZd dlmZmZ G d� dee� Zy)� )�PathN)�Plugin�RedHatPluginc � � e Zd ZdZdZd� Zy)� UnpackagedzDCollects a list of files that are not handled by the package manager� unpackagedc � � �� d� }d � fd� }� fd�}� j d�� sy � j d� 5 } |� �g }t �fd�� j j � j j j � � D � � }�D ] }| ||� z }� |D �� cg c] \ }} | |vs�|�� } }} || � }|j dj |� � d d d � y c c} }w # 1 sw Y y xY w) Nc �F � t j d j d� 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_list s � � �:�:�f�%�+�+�C�0�0r c � �� g }t j | d�� D �] \ }}}|r|D ] }|D �cg c] }||vs�|�� c}|dd � |D ]� }� j ||� } t j t j | � j � rt | � j � } |j � j ||� t j j | � g� �� |D ]D }� j ||� }|j |t j j |� g� �F �� |S c c}w # t $ r Y ��w xY w)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_system sD �� � �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>|dk r9t j |� }|d|� �z }|dz }�j |� r|dk r�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_output9 s� �� � �H�� ,���~�~�d�+������� �&�&�t�,�����;�;�t�,�D��T�$��=�(�C��Q�J�E� �&�&�t�,���� ����d� �+� ,� �Or T)�cmdr c 3 � ��K � | ]7 �t �fd ��D � � r!t j j �� �� �9 y�w)c 3 �@ �K � | ] }�j |� �� � y �w�N)� startswith)�.0�p�xs �r � <genexpr>z/Unpackaged.collect.<locals>.<genexpr>.<genexpr>V s �� �� �8�Q����a��8�s �N)�anyr r r )r; r= �pathss @�r r>