Cfc=%dZddlZddlZ ddlmZmZmZmZmZm Z m Z dZ ddddd Z ejd ZGd d eZGd deZdZdZGddeZGddeZy#e $rYUwxYw)z'Functions for working with watch files.N)IterableIteratorListOptionalSequenceTextIOTuplez[-_]?(\d[\-+\.:\~\da-zA-Z]*)z2(?i)\.(?:tar\.xz|tar\.bz2|tar\.gz|zip|tgz|tbz|txz)zL(?i)\.(?:tar\.xz|tar\.bz2|tar\.gz|zip|tgz|tbz|txz)\.(?:asc|pgp|gpg|sig|sign)z%[\+~](debian|dfsg|ds|deb)(\.)?(\d+)?$)z @ANY_VERSION@z @ARCHIVE_EXT@z@SIGNATURE_EXT@z @DEB_EXT@z debian.watchceZdZdZy)MissingVersionzThe version= line is missing.N__name__ __module__ __qualname____doc__./usr/lib/python3/dist-packages/debian/watch.pyr r =s'rr ceZdZdZy)WatchFileFormatErrorz(Raised when the input is not valid. Nr rrrrrAsrrcttj}||d<|jD]\}}|j||}|S)zApply substitutions to a string. :param text: text to apply substitutions to :param package: package name, as a string :return: text with subsitutions applied z @PACKAGE@)dict SUBSTITUTIONSitemsreplace)textpackagesubstskvs rexpandr!FsQ-%%' (F"F; "1||Aq!" KrcH|r t|tj|yN)rloggerwarning)msgstricts r _complainr(Ws "3'' NN3rc<eZdZdZddefdZdZdZeddZ y) WatchFilezA Debian watch file. :ivar entries: list of Watch entries :ivar options: optional list of global options, applied to all Watch entries :ivar version: watch file version Nc>||_|g}||_|g}||_yr#)versionentriesoptions)selfr-r.r,s r__init__zWatchFile.__init__gs-  ?G ?G rc,t|jSr#)iterr-r/s r__iter__zWatchFile.__iter__tsDLL!!rcd}|j|jd|jz|jr$|j||jdz|jD]}|jr$|j||jdz|j|j|j r|jd|j z|jr|jd|jz|j r|jd|j z|jdy)aOWrite the contents of a watch file to a file-like object. Note that this will not preserve the formatting of the original file, and thus it is currently not possible to use this function to parse and reserialize a file and end up with the same contents. :param f: File-like object to write to cNdj|}d|vsd|vrd|zdzSd|zS)N,  zopts=""opts=)join)optsss rserialize_optionsz)WatchFile.dump..serialize_optionss5Aax419!|c))Q; rNz version=%d  r8)r,writer.r-urlmatching_patternscript)r/fr?entrys rdumpzWatchFile.dumpxs  << # GGNT\\1 2 << GG%dll3d: ;\\ E}})%--83>? GGEII %%e4445}}emm+,||ell*+ GGDM rcg}g}|D]}|jdr|js&|jdjdr!|j |jdg|j ||j |g}|rt d||j ||sydj |jd} |jd d \}}|jd k7r tt|j} g} g} |D]}} | d kDr| D cgc]} | j} } dj | j}|sH|jd rf|ddk(r3|jdd}|dk(rtd|z|d|}||d zd}n |ddjdd \}}|jd}ng}|r |jdd \}}tjd|}|rAt!|dft#|jdd z}|dt%|d d z }nt#|jdd}| j t'|g|d|im| j)||| | | S#t$r twxYwcc} w#t$r |dd}d}YwxYw#t$r|}d}YwxYw)a@Parse from the contents that make up a watch file. :param lines: watch file lines to parse :return: instance or None if there are no non-comment lines in the file :raise MissingVersion: if there is no version number declared :raise ValueError: when syntax errors are encountered #r@\z \z*watchfile ended with \; skipping last lineNr=r,r;r:zNot matching " in %rr7z/([^/]*\([^/]*\)[^/]*)$r=)r-r.r,) startswithstriprstripendswithappendr(r<popsplit ValueErrorr intlstripindexrefindallstrtuplelenWatchextend)clslinesr' joined_lines continuedline firstlinekeyvaluer,persistent_optionsr-chunkedchunkoptendopts_strr=rBmpartss r from_lineszWatchFile.from_liness   Ds#::<{{4 ))$/  V!45  &##I.    CV L    *GGL,,Q/0  #"a0JC 99;) # " "ekkm$#& 0G{8??e5<<>??777#))+Dw'7c>!ZZQ/F|()?$)FGG#Af~Hq ?D"+/8>>$+B(4 ~~c* $ 4 3ICJJ93? 1YME$**T12E,FFEmAaD z!|,C!$**T1"56EuS<5rs$.       5K &:    > *(Y(: "IJIJX*/F*/Q  sA,,A43A4