Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/versions.pyc


[XMc@svdZddlZddlZdefdYZeZdefdYZdefdYZd	ZdS(
s0
Versions for Python packages.

See L{Version}.
iNt_infcBseZdZdZRS(s:
    An object that is bigger than all other objects.
    cCs|tkrdSdS(s
        @param other: Another object.
        @type other: any

        @return: 0 if other is inf, 1 otherwise.
        @rtype: C{int}
        ii(R(tselftother((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyt__cmp__s(t__name__t
__module__t__doc__R(((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyRstIncomparableVersionscBseZdZRS(s-
    Two versions could not be compared.
    (RRR(((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyR!stVersioncBsweZdZddZdZdZdZdZdZ	dZ
dZeZeZ
d	Zd
ZRS(s
    An object that represents a three-part version number.

    If running from an svn checkout, include the revision number in
    the version string.
    cCs1||_||_||_||_||_dS(s
        @param package: Name of the package that this is a version of.
        @type package: C{str}
        @param major: The major version number.
        @type major: C{int}
        @param minor: The minor version number.
        @type minor: C{int}
        @param micro: The micro version number.
        @type micro: C{int}
        @param prerelease: The prerelease number.
        @type prerelease: C{int}
        N(tpackagetmajortminortmicrot
prerelease(RR	R
RRR
((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyt__init__-s

				cCs9|j}|j}|r5|dt|7}n|S(so
        Return a string in canonical short version format,
        <major>.<minor>.<micro>[+rSVNVer].
        s+r(tbaset_getSVNVersiontstr(Rtstsvnver((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pytshortAs
cCsE|jdkrd}nd|jf}d|j|j|j|fS(s:
        Like L{short}, but without the +rSVNVer.
        tspre%ss
%d.%d.%d%sN(R
tNoneR
RR(Rtpre((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyRMs		cCsv|j}|rd|}n|jdkr7d}nd|jf}d|jj|j|j|j|j||fS(Ns  #Rs, prerelease=%rs%s(%r, %d, %d, %d%s)%s(	t_formatSVNVersionR
Rt	__class__RR	R
RR(RRR
((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyt__repr__[s
		cCsd|j|jfS(Ns[%s, version %s](R	R(R((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyt__str__mscCst||jstS|j|jkrGtd|j|jfn|jdkr_t}n	|j}|jdkrt}n	|j}t|j	|j
|j|f|j	|j
|j|f}|S(sG
        Compare two versions, considering major versions, minor versions, micro
        versions, then prereleases.

        A version with a prerelease is always less than a version without a
        prerelease. If both versions have prereleases, they will be included in
        the comparison.

        @param other: Another version.
        @type other: L{Version}

        @return: NotImplemented when the other object is not a Version, or one
            of -1, 0, or 1.

        @raise IncomparableVersions: when the package names of the versions
            differ.
        s%r != %rN(t
isinstanceRtNotImplementedR	RR
RRtcmpR
RR(RRR
totherpretx((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyRss(					cCsqddlm}||j}xK|jD]@}t|dr)|jd}|dk	ri|jdSq)q)WdS(s
        Given a readable file object which represents a .svn/entries file in
        format version 4, return the revision as a string.  We do this by
        reading first XML element in the document that has a 'revision'
        attribute.
        i(tparsetgetAttributetrevisiontasciiN(txml.dom.minidomR!tdocumentElementt
childNodesthasattrR"Rtencode(RtentriesFileR!tdoctnodetrev((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyt_parseSVNEntries_4scCs.|j|j|j|jjS(s
        Given a readable file object which represents a .svn/entries file in
        format version 8, return the revision as a string.
        (treadlinetstrip(RR*((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyt_parseSVNEntries_8s


cCstjj|j}|rtjjtjj|jd}tjj	|sUdStjj|d}tjj	|rt|jj
}t|d|d}n	|j}|dkrdStjj|d}t|}y z||SWd|jXWqdSXndS(s?
        Figure out the SVN revision number based on the existance of
        <package>/.svn/entries, and its contents. This requires discovering the
        format version from the 'format' file and parsing the entries file
        accordingly.

        @return: None or string containing SVN Revision number.
        s.svntformatt_parseSVNEntries_tUnknowntentriesN(tsystmodulestgetR	tostpathtjointdirnamet__file__texistsRtfiletreadR0tgetattrt_parseSVNEntriesTenPlustclose(Rtmodtsvnt
formatFileR2tparserR*R5((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyRs(	$	cCs'|j}|dkrdSd|fS(NRs
 (SVN r%s)(RR(Rtver((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyRsN(RRRRRRRRRRR.R1t_parseSVNEntries_9RBRR(((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyR&s					-		
	(cCsd|j|jf}|S(s
    Get a friendly string for the given version object.

    @param version: A L{Version} object.
    @return: A string containing the package and short version number.
    s%s %s(R	R(tversiontresult((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pytgetVersionStrings(	RR6R9tobjectRt	TypeErrorRRRL(((s;/usr/lib/python2.7/dist-packages/twisted/python/versions.pyt<module>	s