�
Dc``O@ � �B � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl
Z
d dlZd dlm
Z
d dlmZ d� Z G d� d� � Z G d� d� � Z G d � d
� � Z G d� d� � Z G d
� d� � Z G d� d� � Z G d� d� � ZddgZdS )� N)�_)�reducec �b � dddddd�}|� | � � � d� � S )N� � � � )�critical� emergency�high�medium�low�c )�get�lower)�u�urgency_maps �)/usr/share/apt-listchanges/DebianFiles.py�_numeric_urgencyr - s; � �"#�"#�"#�"#�"#� &� &�K� �?�?�1�7�7�9�9�b�)�)�)� c �N � e Zd Z ej d� � Zg d�Zd� Zd� Zd� Z d� Z
dS )�
ControlStanzaz^\S+ \((?P<version>.*)\).*)�Package�Source�Version�Architecture�Statusc �8 � d }|� d� � D ]�}|s d S |d dv r(|r%t | |t | |� � dz |z � � �9|� dd� � \ }}|| j v r$t | ||� � � � � �d }��d S )N�
r )� � �:r )�split�setattr�getattr�fields_to_read�lstrip)�self�s�field�line�values r �__init__zControlStanza.__init__; s� � ����G�G�D�M�M� !� !�D��
�����A�w�+�%�%�� M��D�%���u�)=�)=��)D�t�)K�L�L�L��#�z�z�#�q�1�1���u��D�/�/�/��D�%������8�8�8�8� �E�E� !� !r c �` � t | d| j � � � d� � d S )Nr r r )r% r r# �r( s r �sourcezControlStanza.sourceL s) � ��t�X�t�|�4�4�:�:�3�?�?��B�Br c �j � t | d� � o#| j � d� � d dk S )Nr r r � installed)�hasattrr r# r/ s r r2 zControlStanza.installedO s1 � ��t�X�&�&�S�4�;�+<�+<�S�+A�+A�!�+D��+S�Sr c �� � | j }t | d� � rM| j � | j � � }|r,|� d� � }|� |� � s|S |S )a�
This function returns the version of the package. One would like it to
be the "binary" version, though we have the tough case of source
package whose binary packages versioning scheme is different from the
source one (see OOo, linux-source, ...).
This code does the following, if the Source field is set with a
specified version, then we use the binary version if and only if the
source version is a prefix. We must do that because of binNMUs.
r �version)r r3 �source_version_re�matchr �group�
startswith)r( �vr7 �svs r r5 zControlStanza.versionR sl � �
�L���4��"�"� ��*�0�0���=�=�E��
��[�[��+�+���|�|�B�'�'� ��I��r N)�__name__�
__module__�__qualname__�re�compiler6 r& |