P[t@sXdZddlZddlZdZddZddZdd Zd d ZdS) z:Python sys.excepthook hook to generate apport crash dumps.Nz/etc/default/apportcCsjddl}yAtt}|j}WdQX|jd||jdkSWntk redSYnXdS)z4Return whether Apport should generate crash reports.rNz^\s*enabled\s*=\s*0\s*$T)reopenCONFIGreadsearchMIOError)rfZconfr 4/usr/lib/python3/dist-packages/apport_python_hook.pyenableds   r c5Csz|tfkrdSts#dSyddlm}|Wn"tk r_ddlm}YnXddl}ddl}ddlm }m }y2t j j t j jt jtjd}WnQtttfk ryt jdt j}Wntk rdSYnXYnXt j|t j s=t j j| rAdS||sQdSddl} | jj} t|dr|j} | dkrdS| dkrt || q| | d | D]6\}} }|dd|| |r(dndf7grouprr7ZcallPIPEappend)rAr+rErLrrFrGrHmZ dbus_nameZservicesr cpZexeZrunningZservicer r r r-sF !   '     r-cCs tt_dS)zInstall the python apport hook.N)rDr excepthookr r r r installsrT)__doc__rr rr rDr-rTr r r r s    y .