File: //proc/thread-self/root/usr/lib/python3/dist-packages/apt/__pycache__/cdrom.cpython-38.pyc
U
&��c�
� @ sh d Z ddlmZ zddlmZ W n ek
r4 Y nX ddlZddlZddlm Z G dd� dej
�Z
dS )z"Classes related to cdrom handling.� )�print_function)�OptionalN)�
CdromProgressc @ s: e Zd ZdZddd�Zd
dd�Zddd �Zed
d� �ZdS )�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 C s` t j�| � |d krt� | _n|| _|d k r:t j�d|� |rNt j�dd� nt j�dd� d S )NzAcquire::cdrom::mountzAPT::CDROM::NoMount�trueZfalse)�apt_pkgr �__init__r � _progress�config�set)�self�progressZ
mountpointZnomount� r �+/usr/lib/python3/dist-packages/apt/cdrom.pyr 5 s
zCdrom.__init__c C s t j�| |p| j�S )zAdd cdrom to the sources.list.)r r �addr �r r
r r r r E s z Cdrom.addc C s t j�| |p| j�S )zIdentify the cdrom.)r r �identr r r r r r J s zCdrom.identc
C s� | � � }|dkrdS t�tj�d�d �}|�tj�d�� |D ]J}t|��8}|D ],}|�� � d�sR||krR W 5 Q R � dS qRW 5 Q R X q@dS )z:Check if the cdrom is already in the current sources.list.NFzDir::Etc::sourceparts�*zDir::Etc::sourcelist�#T)
r �globr r
Zfind_dir�appendZ find_file�open�lstrip�
startswith)r Zcd_id�src�fnameZfobj�liner r r �in_sources_listO s
zCdrom.in_sources_list)NNT)N)N) �__name__�
__module__�__qualname__�__doc__r r r �propertyr r r r r r $ s
r )r! Z
__future__r �typingr �ImportErrorr r Zapt.progress.baser r r r r r �<module> s