HEX
Server: Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System: Linux ns565604.ip-54-39-133.net 4.18.0-553.50.1.el8_10.x86_64 #1 SMP Tue Apr 15 08:09:22 EDT 2025 x86_64
User: greer489 (1034)
PHP: 8.3.19
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/sos/report/plugins/__pycache__/unpackaged.cpython-36.opt-1.pyc
3

-�_g�
�@sBddlmZddlZddlZddlmZmZGdd�dee�ZdS)�)�PathN)�Plugin�RedHatPluginc@seZdZdZdZdd�ZdS)�
UnpackagedzDCollects a list of files that are not handled by the package manager�
unpackagedc	s�dd�}d�fdd�	}�fdd�}�jdd�s2dS�jd	��z}|��g}t�fd
d��jj�jjj��D���x�D]}|||�7}qtW�fdd
�|D�}||�}|jdj|��WdQRXdS)NcSstjdjd�S)z3Return a list of directories in $PATH.
            �PATH�:)�os�environ�split�rr� /usr/lib/python3.6/unpackaged.py�get_env_path_listsz-Unpackaged.collect.<locals>.get_env_path_listcs�g}x�tj|dd�D]�\}}}|rJx&|D]��fdd�|D�|dd�<q(Wxp|D]h}�j||�}y"tjtj|�j�r�t|�j�}Wnt	k
r�wPYnX|j
�j||�tjj|�g�qPWx.|D]&}�j||�}|j
|tjj|�g�q�WqW|S)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)�topdowncsg|]}|�kr|�qSrr)�.0�d)�excrr
�
<listcomp>(sz@Unpackaged.collect.<locals>.all_files_system.<locals>.<listcomp>N)
r	�walk�	path_join�stat�S_ISLNK�lstat�st_moderZresolve�	Exception�append�path�realpath)r�excludeZ	file_list�root�dirs�files�name)�self)rr
�all_files_systems$


z,Unpackaged.collect.<locals>.all_files_systemcspg}xf|D]^}�j|�}|�}d}x6�j|�rX|dkrXtj|�}|d|��7}|d7}q$W|j|d�q
W|S)z4Format the unpackaged list as a string.
            r�
z -> ��
)rZpath_islinkr	�readlinkr)r!Zexpanded�file�outZlinks)r#rr
�
format_output9s


z)Unpackaged.collect.<locals>.format_outputT)�cmdrc3s0|](�t�fdd��D��rtjj��VqdS)c3s|]}�j|�VqdS)N)�
startswith)r�p)�xrr
�	<genexpr>Vsz/Unpackaged.collect.<locals>.<genexpr>.<genexpr>N)�anyr	rr)r)�paths)r/r
r0Tsz%Unpackaged.collect.<locals>.<genexpr>csg|]\}}|�kr|�qSrr)rr/Zrp)�all_frpmrr
r[sz&Unpackaged.collect.<locals>.<listcomp>�)N)	Ztest_predicateZcollection_file�setZpolicyZmangle_package_pathZpackage_managerZ	all_files�write�join)	r#rr$r+ZufileZall_fsystemrZnot_packagedZnot_packaged_expandedr)r3r2r#r
�collects 
zUnpackaged.collectN)�__name__�
__module__�__qualname__Z
short_descZplugin_namer8rrrr
rsr)Zpathlibrr	rZsos.report.pluginsrrrrrrr
�<module>	s