ó
3Rc           @   sU   d  Z  d d l Z d d l Z d d g Z d   Z d   Z d   Z d d  Z d S(	   s!   Supercommand for all gbp commandsi’’’’Nt   commont   supercommandc         C   s   |  j  d d  S(   sO   
    '-' is not allowed in module names
    so turn it into an underscore.
    t   -t   _(   t   replace(   t   cmd(    (    s<   /usr/lib/python2.7/dist-packages/gbp/scripts/supercommand.pyt   sanitize   s    c           C   s	   d GHd  S(   Ns  
Usage:
    gbp <command> [<args>]

The most commonly used commands are:

    buildpackage - build a Debian package
    import-orig  - import a new upstream tarball
    import-dsc   - import a single Debian source package
    import-dscs  - import multiple Debian source packages
(    (    (    (    s<   /usr/lib/python2.7/dist-packages/gbp/scripts/supercommand.pyt   usage"   s    c         C   sL   t  j d |   s |  t k r2 t d |    n  t d |  d d d d S(   s=   
    Import the module that implements the given command
    s   [a-z][a-z0-9_]s   Illegal module name %ss   gbp.scripts.%st   fromlistt   maint   leveli    (   t   ret   matcht   invalid_modulest   ImportErrort
   __import__(   t
   modulename(    (    s<   /usr/lib/python2.7/dist-packages/gbp/scripts/supercommand.pyt   import_command/   s    c         C   sĖ   |  p t  j }  t |   d k  r, t   d S|  d } |  d } | d k rW t   d St |  } y t |  } WnH t k
 r½ } t  j d | IJt   d | k r¹ t  j | IJn  d SX| j |  S(	   Ni   i   s   --helps   -hi    s   '%s' is not a valid command.s	   --verbose(   s   --helps   -h(	   t   syst   argvt   lenR   R   R   R   t   stderrR	   (   R   R   t   argsR   t   modulet   e(    (    s<   /usr/lib/python2.7/dist-packages/gbp/scripts/supercommand.pyR   :   s&    

(	   t   __doc__R   R   R   R   R   R   t   NoneR   (    (    (    s<   /usr/lib/python2.7/dist-packages/gbp/scripts/supercommand.pyt   <module>   s   			