
 Pc           @   s  d  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 Z	 d Z
 d Z d Z d Z d	 Z d Z d
 Z d Z d Z d Z d   Z h  a d e f d     YZ e d e f h   Z d e f d     YZ d e f d     YZ d   Z d   Z d   Z d   Z e i  d e i!  Z" d   Z# d   Z$ e% d  Z& e' e' d g  g  g  g  e% e' d 	 Z( d    Z) d!   Z* d S("   s6   
Tasks represent atomic operations such as processes.
iN(   t   Utilst   Logst   Errorsi    i   i   i   i   i	   iis   
def f(tsk):
	env = tsk.env
	gen = tsk.generator
	bld = gen.bld
	wd = getattr(tsk, 'cwd', None)
	p = env.get_flat
	tsk.last_cmd = cmd = ''' %s ''' % s
	return tsk.exec_command(cmd, cwd=wd, env=env.env or None)
s  
def f(tsk):
	env = tsk.env
	gen = tsk.generator
	bld = gen.bld
	wd = getattr(tsk, 'cwd', None)
	def to_list(xx):
		if isinstance(xx, str): return [xx]
		return xx
	tsk.last_cmd = lst = []
	%s
	lst = [x for x in lst if x]
	return tsk.exec_command(lst, cwd=wd, env=env.env or None)
c            sF   |  i    f d   } | |  _  |  i     f d   } | |  _ |  S(   s  
	Task class decorator applied to all task classes by default unless they define the attribute 'nocache'::

		from waflib import Task
		class foo(Task.Task):
			nocache = True

	If bld.cache_global is defined and if the task instances produces output nodes,
	the files will be copied into a folder in the cache directory

	The files may also be retrieved from that folder, if it exists
	c            sA   |  i  i } | i o! | i o |  i   o d Sn   |   S(   Ni    (   t	   generatort   bldt   cache_globalt   nocachet   can_retrieve_cache(   t   selfR   (   t   m1(    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   runP   s
    	c            s?   |  i  i }   |   } | i o | i o |  i   n | S(   N(   R   R   R   R   t   put_files_cache(   R   R   t   ret(   t   m2(    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   post_runY   s
    (   R
   R   (   t   clsR
   R   (    (   R   R	   s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   cache_outputsB   s    				t   store_task_typec           B   s   e  Z d  Z d   Z RS(   s.  
	Metaclass: store the task classes into :py:const:`waflib.Task.classes`, or to the dict pointed
	by the class attribute 'register'.
	The attribute 'run_str' will be processed to compute a method 'run' on the task class
	The decorator :py:func:`waflib.Task.cache_outputs` is also applied to the class
	c         C   s[  t  t |   i | | |  |  i } | i d  o | i d d  } n | d j o | d j o t |  d d   of t |  i	 |  i
  \ } } |  i	 |  _ d  |  _	 | |  _ t t |  i |   |  _ |  i i   n= t |  d d   o) d |  i j o t i |  i  |  _ n t |  d d   p t |   }  n |  t |  d	 t  | <n d  S(
   Nt   _taskt    t   evilt   TaskBaset   run_strR
   t   hcodeR   t   register(   t   superR   t   __init__t   __name__t   endswitht   replacet   getattrt   Nonet   compile_funR   t   shellR   R
   t   listt   sett   varst   sortt   __dict__R    t   h_funR   t   classes(   R   t   namet   basest   dictt   ft   dvars(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR   n   s"    			#(   R   t
   __module__t   __doc__R   (    (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR   g   s   R   R   c           B   s   e  Z d  Z d Z g  Z g  Z g  Z g  Z d Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d d  Z d   Z d   Z d   Z RS(   s.  
	Base class for all Waf tasks, which should be seen as an interface.
	For illustration purposes, instances of this class will execute the attribute
	'fun' in :py:meth:`waflib.Task.TaskBase.run`. When in doubt, create
	subclasses of :py:class:`waflib.Task.Task` instead.

	Subclasses should override these methods:

	#. __str__: string to display to the user
	#. runnable_status: ask the task if it should be run, skipped, or if we have to ask later
	#. run: let threads execute the task
	#. post_run: let threads update the data regarding the task (cache)
	t   GREENR   c         O   s=   t  |  _ y | d |  _ Wn t j
 o |  |  _ n Xd S(   sT   
		The base task class requires a task generator, which will be itself if missing
		R   N(   t   NOT_RUNt   hasrunR   t   KeyError(   R   t   kt   kw(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR      s
    	c         C   s/   d |  i  i t |   t t |  d d   f S(   s   for debugging purposess   
	{task %r: %s %s}t   funR   (   t	   __class__R   t   idt   strR   (   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   __repr__   s    c         C   s-   t  |  d  o d |  i i S|  i i d S(   s   string to display to the userR6   s   executing: %s
s   
(   t   hasattrR6   R   R7   (   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   __str__   s    c         C   s
   t  |   S(   su   Very fast hashing scheme but not persistent (replace/implement in subclasses and see :py:meth:`waflib.Task.Task.uid`)(   R8   (   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   __hash__   s    c         K   sn   |  i  i } y( | i d d  p | i | d <n Wn' t j
 o | i | _ | d <n X| i | |  S(   s   
		Wrapper for :py:meth:`waflib.Context.Context.exec_command` which sets a current working directory to ``build.variant_dir``

		:return: the return code
		:rtype: int
		t   cwdN(   R   R   t   getR   R>   t   AttributeErrort   variant_dirt   exec_command(   R   t   cmdR5   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyRB      s    c         C   s   t  S(   s   
		State of the task

		:return: a task state in :py:const:`waflib.Task.RUN_ME`, :py:const:`waflib.Task.SKIP_ME` or :py:const:`waflib.Task.ASK_LATER`.
		:rtype: int
		(   t   RUN_ME(   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   runnable_status   s    c         C   s  |  i  } | i o | i i |   d Sy |  i i i |  i   =Wn t j
 o n Xy9 |  i i i	 i
 |   |  i |  i i  |  i   } WnI t j
 o= t i   |  _ t |  _ | i |   | i i |   d SX| o | |  _ t |  _ n[ y |  i   Wn@ t i j
 o n5 t j
 o t i   |  _ t |  _ n Xt |  _ |  i t j o | i |   n | i i |   d S(   s   
		Assume that the task has had a new attribute ``master`` which is an instance of :py:class:`waflib.Runner.Parallel`.
		Execute the task and then put it back in the queue :py:attr:`waflib.Runner.Parallel.out` (may be replaced by subclassing).
		N(   t   mastert   stopt   outt   putR   R   t	   task_sigst   uidR3   t   returned_taskst   appendt   log_displayR
   t	   ExceptionR    t   ex_stackt   err_msgt	   EXCEPTIONR2   t   error_handlert   err_codet   CRASHEDR   R   t   WafErrort   SUCCESS(   R   t   mR   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   process   s@    	
			c         C   s"   t  |  d  o |  i |   Sd S(   s   
		Called by threads to execute the tasks. The default is empty and meant to be overridden in subclasses.
		It is a bad idea to create nodes in this method (so, no node.ant_glob)

		:rtype: int
		R6   i    (   R;   R6   (   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR
     s    c         C   s   d S(   sE   Update the cache files (executed by threads). Override in subclasses.N(    (   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s    c         C   s   | i  |  i    d S(   s0   Write the execution status on the context loggerN(   t   to_logt   display(   R   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyRN     s    c            s  t  i |  i  } t  i i } |  i     f d   } |  i i i d j o# |  i i i |     i	 | |  S|  i i i d j o t
 |  i i i  } y4 d i g  } |  i D] } | | i q ~  } Wn t j
 o d } n Xy4 d i g  } |  i D] } | | i q~  }	 Wn t j
 o d }	 n Xd   i	 |   | |	 | f St
 |   }
 |
 p d S  i	 } t t
 |   } d | | f } | |   | | |
 | f S(	   sh   
		Return an execution status for the console, the progress bar, or the IDE output.

		:rtype: string
		c             s8   d }  t    d  o |    i i   8}  n   i |  S(   Nit   ready(   R;   R\   t   qsizet	   processed(   t   tmp(   RF   (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   cur*  s    i   i   t   ,R   s3   |Total %s|Current %s|Inputs %s|Outputs %s|Time %s|
s   [%%%dd/%%%dd] %%s%%s%%sN(   R   t   colorst   colort   NORMALRF   R   R   t   progress_bart   progress_linet   totalR9   t   timert   joint   inputsR)   R@   t   outputsR   t   len(   R   t   col1t   col2R`   t   elat   _[1]t   nt   inst   _[2]t   outst   sRg   t   fs(    (   RF   s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR[      s0    	#44	c         C   s7   t  |  | |   } | |  j o t  |  i | |  S| S(   s   
		Retrieve an attribute from the instance or from the class.

		:param att: variable name
		:type att: string
		:param default: default value
		(   R   R7   (   R   t   attt   defaultR   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   attrI  s     c         C   s[   |  i  } t | i  t | i  t | i  t | i  | i | i f } t |  } | S(   s   
		Identify a task type for all the constraints relevant for the scheduler: precedence, file production

		:return: a hash value
		:rtype: string
		(	   R7   R9   t   beforet   aftert   ext_int   ext_outR   R   t   hash(   R   R   t   tupt   h(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   hash_constraintsU  s    	Bc         C   s   t  |  d d  } t  |  i d d  } t  |  d d
  o |  i S|  i p d | |  f S|  i t j oC y d | |  i |  | f SWq t j
 o d | |  | f SXn4 |  i t j o d | |  | f Sd	 | |  i f Sd
 S(   sO   
		Error message to display to the user when a build fails

		:rtype: string
		t   last_cmdR   R)   RQ   s/   task in %r was not executed for some reason: %rs-    -> task in %r failed (exit status %r): %r
%rs    -> task in %r failed: %r
%rs    -> missing files in %r: %r
%rs!   invalid status for task in %r: %rN(	   R   R   R   RQ   R2   RU   RT   R@   t   MISSING(   R   t   msgR)   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   format_errora  s    
c   	      C   s   |  i  | } t | t  o |  i  | } n | } t | t  o$ g  } | D] } | | | qO ~ St i o0 | o( | o! t i d | |  |  i f  n g  } x( | D]  } | i |  | i |  q W| Sd S(   s   
		private function for the moment

		used for scriptlet expressions such as ${FOO_ST:FOO}, for example, if
		env.FOO_ST = ['-a', '-b']
		env.FOO    = ['1', '2']
		then the result will be ['-a', '-b', '1', '-a', '-b', '2']
		s2   Missing env variable %r for task %r (generator %r)N(	   t   envt
   isinstanceR9   R   t   verboset   warnR   t   extendRM   (	   R   t   var1t   var2R_   t   itRp   t   xt   lstt   y(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   colonw  s    	$! N(   R   R.   R/   Rc   R|   R}   Rz   R{   R   R   R:   R<   R=   RB   RE   RY   R
   R   RN   R[   R   Ry   R   R   R   (    (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR      s,   	
							0				)		t   Taskc           B   s   e  Z d  Z g  Z e Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d Z d   Z d   Z d   Z d   Z d   Z RS(   s  
	This class deals with the filesystem (:py:class:`waflib.Node.Node`). The method :py:class:`waflib.Task.Task.runnable_status`
	uses a hash value (from :py:class:`waflib.Task.Task.signature`) which is persistent from build to build. When the value changes,
	the task has to be executed. The method :py:class:`waflib.Task.Task.post_run` will assign the task signature to the output
	nodes (if present).
	c         O   sN   t  i |  | |  | d |  _ g  |  _ g  |  _ g  |  _ t g   |  _ d  S(   NR   (   R   R   R   Rj   Rk   t	   dep_nodesR#   t	   run_after(   R   R4   R5   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s    			c      	   C   s   |  i  } d i g  } |  i D] } | | i   q ~  } d i g  } |  i D] } | | i   qP ~  } |  i o
 d } n d } d |  i i i d d  | | | f S(   s   string to display to the usert    s    -> R   s   %s: %s%s%s
R   (   R   Ri   Rj   t	   nice_pathRk   R7   R   R   (   R   R   Rp   t   at   src_strRs   t   tgt_strt   sep(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR<     s    	33
 
c         C   s  yd d i  g  } |  i D] } | | i q ~  } d i  g  } |  i D] } | | i qG ~  } Wny t j
 om d i  g  } |  i D] } | t |  q ~  } d i  g  } |  i D] } | t |  q ~  } n Xd i  d t |   |  i i d | d | d g  S(   s   for debugging purposesRa   R   s   
	{task %r: R   s    -> t   }(	   Ri   Rj   R)   Rk   R@   R9   R8   R7   R   (   R   Rp   R   Rr   Rs   Rt   t   _[3]t   _[4](    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR:     s    0438c         C   s   y |  i  SWn t j
 ov t i   } | i } | |  i i i    x. |  i |  i	 D] } | | i
   i    qX W| i   |  _  |  i  SXd S(   s  
		Return an identifier used to determine if tasks are up-to-date. Since the
		identifier will be stored between executions, it must be:

			- unique: no two tasks return the same value (for a given build context)
			- the same for a given task instance

		By default, the node paths, the class name, and the function are used
		as inputs to compute a hash.

		The pointer to the object (python built-in 'id') will change between build executions,
		and must be avoided in such hashes.

		:return: hash value
		:rtype: string
		N(   t   uid_R@   R    t   md5t   updateR7   R   t   encodeRj   Rk   t   abspatht   digest(   R   RX   t   upR   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyRK     s    	 c         C   s7   t  | t  o |  i | 7_ n |  i i |  d S(   sd   
		Append the nodes to the *inputs*

		:param inp: input nodes
		:type inp: node or list of nodes
		N(   R   R"   Rj   RM   (   R   t   inp(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt
   set_inputs  s     c         C   s7   t  | t  o |  i | 7_ n |  i i |  d S(   sf   
		Append the nodes to the *outputs*

		:param out: output nodes
		:type out: node or list of nodes
		N(   R   R"   Rk   RM   (   R   RH   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   set_outputs  s     c         C   s+   t  | t  p t  |  i i |  d S(   s   
		Run this task only after *task*. Affect :py:meth:`waflib.Task.runnable_status`
		You probably want to use tsk.run_after.add(task) directly

		:param task: task
		:type task: :py:class:`waflib.Task.Task`
		N(   R   R   t   AssertionErrorR   t   add(   R   t   task(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   set_run_after  s    c         C   s   y |  i  SWn t j
 o n Xt i   |  _ |  i i |  i i    |  i   |  i	   |  i
 o2 y |  i   Wq t i j
 o |  i   SXn |  i i   } |  _  | S(   s]  
		Task signatures are stored between build executions, they are use to track the changes
		made to the input nodes (not to the outputs!). The signature hashes data from various sources:

		* explicit dependencies: files listed in the inputs (list of node objects) :py:meth:`waflib.Task.Task.sig_explicit_deps`
		* implicit dependencies: list of nodes returned by scanner methods (when present) :py:meth:`waflib.Task.Task.sig_implicit_deps`
		* hashed data: variables/values read from task.__class__.vars/task.env :py:meth:`waflib.Task.Task.sig_vars`

		If the signature is expected to give a different result, clear the cache kept in ``self.cache_sig``::

			from waflib import Task
			class cls(Task.Task):
				def signature(self):
					sig = super(Task.Task, self).signature()
					delattr(self, 'cache_sig')
					return super(Task.Task, self).signature()
		(   t	   cache_sigR@   R    R   RX   R   R   R   t   sig_explicit_depst   sig_varst   scant   sig_implicit_depsR   t
   TaskRescant	   signatureR   (   R   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s      


c         C   s	  x  |  i  D] } | i p t Sq
 W|  i i } y |  i   } Wn t i j
 o t SX|  i   } y | i	 | } Wn% t
 j
 o t i d |   t SXxR |  i D]G } y | i | j o t SWq t j
 o t i d |   t SXq W| | j o t St S(   s   
		Override :py:meth:`waflib.Task.TaskBase.runnable_status` to determine if the task is ready
		to be run (:py:attr:`waflib.Task.Task.run_after`)
		sJ   task: task %r must run as it was never run before or the task code changeds7   task: task %r must run as the output nodes do not exist(   R   R2   t	   ASK_LATERR   R   R   R   t   TaskNotReadyRK   RJ   R3   R   t   debugRD   Rk   t   sigR@   t   SKIP_ME(   R   t   tR   t   new_sigt   keyt   prev_sigt   node(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyRE   )  s4    
 
	
 	
c         C   s   |  i  i } |  i   } xu |  i D]j } y t i | i    WnA t j
 o5 t |  _	 d | i   |  _
 t i |  i
   n X| | _ q" W|  i | i |  i   <d S(   sr  
		Called after successful execution to update the cache data :py:class:`waflib.Node.Node` sigs
		and :py:attr:`waflib.Build.BuildContext.task_sigs`.

		The node signature is obtained from the task signature, but the output nodes may also get the signature
		of their contents. See the class decorator :py:func:`waflib.Task.update_outputs` if you need this behaviour.
		s   -> missing file: %rN(   R   R   R   Rk   t   ost   statR   t   OSErrorR   R2   RQ   R   RV   R   R   RJ   RK   (   R   R   R   R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR   Q  s    
 	c         C   sy  |  i  i } |  i i } xa |  i |  i D]O } y | | i    Wq) t t f j
 o  t	 i
 d | |  f   q) Xq) W| i o | i } x |  i |  i D] } y | t |  } Wn t j
 o
 q n Xx | D] } t | | i i  oC y | i   } WqVt j
 o  t	 i
 d | |  f   qVXn t | d  o |   } n | |  q Wq Wn |  i i   S(   s   
		Used by :py:meth:`waflib.Task.Task.signature`, hash :py:attr:`waflib.Task.Task.inputs`
		and :py:attr:`waflib.Task.Task.dep_nodes` signatures.

		:rtype: hash value
		s.   Missing node signature for %r (required by %r)t   __call__(   R   R   RX   R   Rj   R   t   get_bld_sigR@   t	   TypeErrorR   RV   t   deps_manRk   R8   R3   R   t   rootR7   R;   R   (   R   R   t   updR   t   additional_depst   dt   v(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR   j  s6     "
	  "c         C   s   |  i  i } |  i } |  i i } | i | |  i i  } | |  t |  d d  } | o | | i | |   n |  i i
   S(   s   
		Used by :py:meth:`waflib.Task.Task.signature`, hash :py:attr:`waflib.Task.Task.env` variables/values

		:rtype: hash value
		t   dep_varsN(   R   R   R   RX   R   t   hash_env_varsR7   R$   R   R   R   (   R   R   R   R   t   act_sigR   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s    	
c   	      C   s;  |  i  i } |  i   } | i i | d f g   } | o y | |  i   j o | SWn t j
 o x | i i |  i   g   D]t } | i | i	  o[ y t
 i | i    Wq t j
 o1 y | i i | i =Wq t j
 o q Xq Xq q Wn X| i | d f =t i d   n |  i   \ } } t i o0 t i d t |   t |  t |  f  n | | i | <| | i | <|  i   y! |  i   | i | d f <} Wn| t j
 op t i o_ x\ | i i |  i   g   D]; } y | i   Wqt j
 o t i d |  qXqWq7n X| Sd S(   s  
		Used by :py:meth:`waflib.Task.Task.signature` hashes node signatures obtained by scanning for dependencies (:py:meth:`waflib.Task.Task.scan`).

		The exception :py:class:`waflib.Errors.TaskRescan` is thrown
		when a file has changed. When this occurs, :py:meth:`waflib.Task.Task.signature` is called
		once again, and this method will be executed once again, this time calling :py:meth:`waflib.Task.Task.scan`
		for searching the dependencies.

		:rtype: hash value
		t   impt   rescans#   deps: scanner for %s returned %s %ss2   Missing signature for node %r (may cause rebuilds)N(   R   R   RK   RJ   R?   t   compute_sig_implicit_depsRO   t	   node_depst   is_child_oft   srcnodeR   R   R   R   t   parentt   childrenR)   R3   R   R   R   R   R   R   R9   t   raw_depst   are_implicit_nodes_readyR   R   (	   R   R   R   t   prevR   t   nodest   namesR   R4   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     sJ    	 
0
!
 #c         C   se   |  i  i } |  i i } |  i   x3 | i i |  i   g   D] } | | i    q> W|  i  i	   S(   s   
		Used by :py:meth:`waflib.Task.Task.sig_implicit_deps` for computing the actual hash of the
		:py:class:`waflib.Node.Node` returned by the scanner.

		:return: hash value
		:rtype: string
		(
   RX   R   R   R   R   R   R?   RK   R   R   (   R   R   R   R4   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s    	
 c         C   s=  |  i  i } y | i } Wn  t j
 o h  | _ } n Xy | | i } WnV t j
 oJ h  } | | i <x4 | i D]$ } x | i D] } | | | <q Wqy Wn Xt } xN | i	 i
 |  i   g   D]1 } | | j o |  i i | |  t } q q W| o5 x2 |  i D]# } | i p t i d   qqWn d S(   s   
		For each node returned by the scanner, see if there is a task behind it, and force the build order

		The performance impact on null builds is nearly invisible (1.66s->1.86s), but this is due to
		agressive caching (1.86s->28s)
		s	   not readyN(   R   R   t   dct_implicit_nodesR@   R`   R3   t	   cur_tasksRk   t   FalseR   R?   RK   R   R   t   TrueR2   R   R   (   R   R   t   cachet   dctt   tskR   t   modified(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s2    
 
  
 
c         C   s  t  |  d d  p d S|  i   } t i |  i    t i |  } t i i |  i	 i
 i |  } y t i |  i } Wn t j
 o d SXx} |  i D]r } t i i | | i  } y* t i | | i    t i | d  Wq t t f j
 o t i d  d SXq Wy t i |  i } Wn t j
 o d SX| | j o d SxQ |  i D]F } | | _ |  i	 i
 i d j  o! |  i	 i
 i d | i    qZqZWt |  _ t S(   s,  
		Used by :py:meth:`waflib.Task.cache_outputs`

		Retrieve build nodes from the cache
		update the file timestamps to help cleaning the least used entries from the cache
		additionally, set an attribute 'cached' to avoid re-creating the same cache files

		Suppose there are files in `cache/dir1/file1` and `cache/dir2/file2`:

		#. read the timestamp of dir1
		#. try to copy the files
		#. look at the timestamp again, if it has changed, the data may have been corrupt (cache update by another process)
		#. should an exception occur, ignore the data
		Rk   s   task: failed retrieving filei   s   restoring from cache %r
N(   R   R   R   R    t   to_hexRK   R   t   pathRi   R   R   R   R   t   st_mtimeR   Rk   R)   t   shutilt   copy2R   t   utimet   IOErrorR   R   R   Re   RZ   R   t   cached(   R   R   t   ssigt   dnamet   t1R   t   origt   t2(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR   .  s>    "
 

 	%	c         C   s  t  |  d d  o d St  |  d d  p d S|  i   } t i |  i    t i |  } t i i |  i	 i
 i |  } t i d |  i	 i
 i t i d  } y t i |  Wn t j
 o n XyF x? |  i D]4 } t i i | | i  } t i | i   |  q WWn@ t t f j
 o. y t i |  Wqt j
 o qXn Xy t i | |  Wn: t j
 o. y t i |  Wqt j
 o qXn/ Xy t i | t i  Wn t j
 o n Xd S(   sX   
		Used by :py:func:`waflib.Task.cache_outputs` to store the build files in the cache
		R   Rk   t   prefixt   wafN(   R   R   R   R    R   RK   R   R   Ri   R   R   R   t   tempfilet   mkdtempR   R   t   rmtreeRO   Rk   R)   R   R   R   R   t   renamet   chmodt   O755(   R   R   R   R   t   tmpdirR   t   dest(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR   f  sB    "&
 

N(   R   R.   R/   R$   R   R!   R   R<   R:   RK   R   R   R   R   RE   R   R   R   R   R   R   R   R   R   R   (    (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s*   				
		
	
		(	(		&		@		!	8c         C   s   t  i } x2 | | i  D]! } | | |  i  j o d Sq W|  i i | | i  j o d S| i i | |  i  j o d Sd S(   s<  
	Return a non-zero value if task t1 is to be executed before task t2::

		t1.ext_out = '.h'
		t2.ext_in = '.h'
		t2.after = ['t1']
		t1.before = ['t2']
		waflib.Task.is_before(t1, t2) # True

	:param t1: task
	:type t1: :py:class:`waflib.Task.TaskBase`
	:param t2: task
	:type t2: :py:class:`waflib.Task.TaskBase`
	i   i    (   R    t   to_listR|   R}   R7   R   R{   Rz   (   R   R   R   R4   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt	   is_before  s    	 	c         C   s  t  i t  } t  i t  } x |  D]~ } xA t | d g   t | d g   D] } | t |  i |  qN Wx1 t | d g   D] } | t |  i |  q Wq% Wt | i    i | i    } x7 | D]/ } x& | | D] } | i i	 | |  q Wq Wd S(   s   
	Adds tasks to the task 'run_after' attribute based on the task inputs and outputs

	:param tasks: tasks
	:type tasks: list of :py:class:`waflib.Task.TaskBase`
	Rj   R   Rk   N(
   R    t   defaultdictR#   R   R8   R   t   keyst   intersectionR   R   (   t   tasksRr   Rt   R   R   t   linksR4   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   set_file_constraints  s      #  !  c         C   s8  t  i t  } x+ |  D]# } | i   } | | i |  q Wt | i    } t |  } x t |  D] } | | | d } x t | d |  D] } | | | d }	 t | |	  o | }
 | } n$ t |	 |  o | }
 | } n q t	 | | |
  } x& | | | D] } | i
 i |  qWq Wqh Wd S(   s   
	Add tasks to the task 'run_after' attribute based on the after/before/ext_out/ext_in attributes

	:param tasks: tasks
	:type tasks: list of :py:class:`waflib.Task.TaskBase`
	i    i   N(   R    R   R"   R   RM   R   Rl   t   rangeR   R#   R   R   (   R   t   cstr_groupsR   R   R   t   maxit   iR   t   jR   R   t   bt   aval(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   set_precedence_constraints  s0       

 c         B   s   h  } |  | f d U| d S(   s   
	Compile a function by 'exec'

	:param c: function to compile
	:type c: string
	:return: the function 'f' declared in the input string
	:rtype: function
	NR,   (    (   t   ct   dc(    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   funex  s    	sM   (?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})c   	   	      s  g      f d   } t  i | |   p |  }  g  } g  } | i } x]  D]U\ } } | d j o' | o | d |  q| d  qJ | d j o' | o | d |  q| d  qJ | o | i d  o | d	 } | d j o
 d
 } nN | d j o
 d } n7 | d  d j o% | i | | d	 g  d | } n | d | | f  q| d | | f  qJ | | j o | i |  n | d |  qJ W| o d d i |  } n d } t |  | f } t i d | i	   i
    t |  | f S(   s   
	Create a compiled function to execute a process with the shell
	WARNING: this method may disappear anytime, so use compile_fun instead
	c            sb   |  i  } | d  o d S| d  o d S| d  o$   i | d  | d  f  d Sd  S(	   Nt   dollart   $t	   backslashs   \\t   substt   vart   codes   %s(   t   groupRM   R   (   t   matcht   g(   t   extr(    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   repl  s    	    t   SRCs   tsk.inputs%ss8   " ".join([a.path_from(bld.bldnode) for a in tsk.inputs])t   TGTs   tsk.outputs%ss9   " ".join([a.path_from(bld.bldnode) for a in tsk.outputs])t   :i   s.   [a.path_from(bld.bldnode) for a in tsk.inputs]s/   [a.path_from(bld.bldnode) for a in tsk.outputs]i   R   t   genR   s   %rs   " ".join(tsk.colon(%r, %s))s   %s%ss   p('%s')s   %% (%s) s   ,
		R   s
   action: %s(   s   tskR  s   bld(   t   reg_actt   subRM   t
   startswithR   Ri   t   COMPILE_TEMPLATE_SHELLR   R   t   stript
   splitlinesR
  (	   t   lineR  t   parmR-   t   appR  t   methRX   R  (    (   R  s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   compile_fun_shell  sJ    	   


  c            sx  g      f d   } t  i | |   } | i d  }   p t  g  } g  } | i } xt t     D]} | | i   | | <| | o | d | | i    n   | \ } }	 | d j o' |	 o | d |	  q| d  ql | d j o' |	 o | d |	  q| d	  ql |	 o |	 i d
  o |	 d }
 |
 d j o
 d }
 nJ |
 d j o
 d }
 n3 |
 d  d j o! | i	 | |
 g  d |
 }
 n | d | |
 f  q| d | |	 f  ql | d |  | | j o | i |  ql ql W  o+ | d o | d | d i    q8n t
 d i |  } t i d | i   i    t |  | f S(   s   
	Create a compiled function to execute a process without the shell
	WARNING: this method may disappear anytime, so use compile_fun instead
	c            sP   |  i  } | d  o d S| d  o$   i | d  | d  f  d Sd  S(   NR  R  R  R  R  s   <<|@|>>(   R  RM   R   (   R  R  (   R  (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR  ,  s    	   s   <<|@|>>s   lst.extend(%r)R  s   lst.append(tsk.inputs%s)s:   lst.extend([a.path_from(bld.bldnode) for a in tsk.inputs])R  s   lst.append(tsk.outputs%s)s;   lst.extend([a.path_from(bld.bldnode) for a in tsk.outputs])R  i   s.   [a.path_from(bld.bldnode) for a in tsk.inputs]s/   [a.path_from(bld.bldnode) for a in tsk.outputs]i   R   R  R   s   %rs   lst.extend(tsk.colon(%r, %s))s   lst.extend(gen.to_list(%s%s))s   lst.extend(to_list(env[%r]))is   
	s
   action: %s(   s   tsks   gens   bld(   R  R  t   splitR   RM   R   Rl   R  R  R   t   COMPILE_TEMPLATE_NOSHELLRi   R   R   R  R
  (   R   R  t   line2t   paramst   bufR-   R"  R   R  R#  RX   R6   (    (   R  s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   compile_fun_noshell&  sV    	   


  c         C   sl   |  i  d  d j p, |  i  d  d j p |  i  d  d j o
 t } n | o t |   St |   Sd S(   s`  
	Parse a string expression such as "${CC} ${SRC} -o ${TGT}" and return a pair containing:

	* the function created (compiled) for use as :py:meth:`waflib.Task.TaskBase.run`
	* the list of variables that imply a dependency from self.env

	for example::

		from waflib.Task import compile_fun
		compile_fun('cxx', '${CXX} -o ${TGT[0]} ${SRC} -I ${SRC[0].parent.bldpath()}')

		def build(bld):
			bld(source='wscript', rule='echo "foo\${SRC[0].name}\bar"')

	The env variables (CXX, ..) on the task must not hold dicts (order)
	The reserved keywords *TGT* and *SRC* represent the task input and output nodes

	t   <i    t   >s   &&N(   t   findR   R$  R*  (   R   R!   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR    \  s
    B
R0   c
         C   s   h	 | p g  d 6| d 6|  d 6t  i |  d 6t  i |  d 6t  i |  d 6t  i |  d 6| d 6|	 d	 6}
 t | t  o | |
 d
 <n | |
 d <t t  |  t f |
  } | t |  <| S(   sL  
	Deprecated. Return a new task subclass with the function ``run`` compiled from the line given.
	Provided for compatibility with waf 1.4-1.5, when we did not have the metaclass to register new classes (will be removed in Waf 1.8)

	:param func: method run
	:type func: string or function
	:param vars: list of variables to hash
	:type vars: list of string
	:param color: color to use
	:type color: string
	:param shell: when *func* is a string, enable/disable the use of the shell
	:type shell: bool
	:param scan: method scan
	:type scan: function
	:rtype: :py:class:`waflib.Task.Task`
	R$   Rc   R)   R|   R}   Rz   R{   R!   R   R   R
   (   R    R   R   R9   t   typeR   R(   (   R)   t   funcR$   Rc   R|   R}   Rz   R{   R!   R   R(  R   (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   task_factoryw  s     


c            s%   |  i      f d   } | |  _  |  S(   s   
	Task class decorator

	Set all task instances of this class to be executed whenever a build is started
	The task signature is calculated, but the result of the comparation between
	task signatures is bypassed
	c            s'     |   } | t  j o
 t } n | S(   N(   R   RD   (   R   R   (   t   old(    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   always  s    
(   RE   (   R   R2  (    (   R1  s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt
   always_run  s    		c            sF   |  i      f d   } | |  _  |  i   f d   } | |  _ |  S(   s  
	Task class decorator

	If you want to create files in the source directory. For example, to keep *foo.txt* in the source
	directory, create it first and declare::

		def build(bld):
			bld(rule='cp ${SRC} ${TGT}', source='wscript', target='foo.txt', update_outputs=True)
	c            sY     |   xH |  i  D]= } t i | i    | _ |  i   |  i i i | i   <q Wd  S(   N(	   Rk   R    t   h_fileR   R   RK   R   R   RJ   (   R   R   (   t   old_post_run(    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyR     s
    

 c            s     |   } | t  j o | Sy |  i i } | i |  i   } | |  i   j oI xA |  i D]6 } | i p  | i | i   |  i   j o t  Sq] Wt	 SWn7 t
 j
 o n& t j
 o n t j
 o n Xt  S(   N(   RD   R   R   RJ   RK   R   Rk   R   R   R   R3   t
   IndexErrorR@   (   R   t   statusR   R   R   (   t   old_runnable_status(    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyRE     s&    
 +		(   R   RE   (   R   R   RE   (    (   R5  R8  s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   update_outputs  s    
				(+   R/   R   R   t   reR   t   waflibR    R   R   R1   R   RU   RR   t   SKIPPEDRW   R   R   RD   R  R&  R   R(   R.  R   t   objectR   R   R   R   R   R  R
  t   compilet   MR  R$  R*  R   R    R   R0  R3  R9  (    (    (    s8   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Task.pyt   <module>   sB   0	""   			#		2	6$)	