+
    i*  c                   s    ^ RI t ^ RIt^ RIt^ RIHtHtHtHtHt ^ RI	H
t
  ! R R]4      t ! R R]]]4      t ! R R	]]4      tR# )
i    N)PluginRedHatPluginDebianPluginUbuntuPlugin	PluginOpt)
RHELPolicyc                   s>   a  ] tR t^t o RtRtRtRtR	tRt	R t
RtV tR# )
PythonzfCaptures information on the installed python runtime(s), as well as
python modules installed via pip.
zPython runtimepythonz	python -Vc                s    V P                  V P                  R R7       V P                  R4      pVR,          ^ 8X  d<   VR,          P                  4       R,           F  pV P                  V R24       K  	  R# R# )zpython-version)Zsuggest_filenamezwhereis pip -bZstatusZoutput:i   NNz -v list installedN)add_cmd_outputpython_versionZexec_cmdZsplit)selfZpipsZpips   &  >/usr/lib/python3.14/site-packages/sos/report/plugins/python.pysetupZPython.setup!   sz    2B 	 	
 }}-.>Q H~++-b11##se+=$>? 2	      N)Zsystem)r   )__name__
__module____qualname____firstlineno____doc__Z
short_descZplugin_nameZprofilespackagesr	   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s1      "JKHH N
@ 
@r   r   c                   s    ] tR t^.tRtRtRtR# )UbuntuPython
python3 -Vr   N)python3)r   r   r   r   r	   r   r   r   r   r   r   r   .   s    !NHr   r   c                   s^   a a ] tR t^4t oRtR
t]! RRRR7      .tV 3R ltR t	R t
R	tVtV ;t# )RedHatPythona  In addition to the base information, on Red Hat family distributions the
python plugin also supports the 'hashes' option. If enabled, this plugin
will generate a json-formatted listing of all pyfiles within the
distribution-standard python package installation locations.
hashesFz#collect hashes for all python files)ZdefaultZdescc                s   < V P                  R R.4       \        V P                  \        4      '       d'   V P                  P	                  4       ^8X  d   RV n        \        SV `  4        R# )z
python2 -Vr   z/usr/libexec/platform-python -VN)r   Z
isinstanceZpolicyr   Zdist_versionr	   Zsuperr   )r
   	__class__s   &r   r   ZRedHatPython.setupA   sM    \<89dkk:..((*a/"CDr   c           	     s   V P                  R 4      '       dZ   V P                  R4      ;_uu_ 4       pVP                  \        P                  ! V P                  4       ^R7      4       RRR4       R# R#   + '       g   i     R# ; i)r   zdigests.json)ZindentN)Z
get_optionZcollection_fileZwritejsonZdumps
get_hashes)r
   Zhfiles   & r   collectZRedHatPython.collectH   sY    ??8$$%%n55DJJt'8CD 65 %555s   6A33B	c                s   R. /p. R	OpV EF  p\         P                  ! V P                  V4      4       F  w  rEpV F  pVP                  R4      '       g   K  V P                  WG4      p \	        VR4      ;_uu_ 4       p	\
        P                  ! 4       p
V	P                  R4      pV'       d%   V
P                  V4       V	P                  R4      pK,  V
P                  4       p
VR,          P                  RVRV
/4       RRR4       K  	  K  	  EK  	  V#   + '       g   i     K  ; i  \         d    T P                  RT 24        EK  i ; i)
z Get the hashes for Python files digestsz.pyZrbi   filepathsha256NzUnable to read python file at )z/usr/libz
/usr/lib64z/usr/local/libz/usr/local/lib64)osZwalkZ	path_joinZendswithZopenhashlibr#   ZreadZupdateZ	hexdigestZappendZIOErrorZ
_log_error)r
   r!   Zpy_pathsZpy_pathZrootZ_ZfilesZ_filer"   ZfileZdigestZdatas   &           r   r   ZRedHatPython.get_hashesM   s0    r

  G"$''$..*A"B"E >>%00 #~~d:H7!(D11T%,^^%5F#'99T?D"& &d 3'+yy%+%5%5%7F#I.55 *H (&7  21 # #C  ,  211 # 7(H+3*)6 7 77s7   *D(>.D-AD=D(D%D(%D((E	E	)r	   )r   Zpython36Zpython2r   zplatform-python)r   r   r   r   r   r   r   Zoption_listr   r    r   r   r   Z__classcell__)r   r   s   @@r   r   r   4   s=      OH(E<	>K
E
" "r   r   )r%   r   r$   Zsos.report.pluginsr    r   r   r   r   Zsos.policies.distros.redhatr   r   r   r   r   r   r   <module>r&      sI      	9 9 2@V @66< ;6< ;r   