ó
fÛMc           @   s[   d  Z  d d l Z d d l Z d d l m Z d d l m Z d e j f d „  ƒ  YZ d S(   s"   Classes related to cdrom handling.iÿÿÿÿN(   t   AttributeDeprecatedBy(   t   CdromProgresst   Cdromc           B   s_   e  Z d  Z d d e d „ Z d d „ Z d d „ Z e d „  ƒ Z	 e
 j r] e d ƒ Z n  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   /   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   B   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_listF   s    "R!   N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   t   propertyR!   R   t   _COMPAT_0_7R    t   inSourcesList(    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyR      s   	(   R$   R   R   t   apt.deprecationR    t   apt.progress.baseR   R   (    (    (    s-   /usr/lib/python2.7/dist-packages/apt/cdrom.pyt   <module>   s
   