
Uc           @  s[   d  Z  d d l m Z d d l Z d d l Z d d l m Z d e j f d     YZ d S(   s"   Classes related to cdrom handling.i(   t   print_functionN(   t   CdromProgresst   Cdromc           B  sG   e  Z d  Z d d e d  Z d d  Z d d  Z e d    Z	 RS(   s;  Support for apt-cdrom like features.

    This class has several optional parameters for initialisation, which may
    be used to influence the behaviour of the object:

    The optional parameter `progress` is a CdromProgress() subclass, which will
    ask for the correct cdrom, etc. If not specified or None, a CdromProgress()
    object will be used.

    The optional parameter `mountpoint` may be used to specify an alternative
    mountpoint.

    If the optional parameter `nomount` is True, the cdroms will not be
    mounted. This is the default behaviour.
    c         C  s   t  j j |   | d  k r+ t   |  _ n	 | |  _ | d  k	 rV t  j j d |  n  | rr t  j j d d  n t  j j d d  d  S(   Ns   Acquire::cdrom::mounts   APT::CDROM::NoMountt   truet   false(   t   apt_pkgR   t   __init__t   NoneR   t	   _progresst   configt   set(   t   selft   progresst
   mountpointt   nomount(    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyR   0   s    	c         C  s   t  j j |  | p |  j  S(   s   Add cdrom to the sources.list.(   R   R   t   addR   (   R   R   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyR   ?   s    c         C  s   t  j j |  | p |  j  S(   s   Identify the cdrom.(   R   R   t   identR   (   R   R   (    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyR   C   s    c         C  s   |  j    } | d k r t St j t j j d  d  } | j t j j d   xZ | D]R } t	 |  > } x4 | D], } | j
   j d  rw | | k rw t Sqw WWd QXq[ Wt S(   s:   Check if the cdrom is already in the current sources.list.s   Dir::Etc::sourcepartst   *s   Dir::Etc::sourcelistt   #N(   R   R   t   Falset   globR   R	   t   find_dirt   appendt	   find_filet   opent   lstript
   startswitht   True(   R   t   cd_idt   srct   fnamet   fobjt   line(    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyt   in_sources_listG   s    "N(
   t   __name__t
   __module__t   __doc__R   R   R   R   R   t   propertyR!   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyR      s
   (   R$   t
   __future__R    R   R   t   apt.progress.baseR   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyt   <module>   s
   