;ņ 1Ec@sHdZdkZdkZdefd„ƒYZdefd„ƒYZdS(s0 Versions for Python packages. See L{Version}. NsIncomparableVersionscBstZdZRS(s- Two versions could not be compared. (s__name__s __module__s__doc__(((s./twisted/python/versions.pysIncomparableVersions s sVersioncBs_tZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( s An object that represents a three-part version number. If running from an svn checkout, include the revision number in the version string. cCs(||_||_||_||_dS(N(spackagesselfsmajorsminorsmicro(sselfspackagesmajorsminorsmicro((s./twisted/python/versions.pys__init__s   cCs9|iƒ}|iƒ}|o|d|7}n|SdS(sp Return a string in canonical short version format, ..[+rSVNVer]. s+rN(sselfsbasesss_getSVNVersionssvnver(sselfssvnverss((s./twisted/python/versions.pysshorts   cCsd|i|i|ifSdS(s: Like L{short}, but without the +rSVNVer. s%d.%d.%dN(sselfsmajorsminorsmicro(sself((s./twisted/python/versions.pysbase*scCsQ|iƒ}|od|}nd|ii|i|i|i|i|fSdS(Ns #s%s(%r, %d, %d, %d)%s( sselfs_formatSVNVersionssvnvers __class__s__name__spackagesmajorsminorsmicro(sselfssvnver((s./twisted/python/versions.pys__repr__2s cCs-d|i|i|i|i|iƒfSdS(Ns[%s, version %d.%d.%d%s](sselfspackagesmajorsminorsmicros_formatSVNVersion(sself((s./twisted/python/versions.pys__str__>scCsqt||iƒ otSn|i|ijo tƒ‚nt|i|i |i f|i|i |i fƒSdS(N( s isinstancesothersselfs __class__sNotImplementedspackagesIncomparableVersionsscmpsmajorsminorsmicro(sselfsother((s./twisted/python/versions.pys__cmp__Fs  cCs‡yudkl}||ƒi}xR|iD]G}t|dƒo1|idƒ}|t j o|i dƒSqpq)q)WWn dSnXdS(sĄ Given a readable file object which represents a .svn/entries file, return the revision as a string. If the file cannot be parsed, return the string "Unknown". (sparses getAttributesrevisionsasciisUnknownN( sxml.dom.minidomsparses entriesFilesdocumentElementsdocs childNodessnodeshasattrs getAttributesrevsNonesencode(sselfs entriesFilesnodesrevsparsesdoc((s./twisted/python/versions.pys_parseSVNEntriesSs   cCsutii|iƒ}|oUtiitii |i ƒddƒ}tii |ƒo|i t|ƒƒSqqndS(sJ Figure out the SVN revision number based on the existance of twisted/.svn/entries, and its contents. This requires parsing the entries file and reading the first XML tag in the xml document that has a revision="" attribute. @return: None or string containing SVN Revision number. s.svnsentriesN(ssyssmodulessgetsselfspackagesmodsosspathsjoinsdirnames__file__sentsexistss_parseSVNEntriessopen(sselfsentsmod((s./twisted/python/versions.pys_getSVNVersiones cCs0|iƒ}|tjodSnd|fSdS(Nss (SVN r%s)(sselfs_getSVNVersionsversNone(sselfsver((s./twisted/python/versions.pys_formatSVNVersionws  ( s__name__s __module__s__doc__s__init__sshortsbases__repr__s__str__s__cmp__s_parseSVNEntriess_getSVNVersions_formatSVNVersion(((s./twisted/python/versions.pysVersions      (s__doc__ssyssoss TypeErrorsIncomparableVersionssobjectsVersion(ssyssIncomparableVersionssVersionsos((s./twisted/python/versions.pys? s