Current Path : /usr/lib/python2.7/dist-packages/twisted/python/ |
Current File : //usr/lib/python2.7/dist-packages/twisted/python/versions.pyc |
[XMc @ sv d Z d d l Z d d l Z d e f d YZ e Z d e f d YZ d e f d YZ d Z d S( s0 Versions for Python packages. See L{Version}. iNt _infc B s e Z d Z d Z RS( s: An object that is bigger than all other objects. c C s | t k r d Sd S( s @param other: Another object. @type other: any @return: 0 if other is inf, 1 otherwise. @rtype: C{int} i i ( R ( t selft other( ( 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.pyR s t IncomparableVersionsc B s e Z d Z RS( s- Two versions could not be compared. ( R R R ( ( ( s; /usr/lib/python2.7/dist-packages/twisted/python/versions.pyR ! s t Versionc B sw e Z d Z d d Z d Z d Z d Z d Z d Z d Z d Z e Z e 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. c C s1 | | _ | | _ | | _ | | _ | | _ d S( 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( t packaget majort minort microt prerelease( R R R R R R ( ( s; /usr/lib/python2.7/dist-packages/twisted/python/versions.pyt __init__- s c C s9 | j } | j } | r5 | d t | 7} n | S( so Return a string in canonical short version format, <major>.<minor>.<micro>[+rSVNVer]. s +r( t baset _getSVNVersiont str( R t st svnver( ( s; /usr/lib/python2.7/dist-packages/twisted/python/versions.pyt shortA s c C sE | j d k r d } n d | j f } d | j | j | j | f S( s: Like L{short}, but without the +rSVNVer. t s pre%ss %d.%d.%d%sN( R t NoneR R R ( R t pre( ( s; /usr/lib/python2.7/dist-packages/twisted/python/versions.pyR M s c C sv | j } | r d | } n | j d k r7 d } n d | j f } d | j j | j | j | j | j | | f S( Ns #R s , prerelease=%rs %s(%r, %d, %d, %d%s)%s( t _formatSVNVersionR R t __class__R R R R R ( R R R ( ( s; /usr/lib/python2.7/dist-packages/twisted/python/versions.pyt __repr__[ s c C s d | j | j f S( Ns [%s, version %s]( R R ( R ( ( s; /usr/lib/python2.7/dist-packages/twisted/python/versions.pyt __str__m s c C s t | | j s t S| j | j k rG t d | j | j f n | j d k r_ t } n | j } | j d k r t } 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 isinstanceR t NotImplementedR R R R R t cmpR R R ( R R R t otherpret x( ( s; /usr/lib/python2.7/dist-packages/twisted/python/versions.pyR s s( c C sq d d l m } | | j } xK | j D]@ } t | d r) | j d } | d k ri | j d Sq) q) Wd S( 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( t parset getAttributet revisiont asciiN( t xml.dom.minidomR! t documentElementt childNodest hasattrR"