
    ~ g                     H    S SK Jr  S SKrS SKrS SKJrJr   " S S\\5      rg)    )PathN)PluginRedHatPluginc                   "    \ rS rSrSrSrS rSrg)
Unpackaged   zDCollects a list of files that are not handled by the package manager
unpackagedc                   ^ ^ S nS	U 4S jjnU 4S jnT R                  SS9(       d  g T R                  S5       nU" 5       m/ n[        U4S jT R                  R	                  T R                  R
                  R                  5       5       5       5      nT H  nXR" U5      -  nM     U VV	s/ s H  u  pX;  d  M  UPM     n
nn	U" U
5      nUR                  SR                  U5      5        S S S 5        g s  sn	nf ! , (       d  f       g = f)
Nc                  F    [         R                  S   R                  S5      $ )z3Return a list of directories in $PATH.
            PATH:)osenvironsplit     ?/usr/lib/python3/dist-packages/sos/report/plugins/unpackaged.pyget_env_path_list-Unpackaged.collect.<locals>.get_env_path_list   s     ::f%++C00r   c                   > / n[         R                  " U SS9 GH*  u  p4nU(       a&  U H   nU Vs/ s H  owU;  d  M
  UPM     snUSS& M"     U H  nT	R                  X85      n  [        R                  " [         R
                  " U 5      R                  5      (       a  [        U 5      R                  5       n UR                  T	R                  X85      [         R                  R                  U 5      /5        M     U HD  nT	R                  X85      nUR                  U[         R                  R                  U5      /5        MF     GM-     U$ s  snf ! [         a     GM  f = f)zReturn 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_system,Unpackaged.collect.<locals>.all_files_system   s(    I%'WWT4%@!E&.2"Cdsl1d"CQ  '!D>>$5D!<<(>(>??#':#5#5#7D $$3RWW5E5Ed5KL " !D>>$5D$$dBGG,<,<T,B%CD ! &A$  #D % ! !s   	E
E
$AE
EEc                 ,  > / nU  H  nTR                  U5      nU nSnTR                  U5      (       aG  US:  aA  [        R                  " U5      nUSU 3-  nUS-  nTR                  U5      (       a  US:  a  MA  UR	                  US-   5        M     U$ )z4Format the unpackaged list as a string.
            r   
   z ->    
)r   path_islinkr   readlinkr    )r'   expandedfileoutlinksr+   s        r   format_output)Unpackaged.collect.<locals>.format_output9   s     H~~d+
 &&t,,;;t,DT$=(CQJE &&t,, d
+  Or   T)cmdr	   c              3      >^#    U  H@  m[        U4S  jT 5       5      (       d  M  [        R                  R                  T5      v   MB     g7f)c              3   F   >#    U  H  nTR                  U5      v   M     g 7fN)
startswith).0pxs     r   	<genexpr>/Unpackaged.collect.<locals>.<genexpr>.<genexpr>V   s     8%Qa%s   !N)anyr   r!   r"   )r?   rA   pathss    @r   rB   %Unpackaged.collect.<locals>.<genexpr>S   s>      .8%88 $  ## .s
   A&A r=   )	test_predicatecollection_filesetpolicymangle_package_pathpackage_manager	all_fileswritejoin)r+   r   r,   r8   ufileall_fsystemall_frpmr!   rA   rpnot_packagednot_packaged_expandedrE   s   `           @r   collectUnpackaged.collect   s    	1
	:	( ""t",!!,/5%'EK -1[[-L-LKK//99;. H /55 -8O['1B<NA[LO$1,$?!KK 567 0/ P 0/s$   A2C;,C5;C5+C;5C;;
D	r   N)__name__
__module____qualname____firstlineno__
short_descplugin_namerW   __static_attributes__r   r   r   r   r      s    $JKI8r   r   )pathlibr   r   r   sos.report.pluginsr   r   r   r   r   r   <module>rb      s#     	  3O8 O8r   