o iSbq@sddlmZddlZddlZddlZddlZddlZddlZGdddeZ d\Z Z Z Z GdddZGdd d eeZd ejvrKejd d krKd Znd ZddZedkreeZee deedZedZeeejeejeeeedSdS))print_functionNc@s eZdZdS) DebconfErrorN)__name__ __module__ __qualname__rr)/usr/lib/python3/dist-packages/debconf.pyr"sr)lowmediumhighcriticalc@sbeZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ dS)DebconfaTA class that speaks the debconf protocol. The simplest way to use this is as a context manager: import debconf with debconf.Debconf(run_frontend=True) as db: print(db.get('debconf/frontend')) Note that this will send the STOP command on exiting the context manager, so you shouldn't expect to be able to use the same frontend again after this. If you need to do that, then you should instantiate the class directly instead: import debconf db = debconf.Debconf(run_frontend=True) print(db.get('debconf/frontend')) NFcCsPdD]}||q|ptj|_|ptj|_tjt_|r!t| |dS)Nzcapb set reset title input beginblock endblock go get register unregister subst fset fget previous_module visible purge metaget exist version settitle info progress data) split setCommandsysstdinreadstdoutwritestderr runFrontEndsetUp)selftitlerr run_frontendcommandrrr__init__<s   zDebconf.__init__cCsR|d|_|jdddkrtdd|j||_|r'||dSdS)Nz2.zwrong version: %s)versionrcapbr capabilitiesr)rrrrrrIs z Debconf.setUpcstfdddS)Ncsjg|Ri|SN)r)argskwrrrrSsz$Debconf.setCommand..)setattr)rrrr%rrQs zDebconf.setCommandc Gs"|}|jd|dtt|f|j z |jd}Wnt y=}z |j t j kr8WYd}~qd}~wwd|vrK| dd\}}n|d}}t |}|dkrZ|S|dkrd}t d|D]#}|d rt|d kr|dd kr~|d7}qf||d7}qf||7}qf|St||) Nz%s %s  T rz(\\.)\rn)upperrjoinmapstrflushrreadlinerstripIOErrorerrnoEINTRrintre startswithlenr) rrparamsrespestatusdata unescapedchunkrrrrUs:         zDebconf.commandcCs|jd|jdS)NzSTOP )rr2rrrrstopys z Debconf.stopc CsJz |||WdSty$}z|jddkrWYd}~dSd}~ww)Nr*r)inputrr#)rpriorityquestionr>rrr forceInput}s  zDebconf.forceInputcCs||}|dkS)Ntrueget)rrHresultrrr getBooleans zDebconf.getBooleancCs ||Sr"rK)rrHrrr getStrings zDebconf.getStringcCs|Sr"rrCrrr __enter__szDebconf.__enter__cCs |dSr")rD)rexc_type exc_valueexc_tbrrr__exit__s zDebconf.__exit__)NNNF)rrr__doc__rrrrrDrIrNrOrPrTrrrrr 's  $  r cs.eZdZd fdd ZddZddZZS) DebconfCommunicatorNFcs~dd|g}tj|tjtjddd|_tt|j||jj|jjd|r=t |j t j t j t |j t j t j dSdS)Nzdebconf-communicatez-fnoninteractiveT)rr close_fdsuniversal_newlines)rrr) subprocessPopenPIPEdccommsuperrVrrrfcntlrfilenoF_SETFD FD_CLOEXECr)rownerrcloexecr# __class__rrrs   zDebconfCommunicator.__init__cCs:|jdur|jj|jj|jd|_dSdSr")r\rcloserwaitrCrrrshutdowns     zDebconfCommunicator.shutdowncCs$z|WdStyYdSwr")rhAttributeErrorrCrrr__del__s  zDebconfCommunicator.__del__)NF)rrrrrhrj __classcell__rrrdrrVs rVDEBCONF_USE_CDEBCONFr+z/usr/lib/cdebconf/debconfz/usr/share/debconf/frontendcCs4dtjvrdtjd<ttttjgtjdSdS)NDEBIAN_HAS_FRONTEND1PERL_DL_NONLAZY)osenvironexecv_frontEndProgramr executableargvrrrrrs  r__main__z&bsdmainutils/calendar_lib_is_not_emptyzless/add_mime_handlerzapt-listchanges/email-address) __future__rrrpr6r9rYr^ ExceptionrLOWMEDIUMHIGHCRITICALr objectrVrqrsrrdbrIgorNlessrOaptlcrDprintrr!rrrrs8  m