�
�xkdu
� �d � d Z ddlmZ ddlmZ ddlZddlZddlmZ G d� dej � � Z dS )z"Classes related to cdrom handling.� )�print_function)�OptionalN)�
CdromProgressc �@ � e Zd ZdZdd�Zd d�Zd d�Zed� � � 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 �J � t j � | � � |�t � � | _ n|| _ |� t j � d|� � |r"t j � dd� � d S t j � dd� � d S )NzAcquire::cdrom::mountzAPT::CDROM::NoMount�true�false)�apt_pkgr �__init__r � _progress�config�set)�self�progress�
mountpoint�nomounts �+/usr/lib/python3/dist-packages/apt/cdrom.pyr zCdrom.__init__1 s� � ��
���t�$�$�$���*�_�_�D�N�N�%�D�N��!��N���6�
�C�C�C�� ?��N���4�f�=�=�=�=�=��N���4�g�>�>�>�>�>� c �P � t j � | |p| j � � S )zAdd cdrom to the sources.list.)r r �addr
�r r s r r z Cdrom.addA s# � � �}� � ��x�'A�4�>�B�B�Br c �P � t j � | |p| j � � S )zIdentify the cdrom.)r r �identr
r s r r zCdrom.identF s# � � �}�"�"�4��)C�T�^�D�D�Dr c �� � | � � � }|�dS t j t j � d� � dz � � }|� t j � d� � � � |D ]i}t |� � 5 }|D ]<}|� � � � d� � s||v r ddd� � dS �= ddd� � n# 1 swxY w Y �jdS )z:Check if the cdrom is already in the current sources.list.NFzDir::Etc::sourceparts�*zDir::Etc::sourcelist�#T)
r �globr r �find_dir�append� find_file�open�lstrip�
startswith)r �cd_id�src�fname�fobj�lines r �in_sources_listzCdrom.in_sources_listK sC � � �
�
�����=��5��i���/�/�0G�H�H�3�N�O�O���
�
�7�>�+�+�,B�C�C�D�D�D�� $� $�E��e���
$�� � $� $�D��;�;�=�=�3�3�C�8�8� $�U�d�]�]�#�
$�
$�
$�
$�
$�
$�
$�
$�
$��$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$�� �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� ��, )� (� %� %� %� %� %� %� � � � � � � ���� ���� +� +� +� +� +� +�<� <� <� <� <�G�M� <� <� <� <� <r |