
    xkdu                     d    d Z ddlmZ ddlmZ ddlZddlZddlmZ  G d dej	                  Z	dS )z"Classes related to cdrom handling.    )print_function)OptionalN)CdromProgressc                   @    e Zd ZdZddZd	dZd	dZed             ZdS )
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.
    NTc                 J   t           j                            |            |t                      | _        n|| _        | t           j                            d|           |r"t           j                            dd           d S t           j                            dd           d S )NzAcquire::cdrom::mountzAPT::CDROM::NoMounttruefalse)apt_pkgr   __init__r   	_progressconfigset)selfprogress
mountpointnomounts       +/usr/lib/python3/dist-packages/apt/cdrom.pyr   zCdrom.__init__1   s    t$$$*__DNN%DN!N6
CCC 	?N4f=====N4g>>>>>    c                 P    t           j                            | |p| j                  S )zAdd cdrom to the sources.list.)r   r   addr   r   r   s     r   r   z	Cdrom.addA   s#     }  x'A4>BBBr   c                 P    t           j                            | |p| j                  S )zIdentify the cdrom.)r   r   identr   r   s     r   r   zCdrom.identF   s#     }""4)CT^DDDr   c                    |                                  }|dS t          j        t          j                            d          dz             }|                    t          j                            d                     |D ]i}t          |          5 }|D ]<}|                                	                    d          s||v r ddd            dS =	 ddd           n# 1 swxY w Y   jdS )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   sC    

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

7>++,BCCDDD 	$ 	$Ee $  $ $D;;==33C88 $Ud]]#$ $ $ $ $ $ $ $ $$$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ us   1CCC#	&C#	)NNT)N)	__name__
__module____qualname____doc__r   r   r   propertyr*    r   r   r   r       s}          ? ? ? ? C C C C
E E E E
   X  r   r   )
r.   
__future__r   typingr   r   r   apt.progress.baser   r   r0   r   r   <module>r4      s   , ) ( % % % % % %         + + + + + +< < < < <GM < < < < <r   