ó
AqzRc           @   sN   d  Z  d d l Z d d l Z d d l m Z m Z d e f d „  ƒ  YZ d S(   sM   
Debian Packaging policies

like allowed characters in version numbers, etc.
iÿÿÿÿN(   t	   PkgPolicyt   compressor_optst   DebianPkgPolicyc           B   sP   e  Z d  Z e j d ƒ Z d Z e j d ƒ Z d Z d Z	 e
 d d „ ƒ Z RS(   sÆ   
    Packaging policy for Debian Source Packages

    >>> DebianPkgPolicy.is_valid_upstreamversion('1:9.8.4.dfsg.P1-6')
    True
    >>> DebianPkgPolicy.is_valid_upstreamversion('-1')
    False
    s    ^[a-zA-Z0-9][a-zA-Z0-9\.\+\-~]+$sÊ   Package names must be at least two characters long, start with an
    alphanumeric and can only containg letters (a-z,A-Z), digits
    (0-9), plus signs (+), minus signs (-), periods (.) and hyphens (~)s   ^[0-9][a-zA-Z0-9\.\+\-\:\~]*$sÁ   Upstream version numbers must start with a digit and can only containg lower case
    letters (a-z), digits (0-9), full stops (.), plus signs (+), minus signs
    (-), colons (:) and tildes (~)s   a-zA-Z\d.~+-c         C   sC   t  | d } d |  | | f } | r? t j j | | ƒ } n  | S(   sø  
        Given a source package's I{name}, I{version} and I{compression}
        return the name of the corresponding upstream tarball.

        >>> DebianPkgPolicy.build_tarball_name('foo', '1.0', 'bzip2')
        'foo_1.0.orig.tar.bz2'
        >>> DebianPkgPolicy.build_tarball_name('bar', '0.0~git1234', 'xz')
        'bar_0.0~git1234.orig.tar.xz'

        @param name: the source package's name
        @type name: C{str}
        @param version: the upstream version
        @type version: C{str}
        @param compression: the desired compression
        @type compression: C{str}
        @param dir: a directory to prepend
        @type dir: C{str}
        @return: the tarballs name corresponding to the input parameters
        @rtype: C{str}
        i   s   %s_%s.orig.tar.%s(   R   t   ost   patht   join(   t   namet   versiont   compressiont   dirt   extt   tarball(    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/policy.pyt   build_tarball_name@   s
    N(   t   __name__t
   __module__t   __doc__t   ret   compilet   packagename_ret   packagename_msgt   upstreamversion_ret   upstreamversion_msgt   debianversion_charst   staticmethodt   NoneR   (    (    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/policy.pyR      s   	(   R   R   R   t   gbp.pkgR    R   R   (    (    (    s2   /usr/lib/python2.7/dist-packages/gbp/deb/policy.pyt   <module>   s   