File: //usr/lib/python3/dist-packages/apt/__pycache__/utils.cpython-39.pyc
a
?��`�
� @ sX d dl mZ d dlZd dlZd dlmZmZ d dlZd dlZdd� Z dd� Z
dd � ZdS )
� )�print_functionN)�Optional�Tuplec C sR |d }|d }| j | | j| d }| j| d }|dkrJd}|d8 }||fS )z�
get the (year, month) tuple when the maintenance for the distribution
ends. Needs the data of the release and the number of months that
its is supported as input
� r � )ZyearZmonth)Zrelease_dateZm_monthsZyearsZmonthsZsupport_end_yearZsupport_end_month� r �+/usr/lib/python3/dist-packages/apt/utils.py�get_maintenance_end_date s �r c C s� | rt j�| �sdS t �t�| ���L}t�|�}t|�}d|vrPW d � dS |d }t�|�W d � S 1 sv0 Y dS )zF
return the release date as time_t for the given release file
NZDate) �os�path�exists�fdopen�apt_pkgZopen_maybe_clear_signed_fileZTagFile�nextZstr_to_time)r �data�tagZsection�dater r r �"get_release_date_from_release_file2 s
r c C s || vrdS | | }d}|j jD ]J}|du s |jdu r8q |jD ]*\}}|j|kr>|j|kr>|j|kr>|}q>q |stdS | j�|jd d �} | jjD ]z}
|
j D ]n}| r�| j
|j
kr�| jr�tj
�d�}dD ]B}
t�|
j�d|
j|
f }tj�|| �r�|| S q�q�q�dS )z- get the release file that provides this pkg Nr zDir::State::lists)Z InReleaseZReleasezdists_%s_%s)Z_pkgZversion_listZ file_list�origin�label�archiveZ_listZ
find_index�listZindex_filesZdescribeZ
is_trustedr ZconfigZfind_dirZuri_to_filenameZuriZdistr
r r )�cacheZpkgnamer �release�pkgZverZaverZver_fileZ_indexZ indexfileZ metaindex�m�dirnameZrelfile�namer r r �get_release_filename_for_pkgC s@
��
��
�r )Z
__future__r Zdatetimer
�typingr r Zaptr r r r r r r r �<module> s