&GPc@@s"ddlmZmZddlmZyddlZejeZWne e fk rbe ZnXddl Z ddl Z ddlZddlZddlZddlZyddlmZeZWn'e k rddlmZmZnXy&ddlmZmZeZeZWn-e k rDddlmZeZeZnXddlZejdkrxddlZd Zn d Zed gZ d Z!d ee"fdYZ#de"fdYZ$dee"fdYZ%de%fdYZ&de'fdYZ(de"fdYZ)de'fdYZ*de"fdYZ+de&fdYZ,de,fd YZ-d!e-fd"YZ.d#e-fd$YZ/d%e,fd&YZ0d'e,fd(YZ1d)e.e+fd*YZ2d+e&e+fd,YZ3d-e4fd.YZ5e5Z6dS(/i(tabsolute_importtprint_function(tfunction_deprecated_byN(tStringIO(tBytesIOR(tMappingtMutableMapping(t DictMixint3cC@sJt|tjstSy|jtSWnttjfk rEtSXdS(N(t isinstancetiotIOBasetFalsetfilenotTruetAttributeErrortUnsupportedOperation(tf((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt _is_real_file>s cC@st|tot|dS(NR (R tfilethasattr(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRGss&/usr/share/keyrings/debian-keyring.gpgs /usr/bin/gpgvtTagSectionWrappercB@s2eZdZdZdZdZdZRS(sWrap a TagSection object, using its find_raw method to get field values This allows us to pick which whitespace to strip off the beginning and end of the data, so we don't lose leading newlines. cC@s ||_dS(N(t_TagSectionWrapper__section(tselftsection((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt__init__Vscc@s5x.|jjD]}|jds|VqqWdS(Nt#(Rtkeyst startswith(Rtkey((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt__iter__YscC@s5tg|jjD]}|jds|^qS(NR(tlenRRR(RR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt__len__^scC@sZ|jj|}|dkr-t|n||jdd}|jdjdS(Nt:is s (Rtfind_rawtNonetKeyErrortfindtlstriptrstrip(RRtstdata((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt __getitem__bs  (t__name__t __module__t__doc__RRR R*(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyROs    t OrderedSetcB@sVeZdZgdZdZdZdZdZdZeZ dZ RS(sA set-like object that preserves order when iterating over it We use this to keep track of keys in Deb822Dict, because it's much faster to look up if a key is in a set than in a list. cC@s7t|_g|_x|D]}|j|qWdS(N(tsett_OrderedSet__sett_OrderedSet__ordertadd(Rtiterabletitem((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRxs   cC@s3||kr/|jj||jj|ndS(N(R0R2R1tappend(RR4((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR2~s cC@s$|jj||jj|dS(N(R0tremoveR1(RR4((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR6scC@s t|jS(N(titerR1(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRscC@s t|jS(N(RR1(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR scC@s ||jkS(N(R0(RR4((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt __contains__scC@s"x|D]}|j|qWdS(N(R2(RR3R4((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytextends ( R+R,R-RR2R6RR R8R5R9(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR.qs      t Deb822DictcB@seZdZdddddZdZdZdZdZdZ dZ d Z e j d krxe Znd Zd ZdZd ZRS(s3A dictionary-like object suitable for storing RFC822-like data. Deb822Dict behaves like a normal dict, except: - key lookup is case-insensitive - key order is preserved - if initialized with a _parsed parameter, it will pull values from that dictionary-like object as needed (rather than making a copy). The _parsed dict is expected to be able to handle case-insensitive keys. If _parsed is not None, an optional _fields parameter specifies which keys in the _parsed dictionary are exposed. sutf-8c C@s]i|_t|_d|_||_|dk rt|drQ|j}n t|}y%x|D]\}}|||R#R=RU(RRRR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR*s  cC@sBt|}|jj|y|j|=Wntk r=nXdS(N(RBR=R6R<R$(RR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt __delitem__s   cC@st|}||jkS(N(RBR=(RR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR8s RcC@s:ddjg|jD]\}}d||f^qS(Ns{%s}s, s%r: %r(tjoinR;(RRFRG((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt__repr__scC@sUt|}t|}||ks(tSx&|D]}||||kr/tSq/WtS(N(tsortedR R(Rtothertmykeyst otherkeysR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt__eq__s    cC@s|j|}|S(N(t __class__(Rtcopy((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRa+sN(R+R,R-R#RRURR RWR*RXR8tsystversionthas_keyRZR_t__hash__Ra(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR:s           tDeb822cB@s=eZdddddZdeeddZeeZedZ ddZ dZ dZ e jdkrdZnd Zddd Zd ZeeZd ZeeZd ZeeZddZeeZdZeeZdZeeZddZdZdZRS(sutf-8c C@st|dr|}d}nd}tj|d|d|d|d||dk ry|j||Wqtk r|qXnd|_dS(sCreate a new Deb822 instance. :param sequence: a string, or any any object that returns a line of input each time, normally a file. Alternately, sequence can be a dict that contains the initial key-value pairs. :param fields: if given, it is interpreted as a list of fields that should be parsed (the rest will be discarded). :param _parsed: internal parameter. :param encoding: When parsing strings, interpret them in this encoding. (All values are given back as unicode objects, so an encoding is necessary in order to properly interpret the strings.) R;RCRDRER?N(RR#R:Rt_internal_parsertEOFErrortgpg_info(RtsequencetfieldsRDR?RC((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR5s   c c@str|rt|ri}tjdkr:t|d[^: \t\n\r\f\v]+)\s*:\s*s(?P\S.*?)\s*$t$s^\s(?P.+?)\s*$c@sdkp|kS(N(R#(R(Rk(s1/usr/lib/python2.7/dist-packages/debian/deb822.pytstRR)s ( tretcompileR tsixt string_typesRJt splitlinesR#tgpg_stripped_paragraphRyRUtmatchtgroup( RRjRktkey_parttsingletmultit multidatat wanted_fieldtcurkeytcontentRxtm((Rks1/usr/lib/python2.7/dist-packages/debian/deb822.pyRgsL    cC@s |jS(N(tdump(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt__str__scC@s |jS(N(R(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt __unicode__sRcC@s|jj|jS(N(RtencodeR?(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt __bytes__scC@stj||S(sReturn the self[key] as a string (or unicode) The default implementation just returns unicode(self[key]); however, this can be overridden in subclasses (e.g. _multivalued) that can take special values. (Rt text_type(RR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt get_as_stringscC@s|dkrt}t}nt}|dkr<|j}nx|D]{}|j|}| so|ddkrd||f}nd||f}|s|j|j|qC|j|qCW|r|jSdS(sDump the the contents in the original format If fd is None, return a unicode object. If fd is not None, attempt to encode the output to the encoding the object was initialized with, or the value of the encoding argument if it is not None. This will raise UnicodeEncodeError if the encoding can't support all the characters in the Deb822Dict values. is s%s:%s s%s: %s N( R#RRR R?RtwriteRtgetvalue(RtfdR?t return_stringRRRtentry((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRs      cC@s|jdrtStSdS(Ns (tcountR R(RR(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytis_single_linescC@s|j| S(N(R(RR(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt is_multi_linescC@s*|s |S|s|S|j|r|j|rd}||jdrTd}nt|||j|}|d}}x8|dD],}||krqn|||}|}qW|S|j|r |j|r x=|jtD],}||jtkr|d|}qqW|StdS(Nt s, iis (RRR[tsplitRRRRA(Rts1ts2tdelimtLtprevtmergedR4((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt _merge_fields"s,   cC@s|dkr|}|}n |}|}||kr\||kr\|j||||}n8||kru||}n||kr||}nt|dkr|||BEGIN|END) PGP (?P[^-]+)-----$s^$Rs sSIGNED MESSAGEt SIGNATUREtactiontBEGINtwhattENDsonly blank lines found in inputN(R}R~RRbRcR RVRtstripRR R5RRRh( Rjt gpg_pre_linestlinestgpg_post_lineststatetgpgret blank_linet first_lineRxR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytsplit_gpg_and_payloadhsP         cC@s|j|dS(Ni(R(RoRj((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRscC@sRt|dstdn|jdkrKtj|jd||_n|jS(s Return a GpgInfo object with GPG signature information This method will raise ValueError if the signature is not available (e.g. the original text cannot be found). :param keyrings: list of keyrings to use (see GpgInfo.from_sequence) traw_textsoriginal text cannot be foundtkeyringsN(RRARiR#tGpgInfot from_sequenceR(RR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt get_gpg_infos cC@sq|jdrtdnxL|jdD]:}|sJtdn|djs/tdq/q/WdS(sRaise ValueError if value is not a valid value for key Subclasses that do interesting things for different keys may wish to override this method. s svalue must not end in '\n'isvalue must not have blank linesis$each line must start with whitespaceN(tendswithRARtisspace(RRRRRx((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytvalidate_inputs cC@s'|j||tj|||dS(N(RR:RW(RRRR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRWsN( R+R,R#RRR Rvt classmethodt staticmethodRyRgRRRbRcRRRRRt isSingleLineRt isMultiLineRRRt mergeFieldsRRRRRW(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRf3s8  !)  5    )     #    C     RcB@skeZdZd ZdZdZed dZed d d Z e d Z ed Z RS(s%A wrapper around gnupg parsable output obtained via --status-fd This class is really a dictionary containing parsed output from gnupg plus some methods to make sense of the data. Keys are keywords and values are arguments suitably splitted. See /usr/share/doc/gnupg/DETAILS.gztGOODSIGtEXPSIGt EXPKEYSIGt REVKEYSIGtBADSIGcC@sd|kpd|kS(sIs the signature valid?RtVALIDSIG((R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytvalidscC@sdS(s>Return the primary ID of the signee key, None is not availableN((R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytuidsc C@s|}t|tjr-|jd}nt|tjrQ|jd}n||_||_d}x|D]}|j|sqpn|t|}|jd}|j d}|| }||j kr||djdd}n||djd}|||[a-zA-Z0-9.+\-]{2,})(\s*\(\s*(?P[>=<]+)\s*(?P[0-9a-zA-Z:\-+~.]+)\s*\))?(\s*\[(?P[\s!\w\-]+)\])?\s*$s\s*,\s*s\s*\|\s*s\s*c@s~fdfd}jj|j}tjj|}g|D]%}g|D]}||^qb^qUS(s|Parse a package relationship string (i.e. the value of a field like Depends, Recommends, Build-Depends ...) c@svg}xijj|jD]O}t|r[|ddkr[|jt|dfq|jt|fqW|S(Nit!i(t_PkgRelation__blank_sep_RERRRR5R R(trawtarchstarch(Ro(s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt parse_archsvs c@sjj|}|r|j}i|dd6}|ddkpR|ddksp|d|df|d if the relationship is versioned, None otherwise. operator is one of "<<", "<=", "=", ">=", ">>"; version is the given version as a string. - arch: A list of pairs if the relationship is architecture specific, None otherwise. Polarity is a boolean (false if the architecture is negated with "!", true otherwise), architecture the Debian archtiecture name as a string. Examples: "emacs | emacsen, make, debianutils (>= 1.7)" becomes [ [ {'name': 'emacs'}, {'name': 'emacsen'} ], [ {'name': 'make'} ], [ {'name': 'debianutils', 'version': ('>=', '1.7')} ] ] "tcl8.4-dev, procps [!hurd-i386]" becomes [ [ {'name': 'tcl8.4-dev'} ], [ {'name': 'procps', 'arch': (false, 'hurd-i386')} ] ] c@sj|dkS(N(RR#(R(R(s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR{ s(RtfilterRRRRR(Rt lazy_relsR((Rs1/usr/lib/python2.7/dist-packages/debian/deb822.pyt relationss+   (R+R,R-RtpropertyR(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRs t _multivaluedcB@s)eZdZdZdZdZRS(s7A class with (R/W) support for multivalued fields. To use, create a subclass with a _multivalued_fields attribute. It should be a dictionary with *lower-case* keys, with lists of human-readable identifiers of the fields as the values. Please see Dsc, Changes, and PdiffIndex as examples. cO@stj|||x|jjD]\}}y||}Wntk rSq#nX|j|r}g||<||j}nt||<||j}x<t d|j D]%}|tt ||j qWq#WdS(N(RfRt_multivalued_fieldsR;R$RR5R:tupdateRR#RtzipR(RRRrtfieldRktcontentstupdater_methodRx((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRs    cC@s/|j|jkrntj|||dS(N(RRRfR(RRRR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR/sc C@so|j}||jkr[t}t||drG||g}n|jd||}|j|}y |j}Wntk ri}nXx|D]}x|D]}tj||} y|||} Wnt k r| } nX| t | d| } d| kr"t d|n|jd| qW|jdqW|j j dStj||SdS(NRs Rs5'\n' not allowed in component of multivalued field %ss %s(RRRRRt_fixed_field_lengthsRRRR$RRARR'RfR( RRtkeylRtarraytordert field_lengthsR4Rut raw_valuetlengthRR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR9s6              (R+R,R-RRR(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRs  t_gpg_multivaluedcB@seZdZdZRS(sA _multivalued class that can support gpg signed objects This class's feature is that it stores the raw text before parsing so that gpg can verify the signature. Use it just like you would use the _multivalued class. This class only stores raw text if it is given a raw string, or if it detects a gpg signature when given a file or sequence of lines (see Deb822.split_gpg_and_payload for details). cO@sy|d}Wn#tk r3|jdd}nX|dk rt|tr[||_qt|tjr|jd|_qt |drqy|j |\}}}Wnt k rg}}}nX|rU|rUt }|j dj||j d|j dj||j d|j dj||j|_nyt|}||deZidddgd6dddgd6dddgd6ZRS(tmd5sumtsizeRtfilestsha1schecksums-sha1tsha256schecksums-sha256(R+R,R(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR,stChangescB@sMeZidddddgd6dddgd6dddgd 6Zd ZRS( R-R.RtpriorityRR/R0schecksums-sha1R1schecksums-sha256cC@s|ddd}y|jd\}}Wntk rDd}nX|djdri|dd }n|dd}d |||dfS( s>Return the path in the pool where the files would be installedR/iRt/tmaintsourcetlibis pool/%s/%s/%s(RRAR(RR(Rt subsectiontsubdir((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyt get_pool_paths  (R+R,RR:(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR2s t PdiffIndexcB@sSeZiddgd6dddgd6dddgd6ZedZdZRS(tSHA1R.s sha1-currenttdates sha1-historys sha1-patchescC@sWi}xJ|jD]?}t||dr/qn|j|}i|d6||s-(R+R,RRR#R>(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR;s   tReleasecB@s}eZdZidddgd6dddgd6dddgd6ZdZdZedeZed Zd Z RS( sRepresents a Release file Set the size_field_behavior attribute to "dak" to make the size field length only as long as the longest actual value. The default, "apt-ftparchive" makes the field 16 characters long regardless. R-R.RR0R1sapt-ftparchivecC@s(|dkrtdn ||_dS(Nsapt-ftparchivetdaks<size_field_behavior must be either 'apt-ftparchive' or 'dak'(sapt-ftparchiveRC(RAt_Release__size_field_behavior(RRR((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytset_size_field_behaviors cC@s|jS(N(RD(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR{scC@s>i}x1|jD]&}|j|}i|d6||(RR?RR)((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR#s cC@s]|jdkrdS|jdkrYg||D]}tt|d^q-}t|SdS(Nsapt-ftparchiveiRCR.(tsize_field_behaviorRRVR@(RRR4RA((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR>s -( R+R,R-RRDRERRFR#R>(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRBs   tSourcescB@s,eZdZdddddgZdZRS(s$Represent an APT source package lists build-dependssbuild-depends-indepsbuild-conflictssbuild-conflicts-indeptbinarycO@s*tj|||tj|||dS(N(R,RR(RRRr((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRs(R+R,R-RR(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRGstPackagesc B@s8eZdZddddddddd g Zd ZRS( s$Represent an APT binary package listtdependss pre-dependst recommendstsuggeststbreakst conflictstprovidestreplacestenhancescO@s*tj|||tj|||dS(N(RfRR(RRRr((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR s(R+R,R-RR(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRIs   t_CaseInsensitiveStringcB@s2eZdZdZdZdZdZRS(sCase insensitive string. cC@s7tj||}|j|_t|j|_|S(N(RVt__new__Rt str_lowerthashtstr_lower_hash(Rotstr_R(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRSscC@s|jS(N(RV(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRescC@s|j|jkS(N(RTR(RR\((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR_scC@s|jS(N(RT(R((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyR"s(R+R,R-RSReR_R(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pyRRs    (7t __future__RRtdebian.deprecationRRmRnRRlt ImportErrorRR RPtosR}RRbRMRRR t collectionsRRt_mapping_mixint_mutable_mapping_mixintUserDictRRRcRt frozensetRRtobjectRR.R:RfRRRRRRR*R,R2R;RBRGRIRVRRRB(((s1/usr/lib/python2.7/dist-packages/debian/deb822.pytsh                 "/~RZH7*