ó
AqzRc           @   sx   d  Z  d d l Z d d l m Z d d l m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d	 e f d
 „  ƒ  YZ
 d S(   s3   provides some debian source package related helpersiÿÿÿÿN(   t   DebianSourceFormat(   t	   ChangeLogt   FileVfsc           B   s   e  Z d  „  Z d d „ Z RS(   c         C   s   | |  _  d S(   s‘   
        Access files in a unpaced Debian source package.

        @param dir: the toplevel of the source tree
        @type dir: C{str}
        N(   t   _dir(   t   selft   dir(    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyt   __init__   s    c         C   s+   | p	 d } t  t j j |  j | ƒ | ƒ S(   Nt   r(   t   opent   ost   patht   joinR   (   R   R
   t   flags(    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyR   !   s    N(   t   __name__t
   __module__R   t   NoneR   (    (    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyR      s   		t   DebianSourceErrorc           B   s   e  Z RS(    (   R   R   (    (    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyR   %   s   t   DebianSourcec           B   s>   e  Z d  Z d „  Z d „  Z e d „  ƒ Z e d „  ƒ Z RS(   s¤   
    A debianized source tree

    Querying/setting information in a debianized source tree
    involves several files. This class provides a common interface.
    c         C   s7   d |  _ t | t ƒ r* t | ƒ |  _ n	 | |  _ d S(   sŠ   
        @param vfs: a class that implemented GbpVFS interfacce or
             a directory (which will used the DirGbpVFS class.
        N(   R   t
   _changelogt
   isinstancet
   basestringR   t   _vfs(   R   t   vfs(    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyR   /   s    	c         C   s’   y> |  j  j d ƒ } t | j ƒ  ƒ } | j r= | j d k SWn t k
 rS } n Xy d |  j j k SWn# t k
 r } t d | ƒ ‚ n Xd S(   s9   
        Whether this is a native debian package
        s   debian/source/formatt   nativet   -s%   Failed to determine source format: %sN(	   R   R   R    t   readt   typet   IOErrort	   changelogt   versionR   (   R   t   fft   ft   e(    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyt	   is_native;   s    	c         C   sd   |  j  s] y+ |  j j d ƒ } t | j ƒ  ƒ |  _  Wq] t k
 rY } t d | ƒ ‚ q] Xn  |  j  S(   s1   
        Return the L{gbp.deb.ChangeLog}
        s   debian/changelogs   Failed to read changelog: %s(   R   R   R   R   R   R   R   (   R   t   clft   err(    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyR   L   s    	c         C   s   |  j  d S(   s+   
        The source package's name
        t   Source(   R   (   R   (    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyt	   sourcepkgY   s    (   R   R   t   __doc__R   R!   t   propertyR   R%   (    (    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyR   (   s
   		(   R&   R	   t   gbp.deb.formatR    t   gbp.deb.changelogR   t   objectR   t	   ExceptionR   R   (    (    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/source.pyt   <module>   s   