o
    4f                     @   sX   d dl mZ d dlZd dlZd dlmZmZ d dlZd dlZdd Z	dd Z
dd	 ZdS )
    )print_functionN)OptionalTuplec                 C   sR   |d }|d }| j | | j| d  }| j| d }|dkr%d}|d8 }||fS )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      )yearmonth)release_datem_monthsyearsmonthssupport_end_yearsupport_end_month r   +/usr/lib/python3/dist-packages/apt/utils.pyget_maintenance_end_date   s   r   c                 C   s   | rt j| s
dS t t| '}t|}t|}d|vr)	 W d   dS |d }t|W  d   S 1 s<w   Y  dS )zF
    return the release date as time_t for the given release file
    NDate)	ospathexistsfdopenapt_pkgopen_maybe_clear_signed_fileTagFilenextstr_to_time)r   datatagsectiondater   r   r   "get_release_date_from_release_file2   s   
$r    c                 C   s  || vrdS | | }d}|j jD ]%}|du s|jdu rq|jD ]\}}|j|kr4|j|kr4|j|kr4|}qq|s:dS | j|jd d }	| jjD ]=}
|
j	D ]7}|	r|	j
|j
kr|	jrtjd}dD ]!}t|
jd|
j|f  }tj|| r||       S qcqNqIdS )z- get the release file that provides this pkg Nr   zDir::State::lists)	InReleaseReleasezdists_%s_%s)_pkgversion_list	file_listoriginlabelarchive_list
find_indexlistindex_filesdescribe
is_trustedr   configfind_diruri_to_filenameuridistr   r   r   )cachepkgnamer'   releasepkgveraverver_file_index	indexfile	metaindexmdirnamerelfilenamer   r   r   get_release_filename_for_pkgC   sD   





rB   )
__future__r   datetimer   typingr   r   aptr   r   r    rB   r   r   r   r   <module>   s   