ó
»ÉD[c           @  sG   d  d l  m Z d  d l Z d  d l Z d „  Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   print_functionNc         C  sj   | d } | d } |  j  | |  j | d } |  j | d } | d k r` d } | d 8} n  | | f S(   s³   
    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
    i   i    i   (   t   yeart   month(   t   release_datet   m_monthst   yearst   monthst   support_end_yeart   support_end_month(    (    s-   /usr/lib/python2.7/dist-packages/apt/utils.pyt   get_maintenance_end_date   s    


c         C  sx   |  s t  j j |  ƒ r d St  j t j |  ƒ ƒ } t j | ƒ } t | ƒ } d | k ra d S| d } t j	 | ƒ S(   sF   
    return the release date as time_t for the given release file
    t   DateN(
   t   ost   patht   existst   Nonet   fdopent   apt_pkgt   open_maybe_clear_signed_filet   TagFilet   nextt   str_to_time(   R   t   datat   tagt   sectiont   date(    (    s-   /usr/lib/python2.7/dist-packages/apt/utils.pyt"   get_release_date_from_release_file-   s    
c      	   C  sŒ  | |  k r d S|  | } d } x… | j j D]w } | d k s- | j d k rT q- n  xM | j D]B \ } } | j | k r^ | j | k r^ | j | k r^ | } q^ q^ Wq- W| s² d S|  j j | j d d ƒ }	 x¶ |  j j	 D]¨ }
 xŸ |
 j
 D]” } |	 rì |	 j | j k rì |	 j rì t j j d ƒ } xX d d g D]G } t j |
 j ƒ d |
 j | f } t j j | | ƒ r2| | Sq2Wqì qì WqÜ Wd S(   s-    get the release file that provides this pkg i    s   Dir::State::listst	   InReleaset   Releases   dists_%s_%sN(   R   t   _pkgt   version_listt	   file_listt   origint   labelt   archivet   _listt
   find_indext   listt   index_filest   describet
   is_trustedR   t   configt   find_dirt   uri_to_filenamet   urit   distR   R   R   (   t   cachet   pkgnameR    t   releaset   pkgt   vert   avert   ver_filet   _indext	   indexfilet	   metaindext   mt   dirnamet   relfilet   name(    (    s-   /usr/lib/python2.7/dist-packages/apt/utils.pyt   get_release_filename_for_pkg=   s6    
	(   t
   __future__R    R   R   R	   R   R;   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/utils.pyt   <module>   s
   		