
 Pc           @   sf  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 Z d d k Z d d k l	 Z	 l
 Z
 l Z l Z l Z l Z l Z l Z l Z d Z d g Z d Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d e i f d     YZ d   Z d e f d     YZ  d   Z! d   Z" d   Z# e# e i$ i%  e i$ _% d S(   s?   Module called for configuring, compiling and installing targetsiN(	   t   Utilst	   Configuret   Logst   Optionst	   ConfigSett   Contextt   Errorst   Buildt   Nodet	   configuret   buildc         C   s?  t  i   t i | j o. t  i d | t i | f  t i d  n d t i j o< |  t _ t i	 d  } |  | _
 | i   t i d  n | t _ |  t _ t i i d d  } | p0 x- t D]! } | t i j o t } Pq q Wn |  } x| ot i |  } t i | j o7t i   } y9 | i t i i | t i   t i |  t i }	 Wn t j
 o qXXx | i | i | i g D]t }
 t  i! o | |
 j o t } Pq	qy t i |
  t i } Wn t" j
 o qX|	 | j o t } PqqWt  i# d |  t$ } | o) | i t _ | i t _ | i t _ PqXn t i p! t i% | j o | t _ qn t i i& |  } | | j o Pn | } | o Pq q Wt i p d t i j p d	 t i j oI t  i# d
  |  t _ t i	 d  } |  | _
 | i   t i d  n t  i d t i%  t i d  n y t i' t i  Wn4 t" j
 o( t  i d t i  t i d  n Xy t( t i t i) t i%  Wn t* i+ j
 o< } t  i, d | i-  t  i t. |   t i d  nM t j
 o@ } t  i d t i |  t/ i0 d t i1  t i d  n Xy t2   Wn t* i+ j
 oM } t  i3 d j o t  i, d | i-  n t  i | i4  t i d  nz t5 j
 o
   ne t j
 o) } t/ i0 d t i1  t i d  n1 t6 j
 o$ t  i, d d  t i d  n Xd S(   sG  
	This is the main entry point, all Waf execution starts here.

	:param current_directory: absolute path representing the current directory
	:type current_directory: string
	:param version: version number
	:type version: string
	:param wafdir: absolute path representing the directory of the waf library
	:type wafdir: string
	s8   Waf script %r and library %r do not match (directory %r)i   s	   --versiont   optionsi    t   NOCLIMBs   invalid lock file in %ss   -hs   --helps9   No wscript file found: the help message may be incompletes4   Waf: Run from a directory containing a file named %rs    Waf: The folder %r is unreadablet   REDs$   Waf: The wscript in %r is unreadablet   filei   t   InterruptediD   N(7   R   t   init_logR   t
   WAFVERSIONt   errort   syst   exitt   argvt   run_dirt   create_contextt   curdirt
   parse_argst   waf_dirt
   launch_dirt   ost   environt   gett   Nonet   no_climb_commandst   Truet   listdirR   t   lockfileR   t   loadt   patht   joint   statt   ST_INOt	   Exceptiont   top_dirt   out_dirR    t   is_win32t   OSErrort   warnt   Falset   WSCRIPT_FILEt   dirnamet   chdirt   set_main_modulet   sepR   t   WafErrort   pprintt   verbose_msgt   strt	   tracebackt	   print_exct   stdoutt   run_commandst   verboset   msgt
   SystemExitt   KeyboardInterrupt(   t   current_directoryt   versiont   wafdirt   ctxt   no_climbt   kt   curt   lstt   envt   inot   xR$   t   ino2t   nextt   e(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   waf_entry_point   s    
		
		   
			


 		
c         C   s   t  i |   t  _ |  t  i _ d   } x' t t t t t g D] } | |  q= Wd t  i i j o t	 i
 t  i _ n d t  i i j o t	 i
 t  i _ n d t  i i j o t	 i
 t  i _ n d S(   sZ  
	Read the main wscript file into :py:const:`waflib.Context.Context.g_module` and
	bind default functions such as ``init``, ``dist``, ``distclean`` if not defined.
	Called by :py:func:`waflib.Scripting.waf_entry_point` during the initialization.

	:param file_path: absolute path representing the top-level wscript file
	:type file_path: string
	c         S   s7   |  i  } | t i i j o t t i | |   n d  S(   N(   t   __name__R   t   g_modulet   __dict__t   setattr(   t   objt   name(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   set_def   s    	t   initt   shutdownR   N(   R   t   load_moduleRQ   t	   root_patht   updatet   distt	   distcleant	   distcheckRR   R    t   nadaRW   RX   R   (   t	   file_pathRV   RF   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR3      s    		 c          C   s  t  i d  i   t i p t g t _ n g  }  t i D] } | d j o |  | q; q; ~  t _ t i i t _ t i	   t i i
 o3 t i i
 i d  t _
 t i p d t _ q n! t i d j o d g t _
 n t i d j o d g t _
 n d S(	   s   
	Parse the command-line options and initialize the logging system.
	Called by :py:func:`waflib.Scripting.waf_entry_point` during the initialization.
	R   t   ,i   i    t   runneri   t   *N(   R   R   t   executeR   t   commandst   default_cmdR   R=   R   R   t   zonest   split(   t   _[1]RK   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   parse_options   s    
8

c         C   sA   t  i |   } t i   | _ t i | _ |  | _ | i   | S(   s   
	Execute a single command. Called by :py:func:`waflib.Scripting.run_commands`.

	:param cmd_name: command to execute, like ``build``
	:type cmd_name: string
	(	   R   R   R    t   Timert	   log_timerR   R   t   cmdRd   (   t   cmd_nameRD   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   run_command   s    	
c          C   so   t    t d  xM t i oB t i i d  }  t |   } t i d |  t | i  f  q Wt d  d S(   s   
	Execute the commands that were given on the command-line, and the other options
	Called by :py:func:`waflib.Scripting.waf_entry_point` during the initialization, and executed
	after :py:func:`waflib.Scripting.parse_options`.
	RW   i    s   %r finished successfully (%s)RX   N(	   Rj   Ro   R   Re   t   popR   t   infoR8   Rl   (   Rn   RD   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR<      s    
 
%c         C   s0   x) d i    D] } |  i |  o t Sq Wt S(   Ns   .o .moc .exe(   Rh   t   endswithR!   R/   (   RU   RF   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   _can_distclean   s
     	c      	   C   s   x t  i |   D]z \ } } } xh | D]` } t |  oM | t  i | } y t  i |  Wq t j
 o t i d |  q Xq& q& Wq Wx> t i	 d g D]- } y t  i |  Wq t j
 o q Xq Wy t
 i d  Wn t j
 o n Xd S(   s   
	Distclean function called in the particular case when::

		top == out

	:param dirname: absolute path of the folder to clean
	:type dirname: string
	s   could not remove %rs
   config.logt   c4cheN(   R   t   walkRs   R4   t   unlinkR-   R   R.   R   t   DBFILEt   shutilt   rmtree(   R1   t   roott   dirst   filest   ft   fnameRK   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   distclean_dir   s(    	  " 	c         C   s  t  i d  } x| D]} | t i j o_y t i |  } Wn' t j
 o t i d |  q n X| d | d j or y t i	 | d  Wq t j
 o q t
 j
 o8 } | i t i j o t i d | t i  q q Xn t | d  x | d | d | d f D]i } y# t  i t  i i | t i   Wqt
 j
 o1 } | i t i j o t i d |  qqXqWn | i d  o" t i o t i	 | d	 t q q Wd
 S(   s   removes the build directoryt   .s   could not read %rR+   R*   s   project %r cannot be removedR   s   file %r cannot be removeds   .waft   ignore_errorsN(   R   R"   R   R#   R   t   IOErrorR   R.   Rx   Ry   R-   t   errnot   ENOENTR   t   OUTR   t   removeR%   R&   t
   startswithRe   R!   (   RD   RH   R}   t   projRN   RF   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR]     s6     % #"t   Distc           B   sw   e  Z d  Z d Z d Z d Z h  Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z RS(   s5   creates an archive containing the project source codeR\   s   tar.bz2c         C   s0   |  i  t i i t i i  g  |  i   d S(   s3   
		See :py:func:`waflib.Context.Context.execute`
		N(   t   recurseR   R%   R1   R   RQ   RZ   t   archive(   t   self(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyRd   :  s    "c         C   s!  d d k  } |  i   } y |  i Wn t j
 o |  i |  _ n X|  i i |  } y | i   Wn t j
 o n X|  i   } |  i	 i
 d  oT | i | d |  i	 i d d   } x | D] } |  i | |  q W| i   n |  i	 d j o d d k } | i | d d | i } xJ | D]B } |  i   d	 | i |  i  }	 | i | i   |	 | i  q,W| i   n |  i d
  y d d k l }
 Wn# t j
 o d d k l }
 n Xy  d |
 | i    i   } Wn t j
 o d } n Xt i d |  i | f  d S(   s   
		Create the archive.
		iNs   tar.s   w:t    t   zipt   wt   compressiont   /s+   Valid algo types are tar.bz2, tar.gz or zip(   t   sha1(   t   shas	    (sha=%r)s   New archive created: %s%s(    t   tarfilet   get_arch_namet	   base_patht   AttributeErrorR%   t	   make_nodet   deleteR)   t	   get_filest   algoR   t   opent   replacet   add_tar_filet   closet   zipfilet   ZipFilet   ZIP_DEFLATEDt   get_base_namet	   path_fromt   writet   abspatht   fatalt   hashlibR   t   ImportErrorR   t   readt	   hexdigestR   Rq   t	   arch_name(   R   R   R   t   nodeR|   t   tarRK   R   R   t   archive_nameR   t   digest(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR   A  sH    %     c         C   s
   | i    S(   s   
		return the path to use for a node in the tar archive, the purpose of this
		is to let subclases resolve symbolic links or to change file names
		(   R   (   R   R   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   get_tar_pathr  s    c         C   s   |  i  |  } | i d | d |  i   d | i |  i   } d | _ d | _ d | _ d | _ d } z& t
 | d  } | i | d | Wd | o | i   n Xd S(	   sl   
		Add a file to the tar archive. Transform symlinks into files if the files lie out of the project tree.
		RU   t   arcnameR   i    Rz   t   rbt   fileobjN(   R   t
   gettarinfot   get_tar_prefixR   R   t   uidt   gidt   unamet   gnameR   R   t   addfileR   (   R   RK   R   t   pt   tinfot   fu(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR   y  s    2				c         C   s,   y |  i  SWn t j
 o |  i   SXd  S(   N(   t
   tar_prefixR   R   (   R   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR     s    c         C   sT   y |  i  Wn? t j
 o3 |  i   d |  i i |  i |  i  |  _  n X|  i  S(   s   
		Return the name of the archive to create. Change the default value by setting *arch_name*::

			def dist(ctx):
				ctx.arch_name = 'ctx.tar.bz2'

		:rtype: string
		R   (   R   R   R   t   ext_algoR   R   (   R   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR     s
    	1c         C   si   y |  i  WnT t j
 oH t t i t i d  } t t i t i d  } | d | |  _  n X|  i  S(   s   
		Return the default name of the main directory in the archive, which is set to *appname-version*.
		Set the attribute *base_name* to change the default value::

			def dist(ctx):
				ctx.base_name = 'files'

		:rtype: string
		t   nonames   1.0t   -(   t	   base_nameR   t   getattrR   RQ   t   APPNAMEt   VERSION(   R   t   appnameRB   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR     s    
c         C   sx   y |  i  SWnf t j
 oZ t i d |  _  |  i i t i  } | o# |  i  d | i |  i	  7_  n |  i  SXd S(   s   
		Return the patterns to exclude for finding the files in the top-level directory. Set the attribute *excl*
		to change the default value::

			def dist(ctx):
				ctx.excl = 'build **/*.o **/*.class'

		:rtype: string
		s    **/waf-1.7.* **/.waf-1.7* **/waf3-1.7.* **/.waf3-1.7* **/*~ **/*.rej **/*.orig **/*.pyc **/*.pyo **/*.bak **/*.swp **/.lock-w*t    N(
   t   exclR   R   t   exclude_regsRz   t	   find_nodeR   R+   R   R   (   R   t   nd(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   get_excl  s    
#c         C   sE   y |  i  } Wn1 t j
 o% |  i i d d |  i   } n X| S(   ss  
		The files to package are searched automatically by :py:func:`waflib.Node.Node.ant_glob`. Set
		*files* to prevent this behaviour::

			def dist(ctx):
				ctx.files = ctx.path.find_node('wscript')

		The files are searched from the directory 'base_path', to change it, set::

			def dist(ctx):
				ctx.base_path = path

		:rtype: list of :py:class:`waflib.Node.Node`
		s   **/*R   (   R|   R   R   t   ant_globR   (   R   R|   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR     s
    #(   RP   t
   __module__t   __doc__Rm   t   funR   R   Rd   R   R   R   R   R   R   R   R   (    (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR   3  s   		1						c         C   s   d S(   s.   makes a tarball for redistributing the sourcesN(    (   RD   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR\     s    t	   DistCheckc           B   s,   e  Z d  Z d Z d Z d   Z d   Z RS(   sp   
	Create an archive of the project, and try to build the project in a temporary directory::

		$ waf distcheck
	R^   c         C   s:   |  i  t i i t i i  g  |  i   |  i   d S(   s3   
		See :py:func:`waflib.Context.Context.execute`
		N(	   R   R   R%   R1   R   RQ   RZ   R   t   check(   R   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyRd     s    "
c   	      C   s  d d k  } d d k } d } z7 | i |  i    } x | D] } | i |  q= WWd | o | i   n Xg  } t i i	 o t
 i t i i	  } n9 g  } t i D]! } | i d  o | | q q ~ } | i d |  i    } t i i t i d d d d d	 | g | d
 |  i   i   } | o t i d |   n t i i |  o t i d |   n t i |  i    d S(   sD   
		Create the archive, uncompress it and try to build the project
		iNR   s   .insti    R	   t   installt	   uninstalls
   --destdir=t   cwds   distcheck failed with code %is.   distcheck succeeded, but files were left in %s(   t   tempfileR   R   R   R   t   extractR   R   R   t   distcheck_argst   shlexRh   R   R   R   t   mkdtempR   R    t
   subprocesst   Popent   waitR   R5   R   R%   t   existsRx   Ry   (	   R   R   R   t   tRK   t   cfgRi   t   instdirt   ret(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR     s(     8B(   RP   R   R   R   Rm   Rd   R   (    (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR     s
   	c         C   s   d S(   s4   checks if the project compiles (tarball from 'dist')N(    (   RD   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR^     s    c         C   s   t  i i i d  } | pI g  } t i t i d  D]! } | i d  o | | q7 q7 ~ } n xg | D]_ } | i	 d d  } y t
 i | d t d |  Wql t i j
 o t i d |  ql Xql Wd S(	   s6   updates the plugins from the *waflib/extras* directoryRa   s   /waflib/extrass   .pyR   t   forceRD   s3   Could not find the tool %s in the remote repositoryN(   R   R   R|   Rh   R    R"   R   R   Rr   R   R   t   download_toolR!   R   R5   R   R   (   RD   RH   Ri   RK   t   tool(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyR[     s    I c            s     f d   } | S(   sK   
	Decorator used to set the commands that can be configured automatically
	c      	      s  t  i p   |   St i   } t } y& | i t i i t i	 t
 i   Wn& t j
 o t i d  t } ng X| i t i j o
 t } nI d } x0 | d D]$ } t | t i | d  f  } q W| | i j } | o. t
 i i d |  i  t
 i i d d  d  S  |   S(   Ns   Configuring the projecti    R|   R   R	   (   R   t
   autoconfigR   R/   R$   R   R%   R&   R   R*   R   R#   R)   R   R.   R!   R   t   hashR    t   readfRe   t   insertRm   (   R   RI   t	   do_configt   hR}   (   t   execute_method(    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyRd   '  s*    
&
 "(    (   R   Rd   (    (   R   s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   autoconfigure#  s    (&   R   R   R   Rx   R9   R   R   R'   t   waflibR    R   R   R   R   R   R   R   R   R   t   build_dir_overrideR    Rf   RO   R3   Rj   Ro   R<   Rs   R   R]   R   R\   R   R^   R[   R   t   BuildContextRd   (    (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Scripting.pyt   <module>   s(   T@									!	3			