� �v_c@s�dZddlZddlZdefd��YZd�Zd�Zd�Zd�Zd �Z d �Z d �Z y e �Wnek r�Z nXe d kr�d dZejd�ndZdS(s- Module for the ABRT exception handling hook i����Nt RPMinfoErrorcBseZdZRS(s1Exception class for RPMdb-querying related errors(t__name__t __module__t__doc__(((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pyRscCs/ddlm}y|j|�WnnXdS(s&Log message to system logger (journal)i����(tjournalN(tsystemdRtsend(tmsgR((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pytsyslog s cCs�tjdddkr3tjjtjd�}n tjd}d}|r�yddl}t|�}Wq�tk r�}t d�q�Xnyddl }|j |j |j �}|j d�y=|jdd�|jd�|jd �|jd tj��|jd |�|jd |j�d�|jd |�|rd|jddj|��n|jd�x4tjj�D]#\}} |jd|| f�q�W|jd�|j|j�d} x-tr�|jd�} | s�Pn| | 7} q�WWn*|jk r(} t dt| ��nX|j�| j�} t| �dks�| djd� s�| dj� s�t | d�dkr�t d| �nWn't!k r�} t dt| ��nXdS(Nit/i����s?RPM module not available, cannot query RPM db for package namesis/var/runs/abrt/abrt.socketsPOST / HTTP/1.1 s type=Pythonspid=%ssexecutable=%ss reason=%ss backtrace=%ss dso_list=%ss senviron=s%s=%s ttis)communication with ABRT daemon failed: %sisHTTP/ii�s%error sending data to ABRT daemon: %ss5can't communicate with ABRT daemon, is it running? %s("tsystargvtostpathtabspathtNonetrpmt get_dso_listt ImportErrorRtsockettAF_UNIXt SOCK_STREAMt settimeouttconnecttsendalltgetpidt splitlinestjointenviront iteritemstshutdowntSHUT_WRtTruetrecvttimeouttstrtclosetsplittlent startswithtisdigittintt Exception(ttb_textttbt executabletdso_listRtimperrRtstktvtresponsetbuftextparts((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pyt write_dump1s\           cCs�ddl}|j�}|jd|�}y|j�}Wn!tk r]td|��nXdj|d|d|d|d �}|S( s� Returns package name for a given file. @param fpath: filename @type fpath: str @return: package name for the file @rtype: str @throws RPMinfoError: if package for the file cannot be found i����Nt basenamess*Cannot get package and component for file s{0}-{1}-{2}.{3}tnametversiontreleasetarch(RtTransactionSettdbMatchtnextt StopIterationRtformat(tfpathRttstmitheadertpackage((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pytget_package_for_filess   c Cs�ddl}|j|�r-|j|�}nt�}xP|D]H\}}}}}}y|jt|��Wq=tk r�} q=q=Xq=Wy|jttj d��Wntk r�} nXt |�S(s� Get the list of names of the packages whose files appear in the traceback. @param tb: traceback @type tb: traceback @return: list of package names @rtype: list i����Ni( tinspectt istracebacktgetinnerframestsettaddRIRtdiscardR R tlist( R.RJtpackagestframeRDtlinenotfunctctxtidxtrpmerr((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pyR�s   cCsJddl}y|jd�}Wntk r3tSX|jdd�dkS(sR Return True if absolute path requirement is enabled in configuration i����Ns python.conftRequireAbsolutePathtyes(tproblemtload_plugin_conf_filetOsErrortFalsetget(RZtconf((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pytrequire_abs_path�s   c Cs6|\}}}y tjt_ddl}|ttgkrOtj|||�S|tksg|tkr�|j|jkr�tj|||�Sntj d s�tj dddkr�tj ds�dndtj d}t d|�t �nt dtj d�tj ddd kr0t �r0t �q0nddl }|j|||�}|dkr�|tkr�|j|d d�}t|�r�|t|�d }n|j||�} |rt|�d krg} | j|d �tjj|d�| d<| }nd} x"|D]} | t| �d 7} qW| } | | d7} | d7} | dj|�7} |}x|jr|j}qjW|j}| d7} y>x7|jj�D]&\}}| d|t|�f7} q�WWq q Xn-t|�d} | d7} | dj|�7} t| |�WnnXtj|||�S(s� The exception handling function. progname - the name of the application version - the version of the application i����Nit-R s (python %s ...)s;detected unhandled Python exception in 'interactive mode%s's+detected unhandled Python exception in '%s'R tlimitiit:s s% Local variables in innermost frame: s%s: %s ( R t__excepthook__t excepthookterrnotKeyboardInterruptt SystemExittIOErrortOSErrortEPIPER RR,R`t tracebacktformat_exceptionRtIndentationErrort extract_tbR(tformat_exception_onlytextendRRtbasenameR%Rttb_nextttb_frametf_localstitemstreprR9(t.0tetypetvalueR.RfteinfoRltelistttblasttextxttlltntextttttextttraceRRtkeytval((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pythandleMyException�sl    %$            " cCsd�t_dS(s2 Install the exception handling function. cSst|||f�S(N(R�(RyRzR.((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pyt!sN(R Re(((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pytinstallExceptionHandlerst__main__iis Harald Hoyer (RR RR,RRR9RIRR`R�R�teRtdiv0texitt __author__(((s<�/usr/lib64/python2.7/site-packages/abrt_exception_handler.pyts$    B    c