+
    G%@i*                         ^ 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# )
    N)PluginRedHatPluginDebianPluginUbuntuPlugin	PluginOpt)
RHELPolicyc                   >   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                    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)suggest_filenamezwhereis pip -bstatusoutput:   NNz -v list installedN)add_cmd_outputpython_versionexec_cmdsplit)selfpipspips   &  ;/usr/lib/python3/dist-packages/sos/report/plugins/python.pysetupPython.setup!   sz    2B 	 	
 }}-.>Q H~++-b11##se+=$>? 2	      N)system)r   )__name__
__module____qualname____firstlineno____doc__
short_descplugin_nameprofilespackagesr   r   __static_attributes____classdictcell__)__classdict__s   @r   r
   r
      s1      "JKHH N
@ 
@r   r
   c                       ] 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                   ^   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)defaultdescc                   < 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   
isinstancepolicyr   dist_versionr   superr   )r   	__class__s   &r   r   RedHatPython.setupA   sM    \<89dkk:..((*a/"CDr   c           	        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)r0   zdigests.json)indentN)
get_optioncollection_filewritejsondumps
get_hashes)r   hfiles   & r   collectRedHatPython.collectH   sY    ??8$$%%n55DJJt'8CD 65 %555s   6A33B	c                   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.pyrbi   filepathsha256NzUnable to read python file at )z/usr/libz
/usr/lib64z/usr/local/libz/usr/local/lib64)oswalk	path_joinendswithopenhashlibrI   readupdate	hexdigestappendIOError
_log_error)r   rF   py_pathspy_pathroot_files_filerH   filedigestdatas   &           r   rA   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   python36python2r-   zplatform-python)r   r   r    r!   r"   r&   r   option_listr   rC   rA   r'   r(   __classcell__)r8   r)   s   @@r   r/   r/   4   s=      OH(E<	>K
E
" "r   r/   )rO   r?   rJ   sos.report.pluginsr   r   r   r   r   sos.policies.distros.redhatr   r
   r+   r/   r   r   r   <module>rf      sI      	9 9 2@V @66< ;6< ;r   