+fvTddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z Gdde Z GddeZd \ZZZZGd d ZGd d eZdej,vrej,ddk7rdZndZddddZedk(redeZej7edej9ej;dZej?dZ ejCe"ejFe"ejHe"ee"e yy)) annotationsN) TracebackType)IOProtocolceZdZddZy)CommandcyN)selfparamss )/usr/lib/python3/dist-packages/debconf.py__call__zCommand.__call__'s N)r str | intreturnstr)__name__ __module__ __qualname__rr rrrr&s rrc eZdZy) DebconfErrorN)rrrr rrrr+srr)lowmediumhighcriticalcVeZdZUdZded<ded<ded<ded<ded<ded<ded <ded <ded <ded <ded <ded<ded<ded<ded<ded<ded<ded<ded<ded< d" d#dZd$dZd%dZd&dZd'dZ d(dZ d)dZ d*dZ d+d Z d,d!Zy)-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')) r beginblockcapbendblockexistfsetgetgoinfoinputprogresspurgeregisterresetsetsettitlesubsttitle unregisterversion_visibleNc djD]}|j||xstj|_|xstj |_tjt_|r t|j|y)Nzcapb set reset title input beginblock endblock go get register unregister subst fset fget visible purge metaget exist version_ settitle info progress data) split setCommandsysstdinreadstdoutwritestderr runFrontEndsetUp)r r/r8r: run_frontendcommands r__init__zDebconf.__init__\sk " %'  %G OOG $  %%CII (cjj ZZ  M 5rc|jd|_|jdddk7rtdd|jz|jj |_|r|j |yy)Nz2.zwrong version: %s)r1versionrr r4 capabilitiesr/)r r/s rr=z Debconf.setUpqsg}}Q' << t #s$7$,,$FG G IIK--/  JJu  rc*tfdy)Nc0jg|i|Sr )r?)argskwr?r s rz$Debconf.setCommand..}s  W Bt Br Br)setattr)r r?s``rr5zDebconf.setCommandys   B rc |dk(rd}|j}|jjdj|djt t ||jj  |jjjd} d|vr|jdd\}}n|d}}t|}|dk(r|S|dk(rZd}tjd |D]=} | j!d r%t#| d k(r| dd k(r|dz }0|| dz }9|| z }?|St%||#t$r(}|jtjk(rYd}~d}~wwxYw) Nr1rDz{} {}   rz(\\.)\rBn)upperr:formatjoinmaprflushr8readlinerstripOSErrorerrnoEINTRr4intre startswithlenr) r r?r respestatus_datastatus unescapedchunks rr?zDebconf.commandsd j G--/ ))'388CVboolrNone)r/r~rr)r?rrr)r?rr rrrrr)rmrrnrrr])rnrrr)rnrrr)rr)rzztype[BaseException] | Noner{zBaseException | Noner|zTracebackType | Nonerr)rrr__doc____annotations__r@r=r5r?rjrortrvrxr}r rrrr2s ( M N M LK M N N N L N N !# $"      * $-L ",(%   rrcBeZdZ d dfd ZddZddZxZS)DebconfCommunicatorc,dd|g}tj|tjtjdd|_t|||jj |jj|rtj|jjtjtjtj|jjtjtjyy)Nzdebconf-communicatez-fnoninteractiveT)r7r9 close_fdsuniversal_newlines)r/r8r:) subprocessPopenPIPEdccommsuperr@r9r7fcntlr8filenoF_SETFD FD_CLOEXECr:)r ownerr/cloexecrH __class__s rr@zDebconfCommunicator.__init__s&'95A4>4D4D //??# 5   dkk00 8I8I    KK ((*EMM5;K;K L KK ))+U]]Ers4#   h  9 BVT8QQh!'!Jbjj( )*b02405) zD) BMM(DEEEG ==0 1D LL8 9EGGI "** "// $K %Lr