HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/debian/__pycache__/debian_support.cpython-38.pyc
U

���ak�@s�dZddlZddlZddlZzLddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZWnek
r|YnXddlmZzddlZe��dZWnek
r�dZYnXzddlZejZWnek
r�dd�ZYnXzddlZejZ Wnek
�rd	d
�Z YnXGdd�de!�Z"Gd
d�de#�Z$Gdd�de$�Z%Gdd�de$�Z&e�rvGdd�de%�Z'nGdd�de&�Z'dd�Z(Gdd�d�Z)Gdd�d�Z*Gdd�de*�Z+dd�Z,ee,�Z-e,�Z.d6d d!�Z/ee/�Z0[-[,d"d#�Z1d$d%�Z2ee2�Z3d&Z4e�5e4�Z6e�5e4�7d'��Z8d7d(d)�Z9ee9�Z:d*d+�Z;ee;�Z<d8d,d-�Z=ee=�Z>d.d/�Z?ee?�Z@d0d1�ZAeeA�ZBd9d2d3�ZCeeC�ZDd4d5�ZEeeE�ZFdS):z2 Facilities to deal with Debian-specific metadata �N)�Any�AnyStr�BinaryIO�Dict�Iterable�Iterator�	Generator�List�Match�NoReturn�Optional�Pattern�Text�TextIO�Tuple�Union)�function_deprecated_byTFcGstd��dS�Nz�Built-in sha1 implementation not found; cannot use hashlib implementation because it depends on OpenSSL, which may not be linked with this library due to license incompatibilities��NotImplementedError��args�r�7/usr/lib/python3/dist-packages/debian/debian_support.py�new_sha1?s�rcGstd��dSrrrrrr�
new_sha256Ns�rcs@eZdZdZ�fdd�Zdd�Zdd�Zdd	�Zee�Z	�Z
S)
�
ParseErrorz�An exception which is used to signal a parse failure.

    Attributes:

    filename - name of the file
    lineno - line number in the file
    msg - error message

    cs4t|t�st�||_||_||_tt|��|�dS�N)	�
isinstance�int�AssertionError�filename�lineno�msg�superr�__init__)�selfr!r"r#��	__class__rrr%bs
zParseError.__init__cCs|jSr)r#�r&rrr�__str__nszParseError.__str__cCsd|j|j|jfS)NzParseError(%r, %d, %r))r!r"r#r)rrr�__repr__rs�zParseError.__repr__cCs&|�d|j|j|jf�|��dS)z0Writes a machine-parsable error message to file.z
%s:%d: %s
N)�writer!r"r#�flush)r&�filerrr�	print_outxszParseError.print_out)�__name__�
__module__�__qualname__�__doc__r%r*r+r/rZprintOut�
__classcell__rrr'rrWs
rcs�eZdZdZe�d�ZdZdd�Zdd�Z	�fdd	�Z
�fd
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Z�ZS)"�BaseVersiona�Base class for classes representing Debian versions

    It doesn't implement any comparison, but it does check for valid versions
    according to Section 5.6.12 in the Debian Policy Manual.  Since splitting
    the version into epoch, upstream_version, and debian_revision components is
    pretty much free with the validation, it sets those fields as properties of
    the object, and sets the raw version to the full_version property.  A
    missing epoch or debian_revision results in the respective property set to
    None.  Setting any of the properties results in the full_version being
    recomputed and the rest of the properties set from that.

    It also implements __str__, just returning the raw version given to the
    initializer.
    zd^((?P<epoch>\d+):)?(?P<upstream_version>[A-Za-z0-9.+:~-]+?)(-(?P<debian_revision>[A-Za-z0-9+.~]+))?$)�full_version�epoch�upstream_version�debian_revision�debian_versioncCst|t�rt|�}||_dSr)rr5�strr6�r&�versionrrrr%�s
zBaseVersion.__init__cCsr|j�|�}|std|��|�d�dkrDd|�d�krDtd|��||_|�d�|_|�d�|_|�d�|_dS)NzInvalid version string %rr7�:r8r9)�re_valid_version�match�
ValueError�groupZ_BaseVersion__full_version�_BaseVersion__epoch�_BaseVersion__upstream_version�_BaseVersion__debian_revision)r&r=�mrrr�_set_full_version�szBaseVersion._set_full_versioncs�||jkr tt|��||�dS|dkr,d}|dkrD|�t|��nt|dk	rTt|�}d|}t||�}t|||�z|��Wn8t	k
r�t|||�|��t	d||f��YnXdS)Nr:r9r6�_BaseVersion__%sz+Setting %s to %r results in invalid version)
�magic_attrsr$r5�__setattr__rGr;�getattr�setattr�_update_full_versionrA)r&�attr�value�private�	old_valuer'rrrJ�s(

�zBaseVersion.__setattr__cs8||jkrtt|��|�S|dkr&d}d|}t||�S)Nr:r9rH)rIr$r5�__getattribute__rK)r&rNrPr'rr�__getattr__�s
zBaseVersion.__getattr__cCsDd}|jdk	r||jd7}||j7}|jr:|d|j7}||_dS)N�r>�-)rCrDrEr6r<rrrrM�s

z BaseVersion._update_full_versioncCs|jdk	r|jSdS)NrT)r6r)rrrr*�szBaseVersion.__str__cCsd|jj|fS)Nz%s('%s'))r(r0r)rrrr+�szBaseVersion.__repr__cCst�dSrr�r&�otherrrr�_compare�szBaseVersion._comparecCs|�|�dkS�Nr�rXrVrrr�__lt__�szBaseVersion.__lt__cCs|�|�dkSrYrZrVrrr�__le__�szBaseVersion.__le__cCs|�|�dkSrYrZrVrrr�__eq__�szBaseVersion.__eq__cCs|�|�dkSrYrZrVrrr�__ne__�szBaseVersion.__ne__cCs|�|�dkSrYrZrVrrr�__ge__�szBaseVersion.__ge__cCs|�|�dkSrYrZrVrrr�__gt__szBaseVersion.__gt__cCstt|��Sr)�hashr;r)rrr�__hash__szBaseVersion.__hash__)r0r1r2r3�re�compiler?rIr%rGrJrSrMr*r+rXr[r\r]r^r_r`rbr4rrr'rr5�s(�
r5cs(eZdZdZ�fdd�Zdd�Z�ZS)�
AptPkgVersionzARepresents a Debian package version, using apt_pkg.VersionComparecs tstd��tt|��|�dS)Nz5apt_pkg not available; install the python-apt package)�
_have_apt_pkgrr$rer%r<r'rrr%szAptPkgVersion.__init__cCst�t|�t|��Sr)�apt_pkg�version_comparer;rVrrrrXszAptPkgVersion._compare)r0r1r2r3r%rXr4rrr'rresrec@sdeZdZdZe�d�Ze�d�Ze�d�Ze�d�Z	dd�Z
edd	��Zed
d��Z
edd
��ZdS)�
NativeVersionzBRepresents a Debian package version, with native Python comparisonz\d+|\D+z\d+z\dz[A-Za-z]c
Cs�|dkrdSt|t�sZztt|��}Wn2tk
rX}ztd||f��W5d}~XYnXt|jpdd�}t|jprd�}||kr�dS||kr�dS|�|jp�d|jp�d�}|dkr�|S|�|jp�d|jp�d�S)N�z&Couldn't convert %r to BaseVersion: %s�0���r)	rr5r;rArr7�_version_cmp_partr8r9)r&rW�eZlepochZrepoch�resrrrrX%s.
���zNativeVersion._comparecCsD|dkrdS|j�|�r$t|�dS|j�|�r8t|�St|�dS)z'Return an integer value for character x�~rlrj�)�re_digitr@r�re_alpha�ord)�cls�xrrr�_orderDszNativeVersion._ordercsn�fdd�|D�}�fdd�|D�}|s,|rjd}d}|rB|�d�}|rP|�d�}||kr\dS||kr$dSq$dS)Ncsg|]}��|��qSr�rw��.0rv�rurr�
<listcomp>Ssz5NativeVersion._version_cmp_string.<locals>.<listcomp>csg|]}��|��qSrrxryr{rrr|Tsrrlrj)�pop)ru�va�vb�la�lb�a�brr{r�_version_cmp_stringPs

z!NativeVersion._version_cmp_stringc
Cs�|j�|�}|j�|�}|s |r�d}d}|r6|�d�}|rD|�d�}|j�|�r�|j�|�r�t|�}t|�}||krxdS||kr�dSq|�||�}	|	dkr|	SqdS)Nrkrrlrj)�re_all_digits_or_not�findallr}�	re_digitsr@rr�)
rur~rr�r�r�r�ZavalZbvalrorrrrmbs(

zNativeVersion._version_cmp_partN)r0r1r2r3rcrdr�r�rrrsrX�classmethodrwr�rmrrrrris





ric@seZdZdS��VersionN�r0r1r2rrrrr�}sr�c@seZdZdSr�r�rrrrr��scCs,t|�}t|�}||krdS||kr(dSdS)Nrlrjr)r�)r�r�r~rrrrrh�srhc@sPeZdZdZe�d�Ze�d�Zddd�Zdd	�Z	d
d�Z
ddd
�Zee�Z
dS)�PackageFilezmA Debian package file.

    Objects of this class can be used to read Debian's Source and
    Packages files.z+^([A-Za-z][A-Za-z0-9-_]+):(?:\s*(.*?))?\s*$z^\s+(?:\.|(\S.*?)\s*)$N�utf-8cCs.|dkrt|d�}||_||_d|_||_dS)z�Creates a new package file object.

        name - the name of the file the data comes from
        file_obj - an alternate data source; the default is to open the
                  file with the indicated name.
        N�rbr)�open�namer.r"�encoding)r&r�Zfile_objr�rrrr%�s
zPackageFile.__init__ccs�|��}|jd7_g}|r�|�d�dkr\|s:|�d�|Vg}|��}|jd7_q|j�|�}|sv|�d�|��\}}|p�d}|��}|jd7_|j�|�}|r�|��\}|dkr�d}d||f}q�q�q�|�||f�q|r�|VdS)Nrjz 	�
zexpected package recordzexpected package fieldrTz%s
%s)	�_aux_read_liner"�strip�raise_syntax_error�re_fieldr@�groups�re_continuation�append)r&�lineZpkgr@r��contentsZ	ncontentsrrr�__iter__�s:


zPackageFile.__iter__cCs$|j��}t|t�r |�|j�S|Sr)r.�readliner�bytes�decoder�)r&r�rrrr��s

zPackageFile._aux_read_linecCs |dkr|j}t|j||��dSr)r"rr�)r&r#r"rrrr��szPackageFile.raise_syntax_error)Nr�)N)r0r1r2r3rcrdr�r�r%r�r�r�rZraiseSyntaxErrorrrrrr��s

�
$	
r�c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�
PseudoEnumz8A base class for types which resemble enumeration types.cCs||_||_dSr)�_namerw)r&r��orderrrrr%�szPseudoEnum.__init__cCsd|jj|jfS)Nz%s(%r))r(r0r�r)rrrr+�szPseudoEnum.__repr__cCs|jSr)r�r)rrrr*�szPseudoEnum.__str__cCs|j|jkSrrxrVrrrr[�szPseudoEnum.__lt__cCs|j|jkSrrxrVrrrr\�szPseudoEnum.__le__cCs|j|jkSrrxrVrrrr]�szPseudoEnum.__eq__cCs|j|jkSrrxrVrrrr^szPseudoEnum.__ne__cCs|j|jkSrrxrVrrrr_szPseudoEnum.__ge__cCs|j|jkSrrxrVrrrr`	szPseudoEnum.__gt__cCs
t|j�Sr)rarwr)rrrrb
szPseudoEnum.__hash__N)r0r1r2r3r%r+r*r[r\r]r^r_r`rbrrrrr��sr�cs&eZdZdZiZd�fdd�	Z�ZS)�Releasez�
    Debian release defined with respect to its name, order of release
    and version. The latter can be empty in case of 'sid'.

    See https://www.debian.org/releases/
    rTcstt|��||�||_dSr)r$r�r%r=)r&r�r�r=r'rrr%szRelease.__init__)rT)r0r1r2r3�releasesr%r4rrr'rr�s�r�cCs<i}d}t|�D] \}}|\}}t|||�||<q|t_|S)z*
     Returns dict of Debian releases
    ))Zbuzzz1.1)Zrexz1.2)Zboz1.3)Zhammz2.0)Zslinkz2.1)Zpotatoz2.2)Zwoodyz3.0)Zsargez3.1)Zetchz4.0)Zlennyz5.0)Zsqueezez6.0)Zwheezy�7)Zjessie�8)Zstretch�9)ZbusterZ10)ZbullseyeZ11)ZbookwormZ12)ZtrixieZ13)ZsidrT)�	enumerater�r�)r��rels�idxZrelr�r=rrr�
list_releases$sr�cCs|dkrt}|�|�Sr)�
_release_list�get)r�r�rrr�intern_releaseIsr�cCs>t�}|D]*}t|t�r$|�|�q
|�|�d��q
|��S�N�UTF-8)rrr��update�encode�	hexdigest��linesrF�lrrr�read_lines_sha256Ws
r�cCs>t�}|D]*}t|t�r$|�|�q
|�|�d��q
|��Sr�)rrr�r�r�r�r�rrr�read_lines_sha1bs
r�z^(\d+)(?:,(\d+))?([acd])$r�c
cs4t|�}|}|D�]}|s,t|t�r(tnt}|�|�}|dkrJtd|��|��\}}}t|�}	|dkrldnt|�}
t	|�dkr�|	d}	|
dkr�|	d}
|	|
gfVqt	|�dkr�|
dk	r�td|��|	}
n|	d}	|
dkr�|	d}
g}|D]4}|dk�rtd|��|d	k�r�q"|�
|�q�|	|
|fVqdS)
a1Converts source to a stream of patches.

    Patches are triples of line indexes:

    - number of the first line to be replaced
    - one plus the number of the last line to be replaced
    - list of line replacements

    This is enough to model arbitrary additions, deletions and
    replacements.
    Nzinvalid patch command: %r�drj�azinvalid patch argument: %r)rT�zend of stream in command: %r)z.
�.s.
�.)�iterrr��_patch_re_b�	_patch_rer@rAr�rrtr�)
�sourceZre_cmd�iZpatch_rer�r@Zfirst_Zlast_�cmd�first�lastr��crrr�patches_from_ed_scriptus@



r�cCs |D]\}}}||||�<qdS)z2Applies patches to lines.  Updates lines in place.Nr)r�Zpatchesr�r�rrrr�patch_lines�sr�c	Csd|d}z>t|d|d��}|D]}|�|�qW5QRXt�||�W5tj�|�r^t�|�XdS)Nz.newzw+�r�)�os�path�exists�unlinkr�r,�rename)r��localr�Z	local_newZnew_filer�rrr�replace_file�sr�c
	Csvddl}ddl}ddlm}|��\}}z<t�|�|||�\}}|�|d��}|�	�}	W5QRXW5t�|�X|	S)z[Downloads a file from a remote location and gunzips it.

    Returns the lines in the file.rN)�urlretrieveZrt)
�gzip�tempfile�urllib.requestr�Zmkstempr�r��closer��	readlines)
�remoter�r�r��handleZfnamer!�_Zgfiler�rrr�download_gunzip_lines�s

r�cCst|d�}t||�|S)z�Copies a gzipped remote file to the local system.

    remote - URL, without the .gz suffix
    local - name of the local file
    �.gz)r�r�)r�r�r�rrr�
download_file�s
r�c	Csz&t|ddd��}|��}W5QRXWn*tk
rP|rBtd�t||�YSXg}i}ddlm}|d}t�d�}	z&||��}
t	t
||
��}W5QRXWnRtk
r�|r�td	�t||�YStk
r�|r�td
�t||�YSXddd
�|D�k�r&|�rtd�d}t|�}
t}n|�r4td�d}t
|�}
t
}|D�]}|D�]\}}||dk�r�|	�|�\}}|
|k�rR|�r�td�|S�qR||dk�r�|��D]>}|dk�rȐq�|	�|�\}}}|�s�||
k�r�|�|��q��qR||dk�rB|��D],}|dk�r"�q|	�|�\}}}|||<�q�qR|�rRtd|��qR�qH|�s||�rrtd|
�t||�S|D]`}|�r�td|�t|d|d�}||�||k�r�td|��t	|�}t|t|���q�||�}||k�rtd||f��t||�|S)zjUpdates the local file by downloading a remote patch.

    Returns a list of lines in the local file.
    �rr�r�z1update_file: no local copy, downloading full filer)�urlopenz.diff/Indexz\s+z1update_file: could not interpret patch index filez0update_file: could not download patch index filezSHA256-CurrentcSsg|]}|D]\}}|�qqSrr)rz�fields�k�vrrrr|$szupdate_file.<locals>.<listcomp>zupdate_file: using sha256�SHA256zupdate_file: using sha1�SHA1z-Currentz%update_file: local file is up-to-datez-HistoryrTz-Patcheszupdate_file: field %r ignoredz*update_file: could not find historic entryz!update_file: downloading patch %rz.diff/r�zpatch %r was garbledz"patch failed, got %s instead of %s)r�r��IOError�printr�r�r�rcrd�listr�rr�r��split�
splitlinesr�r�rAr�r�r�)r�r��verboseZ
local_filer�Zpatches_to_applyZpatch_hashesr�Z
index_nameZ
re_whitespaceZ	index_urlZindex_fields�prefixZ
local_hashZ
read_linesr��fieldrOZremote_hashr��entryZ	hist_hashZ
patch_nameZ
patch_hashZpatch_contentsZpatch_contents_unicodeZnew_hashrrr�update_file�s�







�
�
r�cGs(i}|D]}|D]}d||<qqt|�S)zdCreate an order set (represented as a list) of the objects in
    the sequences passed as arguments.T)�sorted)r�srv�yrrr�
merge_as_setsns
r�)N)N)r�)F)Gr3r�Zos.pathrc�typingrrrrrrrr	r
rrr
rrrr�ImportError�debian.deprecationrrgZinitrfZ_sha1�sha1rZ_sha256�sha256r�	Exceptionr�objectr5rerir�rhr�r�r�r�ZlistReleasesr�r�Z
internReleaser�r�Z
readLinesSHA1Z
_patch_re_rawrdr�r�r�r�ZpatchesFromEdScriptr�Z
patchLinesr�ZreplaceFiler�ZdownloadGunzipLinesr�ZdownloadFiler�Z
updateFiler�ZmergeAsSetsrrrr�<module>s�L


	*_R1 

�
;



n