HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/sos/report/plugins/__pycache__/unpackaged.cpython-39.opt-1.pyc
a

^��c	�@sBddlmZmZddlZddlZddlmZGdd�dee�ZdS)�)�Plugin�RedHatPluginN)�Pathc@seZdZdZdZdd�ZdS)�
UnpackagedzDCollects a list of files that are not handled by the package manager�
unpackagedc	s�dd�}d�fdd�	}�fdd�}�jdd�s2dS��d	���}|��g}t�fd
d��j��jj���D����D]}|||�7}qr�fdd
�|D�}||�}|�d�|��Wd�n1s�0YdS)NcSstjd�d�S)z3Return a list of directories in $PATH.
            �PATH�:)�os�environ�split�rr�A/usr/lib/python3.9/site-packages/sos/report/plugins/unpackaged.py�get_env_path_listsz-Unpackaged.collect.<locals>.get_env_path_listc
s�g}tj|dd�D]�\}}}|rD|D]��fdd�|D�|dd�<q$|D]\}��||�}z"t�t�|�j�rxt|���}Wnt	y�YqHYn0|�
tj�|��qH|D]}|�
tj���||���q�q|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|]}|�vr|�qSrr)�.0�d��err
�
<listcomp>)�z@Unpackaged.collect.<locals>.all_files_system.<locals>.<listcomp>N)
r	�walk�	path_join�stat�S_ISLNK�lstat�st_moder�resolve�	Exception�append�path�realpath)rZexcludeZ	file_list�root�dirs�files�name��selfrr
�all_files_systems$


�
z,Unpackaged.collect.<locals>.all_files_systemc	sJg}|D]<}��|�}��|�r:|�d�|t�|���q|�|�q|S)z4Format the unpackaged list as a string.
            z{} -> {})rZpath_islinkr�formatr	�readlink)r#Zexpanded�f�fpr%rr
�
format_output8s

z)Unpackaged.collect.<locals>.format_outputT)�cmdrc3s0|](�t�fdd��D��rtj���VqdS)csg|]}��|��qSr)�
startswith)r�p��xrr
rNrz0Unpackaged.collect.<locals>.<genexpr>.<listcomp>N)�anyr	rr )r)�pathsr0r
�	<genexpr>Ks�z%Unpackaged.collect.<locals>.<genexpr>csg|]}|�vr|�qSrr)rr1)�all_frpmrr
rSrz&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)r5r3r&r
�collects$

��zUnpackaged.collectN)�__name__�
__module__�__qualname__Z
short_descZplugin_namer:rrrr
rsr)Zsos.report.pluginsrrr	r�pathlibrrrrrr
�<module>	s