
gqIc           @   s4   d  d k  Z  d  d k Z d  d k Z d d  Z d S(   iNc         C   s   d } |  d j o t i d }  n d |  } y t | d  i   } Wn t j
 o n Xt i d |  o1 t i d |  } | o | i	   d } q n< d d k
 l } | i |  } | i d  d i d	  } | o	 d
 | Sd S(   so  
    Returns the SVN revision in the form SVN-XXXX,
    where XXXX is the revision number.

    Returns SVN-unknown if anything goes wrong, such as an unexpected
    format of internal SVN files.

    If path is provided, it should be a directory whose SVN info you want to
    inspect. If it's not provided, this will use the root django/ package
    directory.
    i    s   %s/.svn/entriest   rs   (\d+)s   \d+\s+dir\s+(\d+)i(   t   minidomt   entryt   revisionu   SVN-%su   SVN-unknownN(   t   Nonet   djangot   __path__t   opent   readt   IOErrort   ret   matcht   searcht   groupst   xml.domR   t   parset   getElementsByTagNamet   getAttribute(   t   patht   revt   entries_patht   entriest	   rev_matchR   t   dom(    (    s>   /usr/local/lib/python2.6/dist-packages/django/utils/version.pyt   get_svn_revision   s$    
	(   R   t   os.patht   osR
   R   R   (    (    (    s>   /usr/local/lib/python2.6/dist-packages/django/utils/version.pyt   <module>   s   