File: //kunden/lib/python3/dist-packages/breezy/__pycache__/crash.cpython-39.pyc
a
�*�^�% � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl m
Z
mZmZm
Z
mZ ddlmZ dd� Zd d
� Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� ZdS )a Handling and reporting crashes.
A crash is an exception propagated up almost to the top level of Bazaar.
If we have apport <https://launchpad.net/apport/>, we store a report of the
crash using apport into its /var/crash spool directory, from where the user
can either manually send it to Launchpad. In some cases (at least Ubuntu
development releases), Apport may pop up a window asking if they want
to send it.
Without apport, we just write a crash report to stderr and the user can report
this manually if the wish.
We never send crash data across the network without user opt-in.
In principle apport can run on any platform though as of Feb 2010 there seem
to be some portability bugs.
To force this off in brz turn set APPORT_DISABLE in the environment or
-Dno_apport.
� )�absolute_importN� )�bedding�debug�osutils�plugin�trace)�StringIOc
C s� dt jv stj�dd �r"t| |�S zt| |�r4W d S W nj tyh } zt� d| � W Y d }~nBd }~0 t
y� } z"t� d| � t�� W Y d }~n
d }~0 0 t| |�S )NZ no_apportZAPPORT_DISABLEz.couldn't find apport bug-reporting library: %sz,brz: failed to report crash using apport: %r)r �debug_flags�os�environ�get�report_bug_legacy�report_bug_to_apport�ImportErrorr Zmutter� ExceptionZlog_exception_quietly)�exc_info�stderr�e� r �./usr/lib/python3/dist-packages/breezy/crash.py�
report_bugB s
�
"r c s� t �| � � � �d� ddl�� �fdd�}|dtjt�tj�t j dd�f � |d tj
� |�jd
t�
� ddd
�d � |dt�� t�� tj�d�f � � �d� dS )z4Report a bug by just printing a message to the user.�
r Nc s � � �j| ddd�d � d S )N�N � ��widthZsubsequent_indentr )�write�fill)�l��err_file�textwrapr r �
print_wrappedZ s
��z(report_bug_legacy.<locals>.print_wrappedzbrz %s on python %s (%s)
r �Zaliasedzarguments: %r
z plugins: r r r z"encoding: %r, fsenc: %r, lang: %r
�LANGz�
*** Bazaar has encountered an internal error. This probably indicates a
bug in Bazaar. You can help us fix it by filing a bug report at
https://bugs.launchpad.net/brz/+filebug
including this traceback and a description of the problem.
)r �print_exceptionr r"