ó ú4Pc@@sYdZddlmZmZddlZddlZddlZddlZddlm Z y ddl Z e j ƒe Z Wnek r•eZ nXdefd„ƒYZdefd„ƒYZd efd „ƒYZd efd „ƒYZe r d efd„ƒYZnd efd„ƒYZd„Zdd"d„ƒYZdd#d„ƒYZdefd„ƒYZd„Ze eƒZeƒd„Ze eƒZ[[d„Ze eƒZ ej!dƒd„Z"e e"ƒZ#d„Z$e e$ƒZ%d„Z&e e&ƒZ'd„Z(e e(ƒZ)d„Z*e e*ƒZ+dd „Z-e e-ƒZ.d!„Z/e e/ƒZ0dS($sHThis module implements facilities to deal with Debian-specific metadata.i(tabsolute_importtprint_functionN(tfunction_deprecated_byt ParseErrorcB@s>eZdZd„Zd„Zd„Zd„ZeeƒZRS(sªAn exception which is used to signal a parse failure. Attributes: filename - name of the file lineno - line number in the file msg - error message cC@s:t|ƒtjkst‚||_||_||_dS(N(ttypettypestIntTypetAssertionErrortfilenametlinenotmsg(tselfRR R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__init__0s  cC@s|jS(N(R (R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__str__6scC@sd|j|j|jfS(NsParseError(%r, %d, %r)(RR R (R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__repr__9s cC@s1|jd|j|j|jfƒ|jƒdS(s0Writes a machine-parsable error message to file.s %s:%d: %s N(twriteRR R tflush(R tfile((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt print_out>s#( t__name__t __module__t__doc__R R RRRtprintOut(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR%s      t BaseVersioncB@sªeZdZejdƒZdZd„Zd„Zd „Z d „Z d „Z d „Z d „Z d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(sôBase class for classes representing Debian versions It doesn't implement any comparison, but it does check for valid versions according to Section 5.6.12 in the Debian Policy Manual. Since splitting the version into epoch, upstream_version, and debian_revision components is pretty much free with the validation, it sets those fields as properties of the object, and sets the raw version to the full_version property. A missing epoch or debian_revision results in the respective property set to None. Setting any of the properties results in the full_version being recomputed and the rest of the properties set from that. It also implements __str__, just returning the raw version given to the initializer. sd^((?P\d+):)?(?P[A-Za-z0-9.+:~-]+?)(-(?P[A-Za-z0-9+.~]+))?$t full_versiontepochtupstream_versiontdebian_revisiontdebian_versioncC@s ||_dS(N(R(R tversion((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR \scC@s«|jj|ƒ}|s+td|ƒ‚n|jdƒdkrhd|jdƒkrhtd|ƒ‚n||_|jdƒ|_|jdƒ|_|jdƒ|_dS(NsInvalid version string %rRt:RR( tre_valid_versiontmatcht ValueErrortgrouptNonet_BaseVersion__full_versiont_BaseVersion__epocht_BaseVersion__upstream_versiont_BaseVersion__debian_revision(R Rtm((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt_set_full_version_s* cC@sý||jkr,tt|ƒj||ƒdS|dkrAd}n|dkrc|jt|ƒƒn–|dk r~t|ƒ}nd|}t||ƒ}t|||ƒy|j ƒWnAt k røt|||ƒ|j ƒt d||fƒ‚nXdS(NRRRs_BaseVersion__%ss+Setting %s to %r results in invalid version( t magic_attrstsuperRt __setattr__R)tstrR#tgetattrtsetattrt_update_full_versionR!(R tattrtvaluetprivatet old_value((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR,ms&       cC@sQ||jkr%tt|ƒj|ƒS|dkr:d}nd|}t||ƒS(NRRs_BaseVersion__%s(R*R+Rt__getattribute__R.(R R1R3((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt __getattr__‡s    cC@s`d}|jdk r)||jd7}n||j7}|jrS|d|j7}n||_dS(NtRt-(R%R#R&R'R(R R((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR0’s  cC@s|jS(N(R(R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR ›scC@sd|jj|fS(Ns%s('%s')(t __class__R(R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRžscC@s t‚dS(N(tNotImplementedError(R tother((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt_compare¡scC@s|j|ƒdkS(Ni(R<(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__lt__§scC@s|j|ƒdkS(Ni(R<(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__le__ªscC@s|j|ƒdkS(Ni(R<(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__eq__­scC@s|j|ƒdkS(Ni(R<(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__ne__°scC@s|j|ƒdkS(Ni(R<(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__ge__³scC@s|j|ƒdkS(Ni(R<(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__gt__¶scC@stt|ƒƒS(N(thashR-(R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__hash__¹s(s full_versionsepochsupstream_versionsdebian_revisionsdebian_version(RRRtretcompileRR*R R)R,R6R0R RR<R=R>R?R@RARBRD(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyREs(             t AptPkgVersioncB@s eZdZd„Zd„ZRS(sARepresents a Debian package version, using apt_pkg.VersionComparecC@s/tstdƒ‚ntt|ƒj|ƒdS(Ns5apt_pkg not available; install the python-apt package(t _have_apt_pkgR:R+RGR (R R((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR ¿scC@stjt|ƒt|ƒƒS(N(tapt_pkgtversion_compareR-(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR<Ås(RRRR R<(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRG¼s t NativeVersioncB@s€eZdZejdƒZejdƒZejdƒZejdƒZd„Z e d„ƒZ e d„ƒZ e d„ƒZ RS( sBRepresents a Debian package version, with native Python comparisons\d+|\D+s\d+s\ds[A-Za-z]cC@sèt|tƒsTytt|ƒƒ}WqTtk rP}td||fƒ‚qTXnt|jpcdƒ}t|jpxdƒ}||krŽdS||krždS|j|j|jƒ}|dkrÆ|S|j|jpØd|jpädƒS(Ns&Couldn't convert %r to BaseVersion: %st0iÿÿÿÿii( t isinstanceRR-R!tintRt_version_cmp_partRR(R R;tetlepochtrepochtres((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR<Òs$     cC@s^|dkrdS|jj|ƒr0t|ƒdS|jj|ƒrLt|ƒSt|ƒdSdS(s'Return an integer value for character xt~iÿÿÿÿiiN(tre_digitR RNtre_alphatord(tclstx((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt_orderës  cC@s·g|D]}|j|ƒ^q}g|D]}|j|ƒ^q)}xl|sS|r²d}d}|rw|jdƒ}n|r|jdƒ}n||krŸdS||krGdSqGWdS(Niiÿÿÿÿi(RZtpop(RXtvatvbRYtlatlbtatb((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt_version_cmp_string÷s""  cC@sø|jj|ƒ}|jj|ƒ}xÍ|s3|ród}d}|rW|jdƒ}n|ro|jdƒ}n|jj|ƒrÎ|jj|ƒrÎt|ƒ}t|ƒ}||kr»dS||krðdSq'|j||ƒ}|dkr'|Sq'WdS(NRLiiÿÿÿÿi(tre_all_digits_or_nottfindallR[t re_digitsR RNRb(RXR\R]R^R_R`RaRS((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyROs($     (RRRRERFRcReRURVR<t classmethodRZRbRO(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRKÊs  tVersioncB@seZRS((RR(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRg!scB@seZRS((RR(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRg$scC@s@t|ƒ}t|ƒ}||kr(dS||kr8dSdSdS(Niÿÿÿÿii(Rg(R`RaR\R]((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRJ's    t PackageFilecB@sYeZdZejdƒZejdƒZdd„Zd„Z dd„Z e e ƒZ RS(smA Debian package file. Objects of this class can be used to read Debian's Source and Packages files.s*^([A-Za-z][A-Za-z0-9-]+):(?:\s*(.*?))?\s*$s^\s+(?:\.|(\S.*?)\s*)$cC@s:|dkrt|ƒ}n||_||_d|_dS(sÜCreates a new package file object. name - the name of the file the data comes from file_obj - an alternate data source; the default is to open the file with the indicated name. iN(R#topentnameRR (R Rjtfile_obj((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR :s    cc@s}|jjƒ}|jd7_g}xD|rj|jdƒdkr“t|ƒdkrd|jdƒn|Vg}|jjƒ}|jd7_q'n|jj|ƒ}|s»|jdƒn|jƒ\}}|pÖd}xxt rS|jjƒ}|jd7_|j j|ƒ}|rO|jƒ\}|dkr<d}nd||f}qÜPqÜW|j ||fƒq'W|ry|VndS( Nis s isexpected package recordsexpected package fieldR7s%s %s( RtreadlineR tstriptlentraise_syntax_errortre_fieldR tgroupstTruetre_continuationR#tappend(R tlinetpkgR Rjtcontentst ncontents((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__iter__Gs<     cC@s1|dkr|j}nt|j||ƒ‚dS(N(R#R RRj(R R R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRojs  N( RRRRERFRpRsR#R RyRoRtraiseSyntaxError(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRh1s # t PseudoEnumcB@sheZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( s8A base class for types which resemble enumeration types.cC@s||_||_dS(N(t_nameRZ(R Rjtorder((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR ss cC@sd|jj|jfS(Ns%s(%r)(R9t_name__R|(R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRvscC@s|jS(N(R|(R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR xscC@s|j|jkS(N(RZ(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR=|scC@s|j|jkS(N(RZ(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR>~scC@s|j|jkS(N(RZ(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR?€scC@s|j|jkS(N(RZ(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR@‚scC@s|j|jkS(N(RZ(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRA„scC@s|j|jkS(N(RZ(R R;((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRB†scC@s t|jƒS(N(RCRZ(R ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRDˆs( RRRR RR R=R>R?R@RARBRD(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR{qs         tReleasecB@seZRS((RR(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR‹scC@sQi}d}x5tt|ƒƒD]!}t|||ƒ|||sZ          wV @    2         _