ó
!Æ^c           @€  sd  d  Z  d d l m Z d d l Z d d l Z d d l 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 m Z m Z m Z m Z m Z m Z d Z d g Z d Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d e j f d „  ƒ  YZ d „  Z  d e f d „  ƒ  YZ! d „  Z" d „  Z# e# e j$ j% ƒ e j$ _% d S(   s?   Module called for configuring, compiling and installing targetsiÿÿÿÿ(   t   with_statementN(	   t   Utilst	   Configuret   Logst   Optionst	   ConfigSett   Contextt   Errorst   Buildt   Nodet	   configuret   buildc         C€  s¿  t  j ƒ  t j | k rB t  j d | t j | ƒ t j d ƒ n  | t _ |  t _ t _	 |  } t
 j j d ƒ } t t j ƒ d k rt
 j j |  t j d ƒ } t
 j j | ƒ t j k rt
 j j | ƒ rt
 j j t
 j j | ƒ ƒ } t
 j j | ƒ } t } t j j d ƒ qn  t j d ƒ } | j d t ƒ \ } }	 }
 | j rp| j } t _ t _ t } n  | j rˆ| j t _ n  | sÌx; t D]0 } x' |	 D] } | j  | ƒ r¢t } Pq¢q¢Wq•Wn  | } xä| r¸y t
 j! | ƒ } Wn' t" k
 rg  } t  j d | ƒ n Xt# j$ | k r\t% j% ƒ  }
 y9 |
 j& t
 j j | t# j$ ƒ ƒ t
 j' | ƒ t' j( } Wn t) k
 rq\Xx¨ |
 j |
 j |
 j f D]x } | s«q™n  t* j+ rÍ| | k rt } Pqq™y t
 j' | ƒ t' j( } Wn t" k
 rúq™X| | k r™t } Pq™q™Wt  j, d | ƒ t- } | r\|
 j t _ |
 j t _ |
 j t _ Pq\n  t j sƒt j | k rƒ| t _ qƒn  t
 j j | ƒ } | | k r¥Pn  | } | rÕPqÕqÕWt
 j j t
 j j t j t j ƒ ƒ } t
 j j. | ƒ sH| j/ r%t  j, d ƒ | j0 j1 ƒ  t j d	 ƒ n  t  j d
 t j ƒ t j d ƒ n  y t
 j2 t j ƒ Wn1 t" k
 r�t  j d t j ƒ t j d ƒ n Xy t3 | ƒ WnŽ t4 j5 k
 ré} t  j6 d | j7 ƒ t  j t8 | ƒ ƒ t j d ƒ nF t9 k
 r.} t  j d t j ƒ t: j; d t j< ƒ t j d ƒ n X| j= rŽd d l> } d d l? } | j@ d i  i  d ƒ | jA d ƒ } | jB d ƒ jC d ƒ n-y` y tD ƒ  WnN | jE ræd d lE } t jF ƒ  \ } } } t: j; ƒ  | jG | ƒ qí‚  n XWnÊ t4 j5 k
 rH} t  jH d k r(t  j6 d | j7 ƒ n  t  j | jI ƒ t j d ƒ ns tJ k
 r[‚  n` t9 k
 r�} t: j; d t j< ƒ t j d ƒ n. tK k
 rºt  j6 d d ƒ t j 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   t   NOCLIMBt   optionst   allow_unknowns   Directory %r is unreadable!s   invalid lock file in %ss8   These are the generic options (no wscript/project found)i    sO   Waf: Run from a folder containing a %r file (or try -h for the generic options)s    Waf: The folder %r is unreadablet   REDs$   Waf: The wscript in %r is unreadablet   filei   iÿÿÿÿNs6   from waflib import Scripting; Scripting.run_commands()s	   profi.txtt   timeiK   t   InterruptediD   (L   R   t   init_logR   t
   WAFVERSIONt   errort   syst   exitt   waf_dirt   run_dirt
   launch_dirt   ost   environt   gett   lent   argvt   patht   joint   basenamet   WSCRIPT_FILEt   isfilet   normpatht   dirnamet   abspatht   Truet   popt   create_contextt   parse_cmd_argst   topt   top_dirt   outt   out_dirt   no_climb_commandst
   startswitht   listdirt   OSErrorR   t   lockfileR   t   loadt   statt   ST_INOt   EnvironmentErrorR   t   is_win32t   warnt   Falset   existst   whelpt   parsert
   print_helpt   chdirt   set_main_moduleR   t   WafErrort   pprintt   verbose_msgt   strt	   Exceptiont	   tracebackt	   print_exct   stdoutt   profilet   cProfilet   pstatst   runctxt   Statst
   sort_statst   print_statst   run_commandst   pdbt   exc_infot   post_mortemt   verboset   msgt
   SystemExitt   KeyboardInterrupt(   t   current_directoryt   versiont   wafdirt	   start_dirt   no_climbt   potential_wscriptR    t   ctxR   t   commandst   envt   kt   yt   curt   lstt   inot   xR5   t   ino2t   nextt   wscriptt   eRK   RL   t   pRR   t   typet   valuet   tb(    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   waf_entry_point   sö    
	-						'			
c         C€  s»   t  j |  ƒ t  _ |  t  j _ d „  } x! t t t f D] } | | ƒ q7 Wd t  j j k ro t j	 t  j _
 n  d t  j j k r“ t j	 t  j _ n  d t  j j k r· t j	 t  j _ 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€  s5   |  j  } | t j j k r1 t t j | |  ƒ n  d  S(   N(   t   __name__R   t   g_modulet   __dict__t   setattr(   t   objt   name(    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   set_defÅ   s    	t   initt   shutdownR   N(   R   t   load_moduleRr   t	   root_patht   distt	   distcleant	   distcheckRs   R   t   nadaRx   Ry   R   (   t	   file_pathRw   Rb   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyRA   ¶   s    		c          C€  s„   t  j d ƒ }  |  j ƒ  t j sW t t t ƒ rD t j j t ƒ qW t j j	 t ƒ n  t j
 j r€ |  j j ƒ  t j d ƒ n  d S(   s˜   
	Parses the command-line options and initialize the logging system.
	Called by :py:func:`waflib.Scripting.waf_entry_point` during the initialization.
	R   i    N(   R   R*   t   executeR   R`   t
   isinstancet   default_cmdt   listt   extendt   appendR   R=   R>   R?   R   R   (   R_   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   parse_optionsÓ   s    
	c         C€  sS   t  j |  ƒ } t j ƒ  | _ t j | _ |  | _ z | j ƒ  Wd | j	 ƒ  X| S(   s¤   
	Executes a single Waf command. Called by :py:func:`waflib.Scripting.run_commands`.

	:param cmd_name: command to execute, like ``build``
	:type cmd_name: string
	N(
   R   R*   R   t   Timert	   log_timerR   R   t   cmdR�   t   finalize(   t   cmd_nameR_   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   run_commandã   s    	c          C€  sc   t  ƒ  t d ƒ xA t j rT t j j d ƒ }  t |  ƒ } t j d |  | j ƒ q Wt d ƒ d S(   sè   
	Execute the Waf 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`.
	Rx   i    s   %r finished successfully (%s)Ry   N(   R‡   R�   R   R`   R)   R   t   infoR‰   (   RŒ   R_   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyRQ   õ   s    
c         C€  sû   x� t  j |  ƒ D]| \ } } } xj | D]b } | j d ƒ r& t  j j | | ƒ } y t  j | ƒ Wqˆ t k
 r„ t j d | ƒ qˆ Xq& q& Wq Wx< t	 j
 d f D]+ } y t  j | ƒ Wq  t k
 rÊ q  Xq  Wy t j t j ƒ Wn t k
 rö 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   .os   .mocs   .exes   Could not remove %rs
   config.logN(   s   .os   .mocs   .exe(   R   t   walkt   endswithR    R!   t   removeR3   R   R:   R   t   DBFILEt   shutilt   rmtreeR   t	   CACHE_DIR(   R&   t   roott   dirst   filest   ft   fnameRg   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   distclean_dir  s"    	c   
      C€  s  d „  } t  j sh xS t j d ƒ D]? } x6 d j ƒ  D]( } | j | ƒ r5 | | t j ƒ q5 q5 Wq" Wn  d } |  j j	 r‰ |  j j
 } n  y t j | ƒ } Wn" t k
 rÀ t j d | ƒ d SXt  j | k rt j j | t  j ƒ } y t j | ƒ } Wn" t k
 rt j d | ƒ d SX| j s4| j rHt j d | ƒ d S| j | j k rjt | j ƒ n | | j t j ƒ | j g } |  j j	 s¨| j | j ƒ n  |  j j sÇ| j | j ƒ n  x9 | D]. } t j j | t  j ƒ }	 | |	 t j ƒ qÎWn  d S(   s   removes build folders and datac         S€  sM   y | |  ƒ Wn8 t  k
 rH } | j t j k rI t j d |  ƒ qI n Xd  S(   Ns   Could not remove %r(   R8   t   errnot   ENOENTR   R:   (   Rb   t   funRk   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   remove_and_log%  s
    t   .s   .waf-2 waf-2 .waf3-2 waf3-2s   Could not read %rNs   Invalid lock file %r(   R   R`   R   R2   t   splitR1   R“   R”   R   t   no_lock_in_topR.   R3   R   R:   R4   R    R!   R   R8   R/   R-   R›   R†   t   no_lock_in_runR   R‘   (
   R_   RŸ   Rb   Rg   Rd   Re   R™   Ra   t   env_dirsRl   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR}   "  sF    		t   Distc           B€  sw   e  Z d  Z d Z d Z d Z i  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   |  j  t j j t j j ƒ g ƒ |  j ƒ  d S(   s3   
		See :py:func:`waflib.Context.Context.execute`
		N(   t   recurseR   R    R&   R   Rr   R{   t   archive(   t   self(    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR�   _  s    "c         C€  sû  d d l  } |  j ƒ  } y |  j Wn t k
 rB |  j |  _ n X|  j j | ƒ } y | j ƒ  Wn t k
 rv n X|  j ƒ  } |  j	 j
 d ƒ rî | j | j ƒ  d |  j	 j d d ƒ ƒ } x | D] } |  j | | ƒ qÇ W| j ƒ  n£ |  j	 d k r„d d l } | j | j ƒ  d d | j ƒ} xJ | D]B } |  j ƒ  d	 | j |  j ƒ }	 | j | j ƒ  |	 | j ƒ q1W| j ƒ  n |  j d
 ƒ y d d l m }
 Wn t k
 r¾d } n# Xd |
 | j d d ƒ ƒ j ƒ  } t j d |  j | ƒ d S(   s!   
		Creates the source archive.
		iÿÿÿÿNs   tar.s   w:t    t   zipt   wt   compressiont   /s3   Valid algo types are tar.bz2, tar.gz, tar.xz or zip(   t   sha256s    (sha256=%r)t   flagst   rbs   New archive created: %s%s(   t   tarfilet   get_arch_namet	   base_patht   AttributeErrorR    t	   make_nodet   deleteR3   t	   get_filest   algoR1   t   openR'   t   replacet   add_tar_filet   closet   zipfilet   ZipFilet   ZIP_DEFLATEDt   get_base_namet	   path_fromt   writet   fatalt   hashlibR®   t   ImportErrort   readt	   hexdigestR   RŽ   t	   arch_name(   R¨   R±   RÈ   t   nodeR˜   t   tarRg   R½   Rª   t   archive_nameR®   t   digest(    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR§   f  s>    +!  
"c         C€  s
   | j  ƒ  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

		:return: absolute path
		:rtype: string
		(   R'   (   R¨   RÉ   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   get_tar_path•  s    c         C€  s¶   |  j  | ƒ } | j d | d |  j ƒ  d | j |  j ƒ ƒ } d | _ d | _ d | _ d | _ t	 j
 j | ƒ r¥ t | d ƒ � } | j | d | ƒWd QXn | j | ƒ d S(	   su   
		Adds a file to the tar archive. Symlinks are not verified.

		:param x: file path
		:param tar: tar file object
		Rv   t   arcnameR­   i    R–   R°   t   fileobjN(   RÍ   t
   gettarinfot   get_tar_prefixRÁ   R³   t   uidt   gidt   unamet   gnameR   R    R$   R¹   t   addfile(   R¨   Rg   RÊ   Rl   t   tinfoR™   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR»   Ÿ  s    2				c         C€  s*   y |  j  SWn t k
 r% |  j ƒ  SXd S(   sW   
		Returns the base path for files added into the archive tar file

		:rtype: string
		N(   t
   tar_prefixR´   RÀ   (   R¨   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyRÑ   ³  s    c         C€  sR   y |  j  Wn= t k
 rJ |  j ƒ  d |  j j |  j |  j ƒ |  _  n X|  j  S(   s©   
		Returns the archive file name.
		Set the attribute *arch_name* to change the default value::

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

		:rtype: string
		R    (   RÈ   R´   RÀ   t   ext_algoR   R¸   (   R¨   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR²   ¾  s
    
0c         C€  sg   y |  j  WnR t k
 r_ t t j t j d ƒ } t t j t j d ƒ } | d | |  _  n X|  j  S(   sæ   
		Returns 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   Rr   t   APPNAMEt   VERSION(   R¨   t   appnameRZ   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyRÀ   Î  s    
c         C€  s€   y |  j  SWnn t k
 r{ t j d |  _  t j rt |  j j t j ƒ } | rt |  j  d | j |  j	 ƒ 7_  qt n  |  j  SXd S(   sÞ   
		Returns 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
		sy    **/waf-2.* **/.waf-2.* **/waf3-2.* **/.waf3-2.* **/*~ **/*.rej **/*.orig **/*.pyc **/*.pyo **/*.bak **/*.swp **/.lock-w*t    N(
   t   exclR´   R	   t   exclude_regsR   R/   R–   t	   find_nodeRÁ   R³   (   R¨   t   nd(    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   get_exclà  s    
	%c         C€  sC   y |  j  } Wn/ t k
 r> |  j j d d |  j ƒ  ƒ} n X| S(   sp  
		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')

		Files are also 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˜   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR·   ô  s
    "(   Rq   t
   __module__t   __doc__RŠ   Rž   R¸   RÙ   R�   R§   RÍ   R»   RÑ   R²   RÀ   Ræ   R·   (    (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR¥   X  s   		/	
					c         C€  s   d S(   s.   makes a tarball for redistributing the sourcesN(    (   R_   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR|   	  s    t	   DistCheckc           B€  s5   e  Z d  Z d Z d Z d „  Z d „  Z d „  Z RS(   s4   creates an archive with dist, then tries to build itR~   c         C€  s:   |  j  t j j t j j ƒ g ƒ |  j ƒ  |  j ƒ  d S(   s3   
		See :py:func:`waflib.Context.Context.execute`
		N(	   R¦   R   R    R&   R   Rr   R{   R§   t   check(   R¨   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR�     s    "
c         C€  s†   g  } t  j j r* t j t  j j ƒ } n+ g  t j D] } | j d ƒ r4 | ^ q4 } t j t j d d d d d d | g | } | S(   NRÛ   i    R
   R   t   installt	   uninstalls
   --destdir=(	   R   R   t   distcheck_argst   shlexR¡   R   R   R1   t
   executable(   R¨   t   tmpdirt   cfgRg   RŠ   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   make_distcheck_cmd  s    +-c         C€  sú   d d l  } d d l } | j |  j ƒ  ƒ �% } x | D] } | j | ƒ q7 WWd QX| j d |  j ƒ  ƒ } |  j | ƒ } t j	 j
 | d |  j ƒ  ƒj ƒ  } | r» t j d | ƒ ‚ n  t j j | ƒ rã t j d | ƒ ‚ n  t j |  j ƒ  ƒ d S(   sI   
		Creates the archive, uncompresses it and tries to build the project
		iÿÿÿÿNs   .instt   cwds   distcheck failed with code %rs.   distcheck succeeded, but files were left in %s(   t   tempfileR±   R¹   R²   t   extractt   mkdtempRÀ   Ró   R   t
   subprocesst   Popent   waitR   RB   R   R    R<   R“   R”   (   R¨   Rõ   R±   t   tRg   t   instdirRŠ   t   ret(    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyRë   #  s    $(   Rq   Rè   Ré   Rž   RŠ   R�   Ró   Rë   (    (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyRê     s   			c         C€  s   d S(   s4   checks if the project compiles (tarball from 'dist')N(    (   R_   (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR~   9  s    c         €  s   ‡  f d †  } | S(   sI   
	Decorator that enables context commands to run *configure* as needed.
	c         €  s¨  t  j s ˆ  |  ƒ St j ƒ  } t } y& | j t j j t j	 t
 j ƒ ƒ Wn$ t k
 rq t j d ƒ t } n… X| j t j k r� t } ni d } x` | j D]F } y% t j | t j | d ƒ f ƒ } Wq� t k
 râ t } Pq� Xq� W| | j k } | rš| j pd } t  j d k r€t
 j j } t j } | j rJ| j t
 j _ n  | j t _ z t | ƒ Wd | t
 j _ | t _ Xn
 t | ƒ t |  j ƒ n
 ˆ  |  ƒ Sd S(   sJ   
		Wraps :py:func:`waflib.Context.Context.execute` on the context class
		s   Configuring the projecti    R°   R
   t   clobberN(   R   t
   autoconfigR   R;   R5   R   R    R!   R   R-   R   R4   R8   R   R:   R(   R   R˜   R   t   h_listt   readft   hasht
   config_cmdR   Rs   R   R�   RŠ   (   R¨   Ra   t	   do_configt   hR™   RŠ   t   tmpt   launch_dir_tmp(   t   execute_method(    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyR�   A  sD    	
&
	%			
(    (   R  R�   (    (   R  s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   autoconfigure=  s    .(&   Ré   t
   __future__R    R   Rï   R“   RG   Rœ   R   R6   t   waflibR   R   R   R   R   R   R   R   R	   t   Nonet   build_dir_overrideR0   Rƒ   Rp   RA   R‡   R�   RQ   R›   R}   R¥   R|   Rê   R~   R	  t   BuildContextR�   (    (    (    s3   /git_repos/PolyLV2/poly_mclk_in/waflib/Scripting.pyt   <module>   s&   T@		¤						6±	,		3