o 4fu @sNdZddlmZddlmZddlZddlZddlmZGdddej Z dS)z"Classes related to cdrom handling.)print_function)OptionalN) CdromProgressc@s:eZdZdZd ddZd ddZd dd 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. NTcCsbtj||durt|_n||_|durtjd||r(tjdddStjdddS)NzAcquire::cdrom::mountzAPT::CDROM::NoMounttruefalse)apt_pkgr__init__r _progressconfigset)selfprogress mountpointnomountr+/usr/lib/python3/dist-packages/apt/cdrom.pyr 1s  zCdrom.__init__cCtj||p|jS)zAdd cdrom to the sources.list.)rraddr r rrrrrAz Cdrom.addcCr)zIdentify the cdrom.)rridentr rrrrrFrz Cdrom.identc Cs|}|dur dSttjdd}|tjd|D]0}t|"}|D]}| ds@||vr@WddSq)Wdn1sKwYq dS)z:Check if the cdrom is already in the current sources.list.NFzDir::Etc::sourceparts*zDir::Etc::sourcelist#T) rglobrr find_dirappend find_fileopenlstrip startswith)r cd_idsrcfnamefobjlinerrrin_sources_listKs  zCdrom.in_sources_list)NNT)N) __name__ __module__ __qualname____doc__r rrpropertyr&rrrrr s   r) r* __future__rtypingrrrapt.progress.baserrrrrrs