File: //lib/python3/dist-packages/debian/__pycache__/debfile.cpython-38.pyc
U
&]�^p: � @ sb d Z ddlmZmZ ddlZddlZddlZddlZz0ddl m
Z
mZmZm
Z
mZmZmZmZmZ W n ek
rx Y nX ddlmZmZmZ ddlmZ ddlmZ dZd Zd
ddd
gZdZdddddgZ dZ!dZ"dZ#dZ$G dd� de�Z%G dd� de&�Z'G dd� de'�Z(G dd� de'�Z)G d d!� d!e�Z*e+d"k�r^e*ej,d# d$�Z-e-j.�/� Z/e0e/�1d�� dS )%zX Representation of Debian binary package (.deb) files
Debfile Classes
===============
� )�absolute_import�print_functionN) �Any�Dict�IO�Iterator�List�Optional�Text�TypeVar�Union)�ArFile�ArError�ArMember)� Changelog)�Deb822zdata.tarzcontrol.tar�gz�bz2�xzZlzmaz
debian-binaryZpreinstZpostinstZprermZpostrmZconfig�controlzusr/share/doc/%s/changelog.gzz$usr/share/doc/%s/changelog.Debian.gz�md5sumsc @ s e Zd ZdS )�DebErrorN��__name__�
__module__�__qualname__� r r �0/usr/lib/python3/dist-packages/debian/debfile.pyr A s r c @ sz e Zd ZdZdd� Zdd� Zedd� �Zdd � Zddd�Z dd
d�Z
dd� Zdd� Ze
jdk rfdd� Zdd� Zdd� Zd
S )�DebParta� 'Part' of a .deb binary package.
A .deb package is considered as made of 2 parts: a 'data' part
(corresponding to the possibly compressed 'data.tar' archive embedded
in a .deb) and a 'control' part (the 'control.tar.gz' archive). Each of
them is represented by an instance of this class. Each archive should
be a compressed tar archive although an uncompressed data.tar is permitted;
supported compression formats are: .tar.gz, .tar.bz2, .tar.xz .
When referring to file members of the underlying .tar.gz archive, file
names can be specified in one of 3 formats "file", "./file", "/file". In
all cases the file is considered relative to the root of the archive. For
the control part the preferred mechanism is the first one (as in
deb.control.get_content('control') ); for the data part the preferred
mechanism is the third one (as in deb.data.get_file('/etc/vim/vimrc') ).
c C s || _ d | _d S �N)�_DebPart__member�
_DebPart__tgz)�self�memberr r r �__init__W s zDebPart.__init__c
sp | j dk�rj| jj}tj�|�d dd� }|tksF|tksF|tk�r^t j
dk �r|dk�rz@ddl}ddl� ddl
}|jddg|j|jd� fd d
�d�}W n2 ttfk
r� } ztd| ��W 5 d}~X Y nX |�| j�� �d }|jdkr�td
|j ��|�|�}n| j}ztj|dd�| _ W n8 tjtjfk
�rZ } ztd| ��W 5 d}~X Y nX ntd| ��| j S )z�Return a TarFile object corresponding to this part of a .deb
package.
Despite the name, this method gives access to various kind of
compressed tar archives, not only gzipped ones.
N� )� r&