‡Æ
5Oö9c       s”    d  Z  	  d Z  d k Z d k Z d k Z  d k T d k Z  d k T d Z  e i	 d e ƒ Z
  e i	 d e e f ƒ Z   e i d d ƒ Z % e Z ( d	 f  d
 „  ƒ  YZ •d „  Z ›e i e i d e e i ƒ ƒ Z d „  Z Úd „  Z ád f  d „  ƒ  YZ îe d j o_ ïd Z õxL d d d d f d õr3 Z öd e GH÷e i e e e ƒ d ƒ GHøHqRWn d S(   s6  distutils.fancy_getopt

Wrapper around the standard getopt module that provides the following
additional features:
  * short and long options are tied together
  * options have help strings, so fancy_getopt could potentially
    create a complete usage summary
  * options set attributes of a passed-in object
s;   $Id: fancy_getopt.py,v 1.18 2000/09/26 02:06:03 gward Exp $N(   s   *s   [a-zA-Z](?:[a-zA-Z0-9-]*)s   ^%s$s   ^(%s)=!(%s)$s   -s   _s   FancyGetoptc      sÎ   ( d  Z  2 4 e d „ Z _ d „  Z d d „  Z h e e d „ Z r d „  Z w d „  Z ~ d „  Z Š d „  Z	  d	 „  Z
 ˜ d
 „  Z ê e e d „ Z -d „  Z 8e d „ Z Œe e d „ Z RS(   sÕ  Wrapper around the standard 'getopt()' module that provides some
    handy extra functionality:
      * short and long options are tied together
      * options have help strings, and help text can be assembled
        from them
      * options set attributes of a passed-in object
      * boolean options can have "negative aliases" -- eg. if
        --quiet is the "negative alias" of --verbose, then "--quiet"
        on the command line sets 'verbose' to false
    c    s   4 = | |  _  A h  |  _ B |  i  o C |  i ƒ  n G h  |  _ K h  |  _ Q g  |  _ R g  |  _ S h  |  _ T h  |  _	 U h  |  _
 Z g  |  _ d  S(   N(   s   option_tables   selfs   option_indexs   _build_indexs   aliass   negative_aliass
   short_optss	   long_optss
   short2longs	   attr_names	   takes_args   option_order(   s   selfs   option_tables3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   __init__4 s   	c    sG   _ ` |  i i ƒ  a x* |  i d a r } b | |  i | d <q" Wd  S(   Ni    (   s   selfs   option_indexs   clears   option_tables   option(   s   selfs   options3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   _build_index_ s    	c    s    d e | |  _  f |  i ƒ  d  S(   N(   s   option_tables   selfs   _build_index(   s   selfs   option_tables3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   set_option_tabled s   c    sf   h i |  i i | ƒ o j t d | ‚ n6 m | | | f } n |  i i	 | ƒ o | |  i | <d  S(   Ns'   option conflict: already an option '%s'(
   s   selfs   option_indexs   has_keys   long_options   DistutilsGetoptErrors   short_options   help_strings   options   option_tables   append(   s   selfs   long_options   short_options   help_strings   options3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys
   add_optionh s
   c    s   r t u |  i i | ƒ Sd S(   sc   Return true if the option table for this parser has an
        option with long name 'long_option'.N(   s   selfs   option_indexs   has_keys   long_option(   s   selfs   long_options3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys
   has_optionr s   c    s   w z { t  i | t ƒ Sd S(   s“   Translate long option name 'long_option' to the form it 
        has as an attribute of some object: ie., translate hyphens
        to underscores.N(   s   strings	   translates   long_options   longopt_xlate(   s   selfs   long_options3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   get_attr_namew s   c    s¸   ~  t  o t | ƒ t j p t ‚ € x‡ | i ƒ  d € rt \ } }  |  i	 i
 | ƒ o ‚ t d | | | f ‚ n … |  i	 i
 | ƒ o † t d | | | f ‚ n q9 Wd  S(   Ni    s(   invalid %s '%s': option '%s' not defineds0   invalid %s '%s': aliased option '%s' not defined(   s	   __debug__s   types   aliasess   DictionaryTypes   AssertionErrors   itemss   aliass   opts   selfs   option_indexs   has_keys   DistutilsGetoptErrors   what(   s   selfs   aliasess   whats   aliass   opts3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   _check_alias_dict~ s   $ c    s)   Š ‹ Œ |  i | d ƒ  | |  _ d S(   s'   Set the aliases for this option parser.s   aliasN(   s   selfs   _check_alias_dicts   alias(   s   selfs   aliass3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   set_aliasesŠ s   c    s)    “ ” |  i | d ƒ • | |  _ d S(   sÚ   Set the negative aliases for this option parser.
        'negative_alias' should be a dictionary mapping option names to
        option names, both the key and value must already be defined
        in the option table.s   negative aliasN(   s   selfs   _check_alias_dicts   negative_alias(   s   selfs   negative_aliass3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   set_negative_aliases s   c    sæ  ˜ œ  g  |  _ ž g  |  _ Ÿ |  i i ƒ  ¡ x®|  i d ¡ rž} ¢ y £ | \ } } } Wn, ¤ t
 j
 o ¥ t d t | ƒ ‚ n X© t | ƒ t j	 p t | ƒ d j  o ª t d | ‚ n ® | t j p# t | ƒ t j o t | ƒ d j o ° t d | ‚ n ´ |  i i | ƒ ¶ | d d j o@ · | o · | d } n ¸ | d d !} ¹ d |  i | <n† ¾ |  i i | ƒ } ¿ | t j	 oP À |  i | o Á t d	 | | f ‚ n Æ | |  i d <Ç d |  i | <n Ê d |  i | <Î |  i i | ƒ } Ï | t j	 o< Ð |  i | |  i | j o Ñ t d
 | | f ‚ n n Û t i | ƒ o Ü t d d | ‚ n à |  i | ƒ |  i | <á | o+ â |  i i | ƒ ã | |  i | d <n q= Wd S(   s   Populate the various data structures that keep tabs on the
        option table.  Called by 'getopt()' before it can do anything
        worthwhile.
        i    s   invalid option tuple i   s9   invalid long option '%s': must be a string of length >= 2i   s:   invalid short option '%s': must a single character or Nones   =s   :s>   invalid negative alias '%s': aliased option '%s' takes a valuesg   invalid alias '%s': inconsistent with aliased option '%s' (one of them takes a value, the other doesn'ts   invalid long option name '%s' s'   (must be letters, numbers, hyphens onlyN(   s   selfs	   long_optss
   short_optss
   short2longs   clears   option_tables   options   longs   shorts   helps
   ValueErrors   DistutilsGetoptErrors   strs   types
   StringTypes   lens   Nones   appends	   takes_args   negative_aliass   gets   alias_tos   aliass
   longopt_res   matchs   get_attr_names	   attr_name(   s   selfs   options   longs   shorts   helps   alias_tos3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   _grok_option_table˜ sJ    	)7
 

c    s  ê ó ô | t j o õ t i d } n ö | t j o ÷ t ƒ  } ø d } n
 ú d } ü |  i ƒ  þ t	 i
 |  i ƒ } ÿ y%  t i | | |  i ƒ \ } } Wn' t i j
 o } t | ‚ n Xxƒ| d rv\ } } t | ƒ d j o | d d j o |  i | d } nL t | ƒ d j o | d d !d j o 	| d } n t d | ‚ |  i i | ƒ }	 |	 o |	 } n |  i | of | d j o t d t ‚ n |  i i | ƒ }	 |	 o |	 } d } n
 d } n |  i | }
  t | |
 | ƒ !|  i i  | | f ƒ qÜ W%| o &| | f Sn (| Sd	 S(
   s  Parse the command-line options in 'args' and store the results
        as attributes of 'object'.  If 'args' is None or not supplied, uses
        'sys.argv[1:]'.  If 'object' is None or not supplied, creates a new
        OptionDummy object, stores option values there, and returns a tuple
        (args, object).  If 'object' is supplied, it is modified in place
        and 'getopt()' just returns 'args'; in both cases, the returned
        'args' is a modified copy of the passed-in 'args' list, which is
        left untouched.
        i   i    i   s   -s   --s)   this can't happen: bad option string '%s's    s(   this can't happen: bad option value '%s'N(!   s   argss   Nones   syss   argvs   objects   OptionDummys   created_objects   selfs   _grok_option_tables   strings   joins
   short_optss   getopts	   long_optss   optss   errors   msgs   DistutilsArgErrors   opts   vals   lens
   short2longs   DistutilsInternalErrors   aliass   gets	   takes_args   values   negative_aliass	   attr_names   attrs   setattrs   option_orders   append(   s   selfs   argss   objects   created_objects
   short_optss   optss   msgs   opts   vals   aliass   attrs3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   getoptê sJ   		% '*

	
c    s7   -12|  i t j o 3t d ‚ n 5|  i Sd S(   s«   Returns the list of (option, value) tuples processed by the
        previous run of 'getopt()'.  Raises RuntimeError if
        'getopt()' hasn't been called yet.
        s!   'getopt()' hasn't been called yetN(   s   selfs   option_orders   Nones   RuntimeError(   s   selfs3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   get_option_order-s   c    sf  8;@d } Ax£ |  i d Ar“ } B| d } C| d } Dt | ƒ } E| d d j o F| d } n G| t j	 o H| d } n I| | j o J| } n q WL| d d d } dd } e| | }	 fd | }
 g| o h| g } n jd g } lx?|  i d lr/\ } } } nt | |	 ƒ } o| d d j o p| d d !} n s| t j oM t| o% u| i d	 | | | d f ƒ n w| i d
 | | f ƒ nW |d | | f } }| o% ~| i d	 | | | d f ƒ n | i d | ƒ ƒx+ | d d ƒr } „| i |
 | ƒ q6Wq%Wˆ| Sd S(   sŒ   Generate help text (a list of strings, one per suggested line of
        output) from the option table for this FancyGetopt object.
        i    i   s   =i   i   iN   s    s   Option summary:s     --%-*s  %ss
     --%-*s  s   %s (-%s)s     --%-*sN(   s   max_opts   selfs   option_tables   options   longs   shorts   lens   ls   Nones	   opt_widths
   line_widths
   text_widths
   big_indents   headers   liness   helps	   wrap_texts   texts   appends	   opt_names(   s   selfs   headers   max_opts   options   longs   shorts   ls	   opt_widths
   line_widths
   text_widths
   big_indents   liness   helps   texts	   opt_namess3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   generate_help8sJ   	 		
 
%
% 	c    s]   Œ| t j o Žt i } n x0 |  i | ƒ d r } | i | d ƒ q8 Wd  S(   Ni    s   
(	   s   files   Nones   syss   stdouts   selfs   generate_helps   headers   lines   write(   s   selfs   headers   files   lines3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys
   print_helpŒs
    	(   s   __doc__s   Nones   __init__s   _build_indexs   set_option_tables
   add_options
   has_options   get_attr_names   _check_alias_dicts   set_aliasess   set_negative_aliasess   _grok_option_tables   getopts   get_option_orders   generate_helps
   print_help(    s3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   FancyGetopt( s   	
+
	RCTc    s9   •–t  |  ƒ } —| i | ƒ ˜| i | | ƒ Sd  S(   N(   s   FancyGetopts   optionss   parsers   set_negative_aliasess   negative_opts   getopts   argss   object(   s   optionss   negative_opts   objects   argss   parsers3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   fancy_getopt•s   s    c    s   ¢¤|  t j o ¥g  Sn ¦t |  ƒ | j o §|  g Sn ©t i |  ƒ }  ªt i |  t ƒ }  «t i	 d |  ƒ } ¬t t | ƒ } ­g  } ¯xS¯| oH±g  } ²d } ´x˜ ´| o µt | d ƒ } ¶| | | j o/ ·| i | d ƒ ¸| d =¹| | } n4 ¼| o | d d d j o ½| d =n ¾PqÄ WÀ| on Å| d j o4 Æ| i | d d | !ƒ Ç| d | | d <n Ì| d d d j o Í| d =n n Ñ| i t i | d ƒ ƒ q¢ WÕ| Sd S(   s¶   wrap_text(text : string, width : int) -> [string]

    Split 'text' into multiple lines of no more than 'width' characters
    each, and return the list of strings that results.
    s   ( +|-+)i    i   s    s    N(   s   texts   Nones   lens   widths   strings
   expandtabss	   translates   WS_TRANSs   res   splits   chunkss   filters   liness   cur_lines   cur_lens   ls   appends   join(   s   texts   widths   chunkss   liness   cur_lines   cur_lens   ls3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys	   wrap_texts@   	 
		 

 	
!c    s   ÚÝÞt  i |  t ƒ Sd S(   sX   Convert a long option name to a valid Python identifier by
    changing "-" to "_".
    N(   s   strings	   translates   opts   longopt_xlate(   s   opts3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   translate_longoptÚs   s   OptionDummyc      s   ád  Z  ãåg  d „ Z RS(   s_   Dummy class just used as a place to hold command-line option
    values as instance attributes.c    s6   åçèx& | d èr } ét |  | t ƒ q Wd S(   sk   Create a new OptionDummy instance.  The attributes listed in
        'options' will be initialized to None.i    N(   s   optionss   opts   setattrs   selfs   None(   s   selfs   optionss   opts3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   __init__ås    	(   s   __doc__s   __init__(    s3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   OptionDummyás   	s   __main__s¢   Tra-la-la, supercalifragilisticexpialidocious.
How *do* you spell that odd word, anyways?
(Someone ask Mary -- she'll know [or she'll
say, "How should I know?"].)i
   i   i   i(   i    s	   width: %ds   
(   s   __doc__s   __revision__s   syss   strings   res   typess   getopts   distutils.errorss   longopt_pats   compiles
   longopt_res   neg_alias_res	   maketranss   longopt_xlates   Nones   _option_orders   FancyGetopts   fancy_getopts
   whitespaces   lens   WS_TRANSs	   wrap_texts   translate_longopts   OptionDummys   __name__s   texts   ws   join(    s3   /mit/python/lib/python2.0/distutils/fancy_getopt.pys   ?	 s0   	

		ÿ n%=	 	