๓
ฤ>Pc           @`  sด   d  Z  d d l m Z m Z d d l Z d d l Z d d l m Z m Z m	 Z	 e d e
 f d     Y Z e   Z d e f d     YZ e d	 e
 f d
     Y Z d   Z d S(   s0   
Versions for Python packages.

See L{Version}.
i    (   t   divisiont   absolute_importN(   t   cmpt
   comparablet   nativeStringt   _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(    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   __cmp__   s    (   t   __name__t
   __module__t   __doc__R   (    (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyR      s   t   IncomparableVersionsc           B`  s   e  Z d  Z RS(   s-   
    Two versions could not be compared.
    (   R	   R
   R   (    (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/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   (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   __init__5   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   _getSVNVersionR   (   R   t   st   svnver(    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   shortI   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(    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyR   U   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   (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   __repr__c   s    		c         C`  s   d |  j  |  j   f S(   Ns   [%s, version %s](   R   R   (   R   (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   __str__u   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   R   R   R   R   (   R   R   R   t   otherpret   x(    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyR   {   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%   R   t   encode(   R   t   entriesFileR$   t   doct   nodet   rev(    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   _parseSVNEntries_4จ   s    c         C`  s.   | j    | j    | j    | j    j   S(   s   
        Given a readable file object which represents a .svn/entries file in
        format version 8, return the revision as a string.
        (   t   readlinet   strip(   R   R-   (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   _parseSVNEntries_8ธ   s    


c   	      C`  s7  t  j j |  j  } | r3t j j t j j | j  d  } t j j	 |  sU d St j j | d  } t j j	 |  rศ t | d   } | j   j   } Wd QXt |  d | j d  d  } n	 |  j } | d k rแ d St j j | d  } t | d  } y  z | |  SWd | j   XWq3d SXn  d S(	   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   .svnt   formatt   rbNt   _parseSVNEntries_R'   t   Unknownt   entries(   t   syst   modulest   getR   t   ost   patht   joint   dirnamet   __file__t   existsR   t   opent   readR3   t   getattrt   decodet   _parseSVNEntriesTenPlust   close(	   R   t   modt   svnt
   formatFilet   fObjR5   t   parserR-   R9   (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyR   ษ   s*    	$"	c         C`  s'   |  j    } | d  k r d Sd | f S(   NR   s
    (SVN r%s)(   R   R   (   R   t   ver(    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyR   ๒   s    N(   R	   R
   R   R   R   R   R   R   R   R   R1   R4   t   _parseSVNEntries_9RG   R   R   (    (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyR   -   s   					-			)c         C`  s   d |  j  |  j   f } | 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   (   t   versiont   result(    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   getVersionString๚   s    (   R   t
   __future__R    R   R:   R=   t   twisted.python.compatR   R   R   t   objectR   t	   TypeErrorR   R   RR   (    (    (    sI   /var/www/html/hlstest/hls-proxy/Twisted-13.2.0/twisted/python/versions.pyt   <module>	   s   	ฬ