Ñò
 „Pc           @   s  d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z l Z l	 Z	 d i
 ƒ  Z h  a g  a e i i d d e i ƒ Z y e i i e i d ƒ Z Wn e j
 o d Z n Xe i ƒ  Z d	 e i f d
 „  ƒ  YZ d e	 i	 f d „  ƒ  YZ d S(   s‘   
Support for waf command-line options

Provides default command-line options,
as well as custom ones, used by the ``options`` wscript function.

iÿÿÿÿN(   t   Logst   Utilst   ContextsF   distclean configure build install clean uninstall check dist distcheckt   WAFLOCKs   .lock-waf_%s_buildt   WAFCACHEt    t
   opt_parserc           B   s    e  Z d  Z d „  Z d „  Z RS(   s    
	Command-line options parser.
	c         C   st  t  i i |  d d d d t i t i f ƒt i ƒ  |  i _	 |  i
 } | |  _ | i ƒ  } | d d d d d	 | d
 d d d | ƒ| d d d d d	 d d d d d ƒ| d d d d d	 d d d d d ƒ| d d d d	 t d d d d ƒ| d d d d	 d d d  d d! ƒt  i |  d" ƒ } |  i | ƒ | i
 d# d$ d d  d	 d d d% d d& ƒ| i
 d' d( d d  d	 d d d) d d* ƒt i i d+ ƒ } | p? t d, j o( t i ƒ  } | d i ƒ  | d- } qÚd. } n | i
 d/ d d0 d	 | d d1 | ƒ| i
 d2 d d3 d	 t d d d d4 ƒt  i |  d5 ƒ } |  i | ƒ | i
 d6 d7 d d8 d	 d d d d d9 ƒ| i
 d: d d; d	 d d d  d d< ƒt  i |  d= ƒ } |  i | ƒ | i
 d> d d? d	 d d d  d d@ ƒt i i dA d ƒ } t  i |  dB ƒ } |  i | ƒ | i
 dC d dD | d	 | d dE ƒ| i
 dF dG d dH d	 t d d d dI ƒ| i
 dJ d dK d	 d  d d  ƒd  S(L   Nt   conflict_handlert   resolvet   versions   waf %s (%s)s   -js   --jobst   destt   jobst   defaultt   typet   intt   helps   amount of parallel jobs (%r)s   -ks   --keept   keepi    t   actiont   counts-   keep running happily even if errors are founds   -vs	   --verboset   verboses+   verbosity level -v -vv or -vvv [default: 0]s	   --nocachet   nocachet
   store_trues   ignore the WAFCACHE (if set)s   --zonest   zonesR   t   stores,   debugging zones (task_gen, deps, tasks, etc)s   configure optionss   -os   --outs   build dir for the projectt   outs   -ts   --tops   src dir for the projectt   topt   PREFIXt   win32i   s   /usr/local/s   --prefixt   prefixs!   installation prefix [default: %r]s
   --downloadt   downloads$   try to download the tools if missings   build and install optionss   -ps
   --progresst   progress_bars!   -p: progress bar; -pp: ide outputs	   --targetst   targetss'   task generators, e.g. "target1,target2"s   step optionss   --filest   filess:   files to process, by regexp, e.g. "*/main.c,*/test/main.o"t   DESTDIRs   install/uninstall optionss	   --destdirs   installation root [default: %r]t   destdirs   -fs   --forcet   forces   force file installations   --distcheck-argss   arguments to pass to distcheck(   t   optparset   OptionParsert   __init__R   t
   WAFVERSIONt   WAFREVISIONR    t   get_term_colst	   formattert   widtht
   add_optiont   ctxR   t   Falset   OptionGroupt   add_option_groupt   ost   environt   gett   platformt   tempfilet
   gettempdirt   uppert   None(   t   selfR-   t   pR   t   grt   default_prefixt   dt   default_destdir(    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR&   0   sF    ,		)%%""((
#%(%%#(c   
      C   sw  h  } xP t  i D]E } | i p | i d j o q n | i p d } | | | i <q Wt  i o‡ x„ t  i i i ƒ  D]l \ } } | d
 j o qv n t | ƒ t t  i ƒ j o0 | i o" | i	 d ƒ o | i | | <qâ qv qv Wn d } x# | D] } t
 | t | ƒ ƒ } q÷ Wg  } | i ƒ  D]& \ } } | d | i | ƒ | f q'~ } | i ƒ  d i | ƒ }	 d	 |	 S(   s3   
		Return the message to print on ``waf --help``
		t   optionsR   t   initt   shutdownt   _i    s     %s: %ss   
sF   waf [commands] [options]

Main commands (example: ./waf build -j4)
%s
(   s   optionss   inits   shutdown(   R   t   classest   cmdt   __doc__t   g_modulet   __dict__t   itemsR   t   create_contextt
   startswitht   maxt   lent   ljustt   sortt   join(
   R9   t   cmds_strt   clst   st   kt   vt   justt   _[1]t   lstt   ret(    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyt	   get_usageb   s.    
 
  @
(   t   __name__t
   __module__RE   R&   RY   (    (    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR   ,   s   	2t   OptionsContextc           B   s\   e  Z d  Z d Z d Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d	 d „ Z d „  Z RS(
   s­   
	Collect custom options from wscript files and parses the command line.
	Set the global :py:const:`waflib.Options.commands` and :py:const:`waflib.Options.options` values.
	R?   c         K   s2   t  t |  ƒ i |   t |  ƒ |  _ h  |  _ d  S(   N(   t   superR\   R&   R   t   parsert   option_groups(   R9   t   kw(    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR&      s    c         C   sj  t  t i i d d ƒ ƒ } | d j  od t i j o t  t i i d d ƒ ƒ } q8t t d ƒ oV d t i j o t  t i d ƒ ƒ } q½ d t i j o t  t i d ƒ ƒ } q½ n | oo t i d j o_ y" |  i d
 d d g d d ƒ} Wn t	 j
 o q4Xt
 i d | ƒ o t  | ƒ } q4q8n | d j  o
 d } n | d j o
 d } n | S(   s   
		Find the amount of cpu cores to set the default amount of tasks executed in parallel. At
		runtime the options can be obtained from :py:const:`waflib.Options.options` ::

			from waflib.Options import options
			njobs = options.jobs

		:return: the amount of cpu cores
		:rtype: int
		t   JOBSi    i   t   NUMBER_OF_PROCESSORSt   sysconf_namest   SC_NPROCESSORS_ONLNt   SC_NPROCESSORS_CONFt   ntt   javat   sysctls   -ns   hw.ncput   quiets   ^[0-9]+$i   (   s   nts   java(   R   R1   R2   R3   t   hasattrRc   t   sysconft   namet   cmd_and_logt	   Exceptiont   ret   match(   R9   R   t   tmp(    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR   —   s*    "

c         O   s   |  i  i | | Ž  S(   s­   
		Wrapper for optparse.add_option::

			def options(ctx):
				ctx.add_option('-u', '--use', dest='use', default=False, action='store_true',
					help='a boolean option')
		(   R^   R,   (   R9   RS   R`   (    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR,   ¼   s    c         O   sU   y |  i  | d } Wn( t j
 o |  i i | | Ž  } n X| |  i  | d <| S(   sÂ   
		Wrapper for optparse.add_option_group::

			def options(ctx):
				gr = ctx.add_option_group('some options')
				gr.add_option('-u', '--use', dest='use', default=False, action='store_true')
		i    (   R_   t   KeyErrorR^   R0   (   R9   RS   R`   R;   (    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR0   Æ   s    c         C   sV   y |  i  | SWn@ t j
 o4 x) |  i i  D] } | i | j o | Sq- Wd SXd S(   sç   
		Wrapper for optparse.get_option_group::

			def options(ctx):
				gr = ctx.get_option_group('configure options')
				gr.add_option('-o', '--out', action='store', default='',
					help='build dir for the project', dest='out')

		N(   R_   Rr   R^   t   titleR8   (   R9   t   opt_strt   group(    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyt   get_option_groupÕ   s    
 	c         C   sx   |  i  i d | ƒ \ a } | a t i o( t i i t i i t i ƒ ƒ t _ n t i	 d j o |  i
 d ƒ n d S(   s|   
		Parse arguments from a list (not bound to the command-line).

		:param _args: arguments
		:type _args: list of strings
		t   argsi   t   errcheckN(   R^   t
   parse_argsR?   t   commandsR"   R1   t   patht   abspatht
   expanduserR   t   load(   R9   t   _argst   leftover_args(    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyRy   ç   s    
(c         C   s!   t  t |  ƒ i ƒ  |  i ƒ  d S(   s3   
		See :py:func:`waflib.Context.Context.execute`
		N(   R]   R\   t   executeRy   (   R9   (    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR   ø   s    N(   RZ   R[   RE   RD   t   funR&   R   R,   R0   Rv   R8   Ry   R   (    (    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyR\   †   s   		%	
		(   RE   R1   R5   R$   t   sysRo   t   waflibR    R   R   t   splitt   cmdsR?   Rz   R2   R3   R4   t   lockfileR{   R|   t   cache_globalRr   t   unversioned_sys_platformR%   R   R\   (    (    (    s;   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Options.pyt   <module>   s   <  Z