ó
[³XMc           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m	 Z	 d d l
 m Z d e	 j f d „  ƒ  YZ d f  d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d f  d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z d d d f d d d f d d d f d d d f d  d! d" f d# d$ d% f d& d' d( f d) d* d f d+ d, d f d- d. d f d/ d0 d( f d1 d2 d f d3 d4 d f d5 e e f d6 e e f g Z i e d 6e d# 6Z e e d7 „ Z d8 „  Z d9 „  Z e d: k re ƒ  n  d S(;   s-  
Rebuild the completion functions for the currently active version of Twisted::
    $ python zshcomp.py -i

This module implements a zsh code generator which generates completion code for
commands that use twisted.python.usage. This is the stuff that makes pressing
Tab at the command line work.

Maintainer: Eric Mangold

To build completion functions for your own commands, and not Twisted commands,
then just do something like this::

    o = mymodule.MyOptions()
    f = file('_mycommand', 'w')
    Builder("mycommand", o, f).write()

Then all you have to do is place the generated file somewhere in your
C{$fpath}, and restart zsh. Note the "site-functions" directory in your
C{$fpath} where you may install 3rd-party completion functions (like the one
you're building). Call C{siteFunctionsPath} to locate this directory
programmatically.

SPECIAL CLASS VARIABLES. You may set these on your usage.Options subclass::

    zsh_altArgDescr
    zsh_multiUse
    zsh_mutuallyExclusive
    zsh_actions
    zsh_actionDescr
    zsh_extras

Here is what they mean (with examples)::

    zsh_altArgDescr = {"foo":"use this description for foo instead"}
        A dict mapping long option names to alternate descriptions.  When this
        variable is present, the descriptions contained here will override
        those descriptions provided in the optFlags and optParameters
        variables.

    zsh_multiUse = ["foo", "bar"]
        A sequence containing those long option names which may appear on the
        command line more than once. By default, options will only be completed
        one time.

    zsh_mutuallyExclusive = [("foo", "bar"), ("bar", "baz")]
        A sequence of sequences, with each sub-sequence containing those long
        option names that are mutually exclusive. That is, those options that
        cannot appear on the command line together.

    zsh_actions = {"foo":'_files -g "*.foo"', "bar":"(one two three)",
            "colors":"_values -s , 'colors to use' red green blue"}
        A dict mapping long option names to Zsh "actions". These actions
        define what will be completed as the argument to the given option.  By
        default, all files/dirs will be completed if no action is given.

        Callables may instead be given for the values in this dict. The
        callable should accept no arguments, and return a string that will be
        used as the zsh "action" in the same way as the literal strings in the
        examples above.

        As you can see in the example above. The "foo" option will have files
        that end in .foo completed when the user presses Tab. The "bar"
        option will have either of the strings "one", "two", or "three"
        completed when the user presses Tab.

        "colors" will allow multiple arguments to be completed, seperated by
        commas. The possible arguments are red, green, and blue. Examples::

            my_command --foo some-file.foo --colors=red,green
            my_command --colors=green
            my_command --colors=green,blue

        Actions may take many forms, and it is beyond the scope of this
        document to illustrate them all. Please refer to the documention for
        the Zsh _arguments function. zshcomp is basically a front-end to Zsh's
        _arguments completion function.

        That documentation is available on the zsh web site at this URL:
        U{http://zsh.sunsite.dk/Doc/Release/zsh_19.html#SEC124}

    zsh_actionDescr = {"logfile":"log file name", "random":"random seed"}
        A dict mapping long option names to a description for the corresponding
        zsh "action". These descriptions are show above the generated matches
        when the user is doing completions for this option.

        Normally Zsh does not show these descriptions unless you have
        "verbose" completion turned on. Turn on verbosity with this in your
        ~/.zshrc::

            zstyle ':completion:*' verbose yes
            zstyle ':completion:*:descriptions' format '%B%d%b'

    zsh_extras = [":file to read from:action", ":file to write to:action"]
        A sequence of extra arguments that will be passed verbatim to Zsh's
        _arguments completion function. The _arguments function does all the
        hard work of doing command line completions. You can see how zshcomp
        invokes the _arguments call by looking at the generated completion
        files that this module creates.

   *** NOTE ***

        You will need to use this variable to describe completions for normal
        command line arguments. That is, those arguments that are not
        associated with an option. That is, the arguments that are given to the
        parseArgs method of your usage.Options subclass.

        In the example above, the 1st non-option argument will be described as
        "file to read from" and completion options will be generated in
        accordance with the "action". (See above about zsh "actions") The
        2nd non-option argument will be described as "file to write to" and
        the action will be interpreted likewise.

        Things you can put here are all documented under the _arguments
        function here: U{http://zsh.sunsite.dk/Doc/Release/zsh_19.html#SEC124}

Zsh Notes:

To enable advanced completion add something like this to your ~/.zshrc::

    autoload -U compinit
    compinit

For some extra verbosity, and general niceness add these lines too::

    zstyle ':completion:*' verbose yes
    zstyle ':completion:*:descriptions' format '%B%d%b'
    zstyle ':completion:*:messages' format '%d'
    zstyle ':completion:*:warnings' format 'No matches for: %d'

Have fun!
iÿÿÿÿN(   t   reflectt   utilt   usage(   t   IServiceMakert	   MyOptionsc           B   sJ   e  Z d  Z d Z d Z d d d g g Z d d d
 d g g Z d	 „  Z RS(   s   
    Options for this file
    t    s>   Usage: python zshcomp.py [--install | -i] | <output directory>t   installt   isi   Output files to the "installation" directory (twisted/python/zsh in the currently active Twisted package)t	   directoryt   ds   Output files to this directoryc         C   s„   |  d r# |  d r# t  j d ‚ n  |  d rH |  d rH t  j d ‚ n  |  d r€ t j j |  d ƒ r€ t  j d |  d ‚ n  d  S(   NR   R   s5   Can't have --install and --directory at the same times   Not enough argumentss   %s is not a directory(   R   t
   UsageErrort   ost   patht   isdir(   t   self(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt   postOptionsš   s    !N(	   t   __name__t
   __module__t   __doc__t   longdesct   synopsist   optFlagst   Nonet   optParametersR   (    (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR   Ž   s   	t   Builderc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  | |  _ | |  _ d S(   s[  
        @type cmd_name: C{str}
        @param cmd_name: The name of the command

        @type options: C{twisted.usage.Options}
        @param options: The C{twisted.usage.Options} instance defined for
                        this command

        @type file: C{file}
        @param file: The C{file} to write the completion function to
        N(   t   cmd_namet   optionst   file(   R   R   R   R   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt   __init__¤   s    		c         C   sC   |  j  j d |  j f ƒ t |  j |  j |  j  ƒ } | j ƒ  d S(   sf   
        Write the completion function to the file given to __init__
        @return: C{None}
        s   #compdef %s
N(   R   t   writeR   t   ArgumentsGeneratorR   (   R   t   gen(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR   µ   s    (   R   R   R   R   (    (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR   £   s   	t   SubcommandBuilderc           B   s#   e  Z d  Z d Z d Z d „  Z RS(   s¶   
    Use this builder for commands that have sub-commands. twisted.python.usage
    has the notion of sub-commands that are defined using an entirely seperate
    Options class.
    c         C   sd  |  j  j d |  j f ƒ |  j  j d ƒ d d l m } | j |  j ƒ } x. | D]& } |  j  j d | j | j f ƒ qS W|  j  j d ƒ d g |  j	 j
 _ t |  j |  j	 |  j  ƒ } | j ƒ  |  j  j d |  j f ƒ | j |  j ƒ } x] | D]U } |  j  j | j d	 ƒ t | j | j	 ƒ  |  j  ƒ } | j ƒ  |  j  j d
 ƒ q÷ W|  j  j d ƒ d S(   sf   
        Write the completion function to the file given to __init__
        @return: C{None}
        s   #compdef %s
s.   local _zsh_subcmds_array
_zsh_subcmds_array=(
iÿÿÿÿ(   t   plugins   "%s:%s"
s   )

s   *::subcmd:->subcmds‰   if (( CURRENT == 1 )); then
  _describe "%s" _zsh_subcmds_array && ret=0
fi
(( ret )) || return 0

service="$words[1]"

case $service in
s   )
s   ;;
s8   *) _message "don't know how to complete $service";;
esacN(   R   R   R   t   twistedR!   t
   getPluginst	   interfacet   tapnamet   descriptionR   t	   __class__t
   zsh_extrasR   t   subcmdLabel(   R   t	   newplugint   pluginst   pR   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR   È   s&    $
	
N(   R   R   R   R   R$   R)   R   (    (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR    ¿   s   t   MktapBuilderc           B   s   e  Z d  Z e Z d Z RS(   s'   
    Builder for the mktap command
    s   tap to build(   R   R   R   R   R$   R)   (    (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR-   ì   s   t   TwistdBuilderc           B   s   e  Z d  Z e Z d Z RS(   s(   
    Builder for the twistd command
    s   service to run(   R   R   R   R   R$   R)   (    (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR.   ó   s   R   c           B   s˜   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 e
 d „ Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sq   
    Generate a call to the zsh _arguments completion function
    based on data in a usage.Options subclass
    c         C   so  | |  _  | |  _ | |  _ i  |  _ i  |  _ g  |  _ g  |  _ i  |  _ g  |  _ t	 j
 } t	 j } | | j d |  j ƒ | | j d |  j ƒ | | j d |  j ƒ | | j d |  j ƒ | | j d |  j ƒ | | j d |  j ƒ g  } g  } | | j d | ƒ | | j d | ƒ xE t | ƒ D]7 \ } }	 t |	 ƒ d	 k r&t j d	 |	 ƒ | | <q&q&WxE t | ƒ D]7 \ } }	 t |	 ƒ d
 k rnt j d
 |	 ƒ | | <qnqnW| |  _ | |  _ i  }
 x  | D] }	 |	 d |
 |	 d <qÈW|
 |  _ i  } x  | D] }	 |	 d | |	 d <qúW| |  _ i  } | j |
 ƒ | j | ƒ | |  _ |  j ƒ  |  j ƒ  |  j ƒ  |  _ d S(   s[  
        @type cmd_name: C{str}
        @param cmd_name: The name of the command

        @type options: C{twisted.usage.Options}
        @param options: The C{twisted.usage.Options} instance defined
                        for this command

        @type file: C{file}
        @param file: The C{file} to write the completion function to
        t   zsh_altArgDescrt   zsh_actionDescrt   zsh_multiUset   zsh_mutuallyExclusivet   zsh_actionsR(   R   R   i   i   i   i    N(   R   R   R   t   altArgDescrt   actionDescrt   multiUset   mutuallyExclusivet   actionst   extrasR    t   accumulateClassListt   accumulateClassDictR'   t	   enumeratet   lenR   t   padToR   t	   optParamst   optParams_dt
   optFlags_dt   updatet   optAll_dt   addAdditionalOptionst   verifyZshNamest   makeExcludesDictt   excludes(   R   R   R   R   t   aCLt   aCDR   R?   R   t   optListR@   RA   RC   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR   ÿ   sZ    											
					

c         C   s,   |  j  ƒ  |  j ƒ  |  j ƒ  |  j ƒ  d S(   sf   
        Write the zsh completion code to the file given to __init__
        @return: C{None}
        N(   t   writeHeadert   writeExtrast   writeOptionst   writeFooter(   R   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR   J  s    


c         C   s   |  j  j d ƒ d S(   s^   
        This is the start of the code that calls _arguments
        @return: C{None}
        s   _arguments -s -A "-*" \
N(   R   R   (   R   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRK   T  s    c         C   s;   |  j  j ƒ  } | j ƒ  x | D] } |  j | ƒ q  Wd S(   s]   
        Write out zsh code for each option in this command
        @return: C{None}
        N(   RC   t   keyst   sortt   writeOpt(   R   t   optNamest   long(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRM   [  s    
c         C   s>   x7 |  j  D], } |  j j t | ƒ ƒ |  j j d ƒ q
 Wd S(   s…   
        Write out the "extras" list. These are just passed verbatim to the
        _arguments call
        @return: C{None}
        s    \
N(   R9   R   R   t   escape(   R   t   s(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRL   e  s    c         C   s   |  j  j d ƒ d S(   sj   
        Write the last bit of code that finishes the call to _arguments
        @return: C{None}
        s   && return 0
N(   R   R   (   R   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRN   o  s    c            sŸ   ‡  f d †  } xH t  j ˆ  j ˆ  j ˆ  j ˆ  j ƒ D]" } | ˆ  j k r4 | | ƒ q4 q4 Wx> ˆ  j D]3 } x* | D]" } | ˆ  j k rq | | ƒ qq qq Wqd Wd S(   sä   
        Ensure that none of the names given in zsh_* variables are typoed
        @return: C{None}
        @raise ValueError: Raised if unknown option names have been given in
                           zsh_* variables
        c            s   t  d |  ˆ  j f ‚ d  S(   NsQ   Unknown option name "%s" found while
examining zsh_ attributes for the %s command(   t
   ValueErrorR   (   t   name(   R   (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt   err}  s    N(   t	   itertoolst   chainR4   R5   R8   R6   RC   R7   (   R   RX   RW   t   seq(    (   R   s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRE   v  s    c         C   sè   | |  j  k r  |  j  | } n g  } | |  j k r | t k ro |  j | ƒ } | d k	 r| | j | ƒ q| q | j | ƒ n  | s‰ d Sg  } xE | D]= } t | ƒ d k rÂ | j d | ƒ q– | j d | ƒ q– Wd d j | ƒ S(   sÙ  
        Generate an "exclusion string" for the given option

        @type long: C{str}
        @param long: The long name of the option
                     (i.e. "verbose" instead of "v")

        @type buildShort: C{bool}
        @param buildShort: May be True to indicate we're building an excludes
                           string for the short option that correspondes to
                           the given long opt

        @return: The generated C{str}
        R   i   t   -s   --s   (%s)t    N(   RG   R6   t   Falset   getShortOptionR   t   appendR=   t   join(   R   RS   t
   buildShortt
   exclusionst   shortt   stringst   optName(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt
   excludeStrŒ  s"    c   	      C   s)  i  } x] t  j |  j |  j ƒ D]C } y) | d d k rM | d | | d <n  Wq t k
 ra q Xq Wi  } x¶ |  j D]« } x¢ t | ƒ D]” \ } } g  } | j | |  ƒ | j | | d ƒ x/ | D]& } | | k rÉ | j	 | | ƒ qÉ qÉ W| | k r| | j | ƒ q‰ | | | <q‰ Wqv W| S(   sÚ   
        @return: A C{dict} that maps each option name appearing in
        self.mutuallyExclusive to a list of those option names that
        is it mutually exclusive with (can't appear on the cmd line with)
        i   i    N(
   RY   RZ   R?   R   R   t
   IndexErrorR7   R<   t   extendR`   (	   R   t   longToShortRJ   RG   t   lstR   RS   t   tmpRW   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRF   ·  s(    c         C   s†  | |  j  k r d | } n
 d | } |  j | ƒ } | d k rN d | } n d } |  j | ƒ } | j d d ƒ } | j d d ƒ } d	 | } | |  j k r° |  j | } n | } |  j | ƒ } | |  j k rÝ d
 }	 n d }	 |  j | ƒ }
 | rI|  j | d t	 ƒ} |  j
 j t d | |	 | | | f ƒ ƒ |  j
 j d ƒ n  |  j
 j t d |
 |	 | | | f ƒ ƒ |  j
 j d ƒ d S(   s  
        Write out the zsh code for the given argument. This is just part of the
        one big call to _arguments

        @type long: C{str}
        @param long: The long name of the option
                     (i.e. "verbose" instead of "v")

        @return: C{None}
        s   --%ss   --%s=R\   R   t   [s   \[t   ]s   \]s   [%s]t   *Rb   s
   %s%s%s%s%ss    \
N(   RA   R_   R   t   getDescriptiont   replaceR5   t	   getActionR6   Rg   t   TrueR   R   RT   (   R   RS   t
   long_fieldRd   t   short_fieldt   descrt   descr_fieldt   actionDescr_fieldt   action_fieldt   multi_fieldt   longExclusions_fieldt   shortExclusions_field(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRQ   ×  s6    

	c         C   s}   | |  j  k rY t |  j  | ƒ r5 |  j  | ƒ  } n |  j  | } d |  j | ƒ | f S| |  j k ry d |  j | ƒ Sd S(   s]   
        Return a zsh "action" string for the given argument
        @return: C{str}
        s   :%s:%ss
   :%s:_filesR   (   R8   t   callablet   getActionDescrR@   (   R   RS   t   action(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRr     s    c         C   s"   | |  j  k r |  j  | S| Sd S(   sk   
        Return the description to be used when this argument is completed
        @return: C{str}
        N(   R5   (   R   RS   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR~     s    c         C   sÖ   | |  j  k r |  j  | Sy |  j | d } Wn@ t k
 rq y |  j | d } Wqr t k
 rm d } qr Xn X| d k	 r‚ | S| j d d ƒ } t |  j d | d ƒ } | rÒ t | ƒ } | d k	 rÒ | Sn  | S(   s]   
        Return the description to be used for this argument
        @return: C{str}
        i   i   R\   t   _s   opt_%sN(	   R4   RA   t   KeyErrorR@   R   Rq   t   getattrR   t   descrFromDoc(   R   RS   Rv   t   longMangledt   obj(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRp   $  s$    c         C   s7   |  j  | } y | d p d SWn t k
 r2 n Xd S(   s[   
        Return the short option letter or None
        @return: C{str} or C{None}
        i    N(   RC   R   Rh   (   R   RS   RJ   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR_   C  s
    c   
      C   s   i  } t  j |  j | d ƒ i  } x> | j ƒ  D]0 } t | ƒ d k r/ | | | | <| | =q/ q/ Wx6| j ƒ  D](\ } } | j d d ƒ } | |  j k r£ qp n  |  j | ƒ } d } | | k rÑ | | } n  | j
 j j }	 |	 d k r7|  j j | | d | g ƒ | d | g |  j | <| d | g |  j | <qp |	 d k rˆ|  j j | | | g ƒ | | g |  j | <| d | g |  j | <qp t d | f ‚ qp Wd S(   s±   
        Add additional options to the optFlags and optParams lists.
        These will be defined by 'opt_foo' methods of the Options subclass
        @return: C{None}
        t   opt_i   R€   R\   i   s    %r has wrong number of argumentsN(   R    t   accumulateMethodsR   t   copyR=   t   itemsRq   RC   Rp   R   t   im_funct	   func_codet   co_argcountR?   R`   R@   R   RA   t	   TypeError(
   R   t   methodsDictt   methodToShortRW   t
   methodNamet	   methodObjRS   Rv   Rd   t   reqArgs(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRD   N  s4    (   R   R   R   R   R   RK   RM   RL   RN   RE   R^   Rg   RF   RQ   Rr   R~   Rp   R_   RD   (    (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyR   ú   s    	K	
		
	
		+	 	4		
		c         C   s¯   |  j  d k r d S|  j  j d ƒ } d } yl | d d k rb | d j ƒ  rb | d j ƒ  } n4 | d d k r– | d j ƒ  r– | d j ƒ  } n  Wn t k
 rª n X| S(   sP   
    Generate an appropriate description from docstring of the given object
    s   
i    R   i   N(   R   R   t   splitt   isspacet   lstripRh   (   R…   t   linesRv   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRƒ   v  s    !!c         C   s4   y |  j  d ƒ } |  |  SWn t k
 r/ |  SXd S(   s3   
    Return the first line of the given string
    s   
N(   t   indexRV   (   RU   R   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt	   firstLine‰  s
    c         C   s   t  j |  ƒ d S(   s'   
    Shell escape the given string
    i   (   t   commandst   mkarg(   t   str(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRT   “  s    c          C   s=   y/ d }  t  j |  ƒ } t j j | ƒ r. | SWn n Xd S(   so   
    Return the path to the system-wide site-functions directory or
    C{None} if it cannot be determined
    s/   zsh -f -c 'echo ${(M)fpath:#/*/site-functions}'N(   R™   t	   getoutputR   R   R   (   t   cmdt   output(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt   siteFunctionsPath™  s    t   conchs   twisted.conch.scripts.concht   ClientOptionst   mktaps   twisted.scripts.mktapt   FirstPassOptionst   trials   twisted.scripts.trialt   Optionst   cftps   twisted.conch.scripts.cftpt
   tapconverts   twisted.scripts.tapconvertt   ConvertOptionst   twistds   twisted.scripts.twistdt   ServerOptionst   ckeygens   twisted.conch.scripts.ckeygent   GeneralOptionst   lores   twisted.lore.scripts.loret
   pyhtmlizers   twisted.scripts.htmlizert   tap2debs   twisted.scripts.tap2debt   tkconchs   twisted.conch.scripts.tkconcht   manholes   twisted.scripts.manholet   tap2rpms   twisted.scripts.tap2rpmt
   websetroott   tkmktapc         C   s  g  } xú | D]ò \ } } } | d k rG t |  | ƒ } | j ƒ  q n  yŒ t d | f d d | ƒ } t |  | ƒ } t | | ƒ ƒ  }	 | | k r¶ | | | |	 | ƒ }
 |
 j ƒ  n t | |	 | ƒ }
 |
 j ƒ  Wq t k
 rþ } | j | | f ƒ q q Xq W| S(   sN  
    Generate completion function files in the given directory for all
    twisted commands

    @type out_path: C{str}
    @param out_path: The path to the directory to generate completion function
                     fils in

    @param generateFor: Sequence in the form of the 'generateFor' top-level
                        variable as defined in this module. Indicates what
                        commands to build completion files for.

    @param specialBuilders: Sequence in the form of the 'specialBuilders'
                            top-level variable as defined in this module.
                            Indicates what commands require a special
                            Builder class.

    @return: C{list} of 2-tuples of the form (cmd_name, error) indicating
             commands that we skipped building completions for. cmd_name
             is the name of the skipped command, and error is the Exception
             that was raised when trying to import the script module.
             Commands are usually skipped due to a missing dependency,
             e.g. Tkinter.
    s   %sN(	   R   t   _openCmdFilet   closet
   __import__R‚   R   R   t	   ExceptionR`   (   t   out_patht   generateFort   specialBuilderst   skipsR   t   module_namet
   class_namet   ft   mt   ot   bt   e(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt   makeCompFunctionFilesÀ  s&    
c         C   s    t  t j j |  d | ƒ d ƒ S(   NR€   t   w(   R   R   R   Ra   (   R¹   R   (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyRµ   ñ  s    c          C   s  t  ƒ  }  y |  j t j d ƒ Wn3 t j k
 rV } | GH|  j ƒ  GHt j d ƒ n X|  d r£ d d  l } t	 j
 j t	 j
 j | j ƒ d d ƒ } t | ƒ } n t |  d ƒ } xE | D]= \ } } t j j d | f ƒ t j j t | ƒ d	 ƒ qº W| rt j d
 ƒ n  d  S(   Ni   i   R   iÿÿÿÿt   pythont   zshR   sG   zshcomp: Skipped building for %s. Script module could not be imported:
s   
i   (   R   t   parseOptionst   syst   argvR   R
   t   getUsaget   exitR"   R   R   Ra   t   dirnamet   __file__RÄ   t   stderrR   R›   (   R   RÃ   R"   t   dirR¼   R   t   error(    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt   runô  s$    	
't   __main__(   R   RY   RÉ   R™   t   os.pathR   t   twisted.pythonR    R   R   t   twisted.scripts.mktapR   R¥   R   R   R    R-   R.   R   Rƒ   R˜   RT   RŸ   R   Rº   R»   RÄ   Rµ   RÒ   R   (    (    (    s:   /usr/lib/python2.7/dist-packages/twisted/python/zshcomp.pyt   <module>ˆ   sJ   0-ÿ }		
			

0		