�
m0h�7 � �x � d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddl!Z"ddl#Z"ddl$Z"ddl%Z"ddl&m'Z( ddl)m*Z* dZ+ejX j[ d d
� Z.dZ/d� Z0d&d
e1de2dz de2dz fd�Z3de1de2de2dz fd�Z4de2de5e1e1f fd�Z6de7fd�Z8dd�de9e1 de7de ddfd�Z:d� Z; d'd�Z<ejz G d� d� � Z> G d � d!� Z? G d"� d#� Z@ G d$� d%e@� ZAy)(z�Abstract Apport user interface.
This encapsulates the workflow and common code for any user interface
implementation (like GTK, Qt, or CLI).
� N)�Sequence)�gettext)�Any)�impl)�get_process_user_and_groupz2.28.1�APPORT_SYMPTOMS_DIRz/usr/share/apport/symptomsi c � � t j d| j dd� � j d� }t |� S # t
t f$ r Y yw xY w)zExtract process ID from report.z
Pid: (.*)
�
ProcStatus� � N)�re�search�get�group�int�
IndexError�AttributeError)�report�pids �+/usr/lib/python3/dist-packages/apport/ui.py�get_pidr ? sM � ���i�i���
�
�<��(D�E�K�K�A�N���3�x�����'� ���s �?A �A�A�key�default�returnc �j � t t j | � S # t t f$ r |cY S w xY w)z�Get an environment variable as integer.
Return None if it doesn't exist or failed to convert to integer.
The optional second argument can specify an alternate default.
)r �os�environ�KeyError�
ValueError)r r s r �_get_env_intr H s3 � ���2�:�:�c�?�#�#���j�!� ����s � �2�2�name�uidc �� � t j ddddt |� | gddd�� }|j dk7 s|j sy t |j j
� � S ) N�pgrepz-nz-x�-uTF)�capture_output�check�textr )�
subprocess�run�str�
returncode�stdoutr �strip)r! r" |