
    \e                     N    d Z ddlZddlZddlmZ  G d dej
                        Zy)z"Classes related to cdrom handling.    N)CdromProgressc            	           e Zd ZdZ	 	 	 ddedz  dedz  deddfdZddedz  defdZddedz  defd	Z	e
defd
       Zy)Cdroma;  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.
    Nprogress
mountpointnomountreturnc                 >   t         j                  j                  |        |t               | _        n|| _        | t         j
                  j                  d|       |r!t         j
                  j                  dd       y t         j
                  j                  dd       y )NzAcquire::cdrom::mountzAPT::CDROM::NoMounttruefalse)apt_pkgr   __init__r   	_progressconfigset)selfr   r   r   s       +/usr/lib/python3/dist-packages/apt/cdrom.pyr   zCdrom.__init__/   st     	t$*_DN%DN!NN6
CNN4f=NN4g>    c                 ^    t         j                  j                  | |xs | j                        S )zAdd cdrom to the sources.list.)r   r   addr   r   r   s     r   r   z	Cdrom.addC   s"    }}  x'A4>>BBr   c                 ^    t         j                  j                  | |xs | j                        S )zIdentify the cdrom.)r   r   identr   r   s     r   r   zCdrom.identG   s"    }}""4)CT^^DDr   c                    | j                         }|yt        j                  t        j                  j	                  d      dz         }|j                  t        j                  j                  d             |D ]M  }t        |      5 }|D ]1  }|j                         j                  d      r#||v s( ddd        y 	 ddd       O y# 1 sw Y   ZxY w)z:Check if the cdrom is already in the current sources.list.NFzDir::Etc::sourceparts*zDir::Etc::sourcelist#T)
r   globr   r   find_dirappend	find_fileopenlstrip
startswith)r   cd_idsrcfnamefobjlines         r   in_sources_listzCdrom.in_sources_listK   s     

=ii//0GH3NO

7>>++,BCD 	$Ee $  $D;;=33C8Ud]#$ $$$ $	$
 	$ $s   %C
-C
2C
=C

C	)NNT)N)__name__
__module____qualname____doc__r   strboolr   r   r   propertyr)    r   r   r   r      s    $ *.!%	?$&? $J? 	?
 
?(CMD0 CD CEmd2 Ec E   r   r   )r-   r   r   apt.progress.baser   r   r1   r   r   <module>r3      s#   , )   +=GMM =r   