Viewing File: /usr/lib/python2.7/site-packages/sos/plugins/jars.pyc

ó
ÑKjc@sddlZddlZddlZddlZddlZddlmZddlmZm	Z	dee	fd„ƒYZ
dS(iÿÿÿÿN(tpartial(tPlugintRedHatPlugintJarscBszeZdZdZdZdZddd	d
efgZdZdZ	d„Z
ed„ƒZed„ƒZ
ed„ƒZRS(s2Collect information about available Java archives.tjarss1.0.0tjavatappend_locationss,colon-separated list of additional JAR pathstfastttall_known_locationssscan all known pathstslows/usr/share/javas
/usr/lib/javas/opts
/usr/locals/var/libcCs„igd6}g}ttjƒ}|jdƒrG|ttjƒ7}n|jdƒ}|rr||jdƒ7}nxv|D]n}xetj|ƒD]T\}}}xB|D]:}	tjj	||	ƒ}
tj
|
ƒr¥|j|
ƒq¥q¥WqWqyWxg|D]_}tj|ƒ}tj
|ƒ}
|s"|
ròi|d6|
d6|d6}|dj|ƒqòqòWtj|dd	d
dƒ}|j|d
ƒdS(NRR	Rt:tpathtsha1tmaven_idtindentit
separatorst,s: s	jars.json(Rs: (tlistRt
jar_locationst
get_optiontextra_jar_locationstsplittostwalkRtjointis_jartappendtget_maven_idt
get_jar_idtjsontdumpstadd_string_as_file(tselftresultst	jar_pathst	locationstuser_locationstlocationtdirpatht_t	filenamestfilenameRtjar_pathRtjar_idtrecordtresults_str((s4/usr/lib/python2.7/site-packages/sos/plugins/jars.pytsetup0s0





cCswtjj|ƒrstj|ƒrsy2tj|ƒ}d|jƒkrLtSWdQXWqsttj	fk
roqsXnt
S(s§Check whether given file is a JAR file.

        JARs are ZIP files which usually include a manifest
        at the canonical location 'META-INF/MANIFEST.MF'.
        sMETA-INF/MANIFEST.MFN(RRtisfiletzipfilet
is_zipfiletZipFiletnamelisttTruetIOErrort
BadZipfiletFalse(Rtf((s4/usr/lib/python2.7/site-packages/sos/plugins/jars.pyRSs!c
Cs@i}y"tj|ƒ
}tjdƒ}g|jƒD]}|j|ƒr7|^q7}t|ƒdkrndS|j|dƒž}x”|j	ƒD]†}|j
ƒ}|jdƒs‘yM|jdƒ\}}	|j
dƒj
ƒ}|	j
dƒj
ƒ}	|	||<Wqtk
rdSXq‘q‘WWdQXWdQXWntk
r;nX|S(sáExtract Maven coordinates from a given JAR file, if possible.

        JARs build by Maven (most popular Java build system) contain
        'pom.properties' file. We can extract Maven coordinates
         from there.
        s*META-INF/maven/[^/]+/[^/]+/pom.properties$iit#t=tutf8N(R1R3tretcompileR4tmatchtlentNonetopent	readlineststript
startswithRtdecodet
ValueErrorR6(
R+tpropsR9trtxtresulttprops_ftlinetkeytvalue((s4/usr/lib/python2.7/site-packages/sos/plugins/jars.pyRcs*.

cCsˆd}yjt|ddƒF}tjƒ}x0tt|jdƒdƒD]}|j|ƒqFWWdQX|jƒ}Wntk
rƒnX|S(sHCompute JAR id.

        Returns sha1 hash of a given JAR file.
        RtmodetrbiN(	RBthashlibR
titerRtreadtupdatet	hexdigestR6(R+R,R9tmtbuf((s4/usr/lib/python2.7/site-packages/sos/plugins/jars.pyRs"
(sjava(sappend_locationss,colon-separated list of additional JAR pathsRR(s/usr/share/javas
/usr/lib/java(s/opts
/usr/locals/var/lib(t__name__t
__module__t__doc__tplugin_nametversiontprofilesR8toption_listRRR/tstaticmethodRRR(((s4/usr/lib/python2.7/site-packages/sos/plugins/jars.pyRs 	#(RRRRR=R1t	functoolsRtsos.pluginsRRR(((s4/usr/lib/python2.7/site-packages/sos/plugins/jars.pyt<module>s
Back to Directory File Manager