ó
"Æ^c           @€  s  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
 Z
 d d l Z d d l Z d d l Z d d l Z y d d l Z Wn e k
 rÕ d d l Z n Xe j d k r+e j d d k  r+y d d l Z Wq7e k
 r'd d l Z q7Xn d d l Z y e j Z Wn' e k
 rmd e f d „  ƒ  YZ n Xd d	 l m Z m Z y d d l Z Wn; e k
 rÑy d d l Z WqÒe k
 rÍd Z qÒXn Xd d
 l m  Z  y d d l! m" Z" Wn9 e k
 r1y d d l! m# Z" Wqge k
 r-qgXn6 Xy e" ƒ  j$ ƒ  Wn! e% k
 rfd d l! m# Z" n Xy d d l& Z& Wnl e k
 råd e j' k r¦d e j' d <n  d e( f d „  ƒ  YZ& d e( f d „  ƒ  YZ) e) e& _) e& _* n Xd j+ ƒ  Z, d Z- d Z. d d d d g Z/ d Z0 d e1 f d „  ƒ  YZ2 d e( f d „  ƒ  YZ3 d e( f d „  ƒ  YZ4 d  e( f d! „  ƒ  YZ5 e j6 d k p˜e j
 d" k p˜e j d# k Z7 d$ d% d& „ Z8 d' d% d( „ Z9 d) „  Z: d$ d% d* „ Z; d' d% d+ „ Z< d, „  Z= e8 Z> e9 Z? e: Z@ eA e d- ƒ r.e jB d. k  r.e; Z8 e< Z9 e= Z: n  y d/ j+ d0 ƒ ZC Wn& eD k
 rid d lE ZE d1 „  ZF n
 Xd2 „  ZF d3 eF _  d4 „  ZG e jH ZH e7 r�eG ZH n  d5 „  ZI d6 „  ZJ d7 „  ZK d8 „  ZL d9 „  ZM e jN d: ƒ ZO d; „  ZP d aQ d< „  ZR e j
 d= k r	eM ZS nB e7 rEe j' jT d> ƒ r<e jU jV d ƒ r<eR ZS qKeP ZS n eL ZS d? eS _  d@ „  ZW d dA „ ZX dB „  ZY dC „  ZZ e jN dD ƒ Z[ dE „  Z\ dF „  Z] e jB dG k  rÉdH „  Z^ e] j  e^ _  e^ Z] n  dI „  Z_ dJ „  Z` e jN dK ƒ Za dL „  Zb dM „  Zc dN „  Zd dO „  Ze dP e( f dQ „  ƒ  YZf dR „  Zg dS „  Zh dT „  Zi dU „  Zj dV „  Zk g  Zl dW „  am dX „  Zn d d dY „ Zo i  dZ „ Zp i  d[ „ aq er d\ „ as d] „  Zt e jB d^ k  r»e7 sÊe jB d_ k rÚe ju et ƒ n  e j' jT d` ƒ se j
 da k se jU rep aq ee am as n  d S(b   sÈ   
Utilities and platform-specific fixes

The portability fixes try to provide a consistent behavior of the Waf API
through Python versions 2.5 to 3.X and across different platforms (win32, linux, etc)
iÿÿÿÿ(   t   with_statementNt   posixi    i   t   TimeoutExpiredc           B€  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   !   s   (   t   dequet   defaultdict(   t   Errors(   t   md5(   t   sha1t   JOBSt   1t	   threadingc           B€  s   e  Z d  Z RS(   sm   
		A fake threading class for platforms lacking the threading module.
		Use ``waf -j1`` on those platforms
		(   R   R   t   __doc__(    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   F   s   t   Lockc           B€  s    e  Z d  Z d „  Z d „  Z RS(   s   Fake Lock classc         C€  s   d  S(   N(    (   t   self(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   acquireN   s    c         C€  s   d  S(   N(    (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   releaseP   s    (   R   R   R   R   R   (    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   L   s   	t   SIG_NIL_SIG_NIL_i¤  ií  s   \t   |t   /t   -t   ordered_iter_dictc           B€  sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sU   Ordered dictionary that provides iteration from the most recently inserted keys firstc         O€  s#   t  ƒ  |  _ t j |  | | Ž d  S(   N(   R   t   lstt   dictt   __init__(   R   t   kt   kw(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   e   s    c         C€  s   t  j |  ƒ t ƒ  |  _ d  S(   N(   R   t   clearR   R   (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   h   s    c         C€  sO   | t  j |  ƒ k r( |  j j | ƒ n  t  j |  | | ƒ |  j j | ƒ d  S(   N(   R   t   keysR   t   removet   __setitem__t   append(   R   t   keyt   value(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   k   s    c         C€  s<   t  j |  | ƒ y |  j j | ƒ Wn t k
 r7 n Xd  S(   N(   R   t   __delitem__R   R   t
   ValueError(   R   R!   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR#   p   s
    c         C€  s   t  |  j ƒ S(   N(   t   reversedR   (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   __iter__v   s    c         C€  s   t  |  j ƒ S(   N(   R%   R   (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   x   s    (	   R   R   R   R   R   R   R#   R&   R   (    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   c   s   					t   lru_nodec           B€  s   e  Z d  Z d Z d „  Z RS(   s.   
	Used by :py:class:`waflib.Utils.lru_cache`
	t   nextt   prevR!   t   valc         C€  s(   |  |  _  |  |  _ d  |  _ d  |  _ d  S(   N(   R(   R)   t   NoneR!   R*   (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   €   s    			(   R(   R)   R!   R*   (   R   R   R   t	   __slots__R   (    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR'   {   s   t	   lru_cachec           B€  s2   e  Z d  Z d Z d d „ Z d „  Z d „  Z RS(	   s;   
	A simple least-recently used cache with lazy allocation
	t   maxlent   tablet   headid   c         C€  s@   | |  _  i  |  _ t ƒ  |  _ |  j |  j _ |  j |  j _ d  S(   N(   R.   R/   R'   R0   R(   R)   (   R   R.   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   ‹   s
    		c         C€  s€   |  j  | } | |  j k r# | j S| j | j _ | j | j _ |  j j | _ |  j | _ | |  _ | j _ | j _ | j S(   N(   R/   R0   R*   R(   R)   (   R   R!   t   node(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   __getitem__˜   s    c         C€  så   | |  j  k r5 |  j  | } | | _ |  j | ƒ n¬ t |  j  ƒ |  j k  rŠ t ƒ  } |  j | _ |  j j | _ | | j _ | j _ n8 |  j j } |  _ y |  j  | j	 =Wn t
 k
 rÁ n X| | _	 | | _ | |  j  | <d  S(   N(   R/   R*   R2   t   lenR.   R'   R0   R)   R(   R!   t   KeyError(   R   R!   R*   R1   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   ©   s"    				(   R.   R/   R0   (   R   R   R   R,   R   R2   R   (    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR-   †   s
   	t   lazy_generatorc           B€  s)   e  Z d  „  Z d „  Z d „  Z e Z RS(   c         C€  s   | |  _  | |  _ d  S(   N(   t   funt   params(   R   R6   R7   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   Ã   s    	c         C€  s   |  S(   N(    (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR&   Ç   s    c         C€  sD   y |  j  } Wn* t k
 r9 |  j |  j Œ  } |  _  n Xt | ƒ S(   N(   t   itt   AttributeErrorR6   R7   R(   (   R   R8   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   __next__Ê   s
    (   R   R   R   R&   R:   R(   (    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR5   Â   s   			t   win32t   ntt   rs   latin-1c         C€  s˜   t  j d k rp d | k rp | d 7} t |  | ƒ � } | j ƒ  } Wd QX| ra | j | ƒ } q” | j ƒ  } n$ t |  | ƒ � } | j ƒ  } Wd QX| S(   sÉ  
	Reads an entire file into a string. See also :py:meth:`waflib.Node.Node.readf`::

		def build(ctx):
			from waflib import Utils
			txt = Utils.readf(self.path.find_node('wscript').abspath())
			txt = ctx.path.find_node('wscript').read()

	:type  fname: string
	:param fname: Path to file
	:type  m: string
	:param m: Open mode
	:type encoding: string
	:param encoding: encoding value, only used for python 3
	:rtype: string
	:return: Content of the file
	i   t   bN(   t   syst
   hexversiont   opent   readt   decode(   t   fnamet   mt   encodingt   ft   txt(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   readfØ   s    
t   wc         C€  s`   t  j d k r7 d | k r7 | j | ƒ } | d 7} n  t |  | ƒ � } | j | ƒ Wd QXd S(   s  
	Writes an entire file from a string.
	See also :py:meth:`waflib.Node.Node.writef`::

		def build(ctx):
			from waflib import Utils
			txt = Utils.writef(self.path.make_node('i_like_kittens').abspath(), 'some data')
			self.path.make_node('i_like_kittens').write('some data')

	:type  fname: string
	:param fname: Path to file
	:type   data: string
	:param  data: The contents to write to the file
	:type  m: string
	:param m: Open mode
	:type encoding: string
	:param encoding: encoding value, only used for python 3
	i   R>   N(   R?   R@   t   encodeRA   t   write(   RD   t   dataRE   RF   RG   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   writefø   s
    c         C€  sT   t  ƒ  } t |  d ƒ �0 } x& |  rC | j d ƒ }  | j |  ƒ q WWd QX| j ƒ  S(   sô   
	Computes a hash value for a file by using md5. Use the md5_tstamp
	extension to get faster build hashes if necessary.

	:type fname: string
	:param fname: path to the file to hash
	:return: hash of the file contents
	:rtype: string or bytes
	t   rbi@ N(   R   RA   RB   t   updatet   digest(   RD   RE   RG   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   h_file  s    
		c         C€  s   t  j t  j B} d | k r, | t  j O} n  d | k rH | t  j O} n  y t  j |  | ƒ } Wn! t k
 r� t d |  ƒ ‚ n Xt j	 d k rõ d | k rõ | d 7} t  j
 | | ƒ � }  |  j ƒ  } Wd  QX| ræ | j | ƒ } q| j ƒ  } n' t  j
 | | ƒ � }  |  j ƒ  } Wd  QX| S(   NR>   t   +s   Cannot read from %ri   (   t   ost   O_NOINHERITt   O_RDONLYt   O_BINARYt   O_RDWRRA   t   OSErrort   IOErrorR?   R@   t   fdopenRB   RC   (   RG   RE   RF   t   flagst   fdRH   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   readf_win32"  s&    
c         C€  só   t  j d k r7 d | k r7 | j | ƒ } | d 7} n  t j t j Bt j Bt j B} d | k rq | t j O} n  d | k r� | t j	 O} n  y t j
 |  | ƒ } Wn! t k
 rÆ t d |  ƒ ‚ n Xt j | | ƒ � }  |  j | ƒ Wd  QXd  S(   Ni   R>   RS   s   Cannot write to %r(   R?   R@   RK   RT   t   O_CREATt   O_TRUNCt   O_WRONLYRU   RW   RX   RA   RY   R[   RL   (   RG   RM   RE   RF   R\   R]   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   writef_win32:  s    c         C€  s¢   y' t  j |  t  j t  j Bt  j Bƒ } Wn! t k
 rJ t d |  ƒ ‚ n Xt ƒ  } t  j | d ƒ �0 } x& |  r‘ | j d ƒ }  | j	 |  ƒ ql WWd  QX| j
 ƒ  S(   Ns   Cannot read from %rRO   i@ (   RT   RA   RW   RV   RU   RY   R   R[   RB   RP   RQ   (   RD   R]   RE   RG   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   h_file_win32J  s    '		RU   i  t    t   hexc         C€  s4   t  j |  ƒ } t | t ƒ s0 | j d ƒ } n  | S(   Ns   utf-8(   t   binasciit   hexlifyt
   isinstancet   strRC   (   t   st   ret(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   to_hexd  s    c         C€  s   |  j  d ƒ S(   NRe   (   RK   (   Rj   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyRl   j  s    s`   
Return the hexadecimal representation of a string

:param s: string to convert
:type s: string
c   	      C€  sK  |  sÕ y d d l  } Wn) t k
 rA g  d D] } | d ^ q- SXd } d } | j | | ƒ } | j j j | | | j | ƒ ƒ } g  t t | | ƒ ƒ D]1 } t	 | j
 d | d | d !j d ƒ ƒ ^ q� Sn  t |  ƒ d k r|  d	 d
 k r|  t j 7}  n  t j j |  ƒ s>t d |  ƒ } t j | _ | ‚ n  t j |  ƒ S(   sÝ   
	Lists the contents of a folder in a portable manner.
	On Win32, returns the list of drive letters: ['C:', 'X:', 'Z:'] when an empty string is given.

	:type s: string
	:param s: a string, which can be empty on Windows
	iÿÿÿÿNt   ABCDEFGHIJKLMNOPQRSTUVWXYZs   :\i   i   i   t   asciii   t   :s   %s is not a directory(   t   ctypest   ImportErrort   create_string_buffert   windllt   kernel32t   GetLogicalDriveStringsAt   byreft   ranget   intRi   t   rawRC   R3   RT   t   sept   patht   isdirRY   t   errnot   ENOENTt   listdir(	   Rj   Rp   t   xt   dlent	   maxdrivest   buft   ndrivest   it   e(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   listdir_win32t  s"    %O"	c         C€  s�   t  |  t ƒ r' t |  j d ƒ ƒ }  n  t  |  t ƒ rŒ d } xI t d ƒ D]; } | t |  ƒ k  rI | d d | t |  | ƒ 7} qI qI W| S|  S(   s  
	Converts a string, tuple or version number into an integer. The number is supposed to have at most 4 digits::

		from waflib.Utils import num2ver
		num2ver('1.3.2') == num2ver((1,3,2)) == num2ver((1,3,2,0))

	:type ver: string or tuple of numbers
	:param ver: a version number
	t   .i    i   i   i   (   Rh   Ri   t   tuplet   splitRw   R3   Rx   (   t   verRk   R…   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   num2ver–  s    
'c         C€  s!   t  |  t ƒ r |  j ƒ  S|  Sd S(   s  
	Converts a string argument to a list by splitting it by spaces.
	Returns the object if not a string::

		from waflib.Utils import to_list
		lst = to_list('a b c d')

	:param val: list of string or space-separated string
	:rtype: list
	:return: Argument converted to list
	N(   Rh   Ri   RŠ   (   R*   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   to_listª  s    
c          C€  sv   y d d  l  }  Wn t k
 r# n9 Xy |  j j j ƒ  } Wn t k
 rM n X| r\ d | St j j pu t	 rr d Sd S(   Niÿÿÿÿs   cp%dt   cp1252s   latin-1(
   Rp   Rq   Rs   Rt   t   GetConsoleCPR9   R?   t   stdoutRF   t   is_win32(   Rp   t   codepage(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   console_encoding»  s    c         C€  s   |  j  d ƒ S(   NR   (   RŠ   (   R{   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   split_path_unixÊ  s    c         C€  sE   |  j  d ƒ r8 |  j d ƒ d } d | d | d <| S|  j d ƒ S(   Ns   //R   i   i    (   t
   startswithRŠ   (   R{   Rk   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   split_path_cygwinÍ  s
    s   [/\\]+c         C€  s]   |  j  d ƒ rP t j |  ƒ d } d | d | d <| d d k rL | d S| St j |  ƒ S(   Ns   \\i   i    s   \\?(   R•   t   re_spRŠ   (   R{   Rk   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   split_path_win32Õ  s    c         C€  s‹   |  j  d ƒ r� |  j  d	 ƒ r� t sa t j d d d g ƒ j t j j pL d ƒ a t j ƒ  a n  t	 j
 j t t	 j |  ƒ }  n  t |  ƒ S(
   NR   s   \s   //s   \\t   cygpaths   -ws   latin-1(   R   s   \(   s   //s   \\(   R•   t   msysroott
   subprocesst   check_outputRC   R?   R�   RF   t   stripRT   R{   t   normpathRz   R˜   (   R{   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   split_path_msysß  s    - t   cygwint   MSYSTEMsŸ   
Splits a path by / or \; do not confuse this function with with ``os.path.split``

:type  path: string
:param path: path to split
:return:     list of string
c         C€  sn   t  j j |  ƒ sj y t  j |  ƒ Wqj t k
 rf } t  j j |  ƒ sg t j d |  d | ƒ‚ qg qj Xn  d S(   sÀ   
	Ensures that a directory exists (similar to ``mkdir -p``).

	:type  path: string
	:param path: Path to directory
	:raises: :py:class:`waflib.Errors.WafError` if the folder cannot be added.
	s   Cannot create the folder %rt   exN(   RT   R{   R|   t   makedirsRY   R   t   WafError(   R{   R†   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt	   check_dirþ  s    c         C€  sÌ   |  s t  d ƒ ‚ n  d „  } t j j |  ƒ \ } } | rX | |  ƒ rX t j j |  ƒ S| pd t j } x^ | d j t j ƒ D]F } | j d ƒ } t j j | |  ƒ } | | ƒ r~ t j j | ƒ Sq~ Wd S(   s  
	Ensures that a program exists

	:type name: string
	:param name: path to the program
	:param env: configuration object
	:type env: :py:class:`waflib.ConfigSet.ConfigSet`
	:return: path of the program or None
	:raises: :py:class:`waflib.Errors.WafError` if the folder cannot be added.
	s   Cannot execute an empty string!c         S€  s%   t  j j |  ƒ o$ t  j |  t  j ƒ S(   N(   RT   R{   t   isfilet   accesst   X_OK(   t   fpath(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   is_exe  s    t   PATHt   "N(
   R$   RT   R{   RŠ   t   abspatht   environt   pathsepR�   t   joinR+   (   t   namet   envRª   R©   RD   R{   t   exe_file(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt	   check_exe  s    	c         K€  sC   x< | j  ƒ  D]. \ } } t |  | ƒ s t |  | | ƒ q q Wd S(   sÃ   
	Sets default attributes on a class instance

	:type cls: class
	:param cls: the class to update the given attributes in.
	:type kw: dict
	:param kw: dictionary of attributes names and values.
	N(   t   itemst   hasattrt   setattr(   t   clsR   R   t   v(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt	   def_attrs)  s    	c         C€  s:   t  j d d |  ƒ } t  j d d | ƒ } | j ƒ  } | S(   s¬   
	Converts a string into an identifier suitable for C defines.

	:type  s: string
	:param s: String to convert
	:rtype: string
	:return: Identifier suitable for C defines
	s   [^a-zA-Z0-9]t   _s   _+(   t   ret   subt   upper(   Rj   t   fu(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   quote_define_name6  s    	s   \s|'|"c         C€  s*   t  |  t ƒ r |  Sd j d „  |  Dƒ ƒ S(   sF   
	Escapes a command:
	['ls', '-l', 'arg space'] -> ls -l 'arg space'
	t    c         s€  s0   |  ]& } t  j | ƒ r$ t | ƒ n | Vq d  S(   N(   t   re_sht   searcht   repr(   t   .0R€   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pys	   <genexpr>P  s    (   Rh   Ri   R°   (   t   cmd(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   shell_escapeI  s    c         C€  s   t  t |  ƒ j ƒ  ƒ j ƒ  S(   sÚ   
	Hashes lists of ordered data.

	Using hash(tup) for tuples would be much more efficient,
	but Python now enforces hash randomization

	:param lst: list to hash
	:type lst: list of strings
	:return: hash of the list
	(   R   RÄ   RK   RQ   (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   h_listR  s    i   c         C€  s   t  t |  ƒ ƒ j ƒ  S(   N(   R   RÄ   RQ   (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   h_list_python2`  s    c         C€  sÛ   y |  j  SWnÉ t k
 rÖ t |  t j ƒ r„ t |  j ƒ } | j t |  j	 j
 ƒ  ƒ ƒ | j t |  j ƒ ƒ t | ƒ |  _  |  j  Sy t j |  ƒ } Wn t k
 r° d } n Xy | |  _  Wn t k
 rÑ n X| SXd S(   s   
	Hash functions

	:param fun: function to hash
	:type  fun: function
	:return: hash of the function
	:rtype: string or bytes
	t   nocodeN(   t   codeR9   Rh   t	   functoolst   partialt   listt   argst   extendt   sortedt   keywordsRµ   R    t   h_funt   funcRÈ   t   inspectt	   getsourcet   EnvironmentError(   R6   RË   t   h(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyRÓ   e  s$    	
c         C€  s˜   t  |  t ƒ r |  } nX t  |  t ƒ s6 t  |  t ƒ r^ t g  |  D] } t | ƒ ^ q@ ƒ } n t t |  ƒ ƒ } t j d k r” | j d d ƒ } n  | S(   s‚   
	Hashes objects recursively

	:param ins: input object
	:type ins: string or list or tuple or function
	:rtype: string or bytes
	i   s   latin-1t   xmlcharrefreplace(	   Rh   Ri   RÎ   R‰   t   h_cmdRÓ   R?   R@   RK   (   t   insRk   R€   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyRÚ   ‡  s    		(s   (\\\\)|(\$\$)|\$\{([^}]+)\}c         €  s   ‡  f d †  } t  j | |  ƒ S(   s!  
	Replaces ${VAR} with the value of VAR taken from a dict or a config set::

		from waflib import Utils
		s = Utils.subst_vars('${PREFIX}/bin', env)

	:type  expr: string
	:param expr: String to perform substitution on
	:param params: Dictionary or config set to look up variable values.
	c         €  sf   |  j  d ƒ r d S|  j  d ƒ r& d Sy ˆ  j |  j  d ƒ ƒ SWn t k
 ra ˆ  |  j  d ƒ SXd  S(   Ni   s   \i   t   $i   (   t   groupt   get_flatR9   (   RE   (   R7   (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   repl_var©  s    (   t	   reg_substR½   (   t   exprR7   Rß   (    (   R7   s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt
   subst_varsž  s    c         C€  s$   |  d k r d S|  d	 k r  d Sd S(
   sÓ   
	Returns the binary format based on the unversioned platform name,
	and defaults to ``elf`` if nothing is found.

	:param key: platform name
	:type  key: string
	:return: string representing the binary format
	t   darwins   mac-oR;   R    t   uwint   msyst   pet   elf(   R;   R    Rä   Rå   (    (   R!   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   destos_to_binfmt·  s
    	c          C€  sø   t  j }  |  j d ƒ r™ d d l m } | j d ƒ }  |  d k rG d S|  j d ƒ rZ d S|  d	 k rj d
 S|  d k rz d S|  d k rŠ d S|  j ƒ  }  n  |  d k r© d S|  d k sÁ |  d
 k rÅ |  S|  d k rä t j d k rä d St	 j
 d |  ƒ d S(   s?  
	Returns the unversioned platform name.
	Some Python platform names contain versions, that depend on
	the build environment, e.g. linux2, freebsd6, etc.
	This returns the name without the version number. Exceptions are
	os2 and win32, which are returned verbatim.

	:rtype: string
	:return: Unversioned platform name
	t   javaiÿÿÿÿ(   t   Systems   os.names   Mac OS XRã   s   Windows R;   s   OS/2t   os2s   HP-UXs   hp-uxt   SunOSt   Solarist   sunost   powerpct   cliR<   s   \d+$i    (   Rì   Rí   (   R?   t   platformR•   t	   java.langRê   t   getPropertyt   lowerRT   R±   R¼   RŠ   (   Rj   Rê   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   unversioned_sys_platformÆ  s,    	c          O€  s   d S(   s    
	Does nothing

	:return: None
	N(    (   R   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   nadaí  s    t   Timerc           B€  sD   e  Z d  Z d „  Z d „  Z d „  Z e e d ƒ rB d „  Z n  RS(   s¾   
	Simple object for timing the execution of commands.
	Its string representation is the duration::

		from waflib.Utils import Timer
		timer = Timer()
		a_few_operations()
		s = str(timer)
	c         C€  s   |  j  ƒ  |  _ d  S(   N(   t   nowt
   start_time(   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR   ÿ  s    c         C€  sì   |  j  ƒ  |  j } t | t j ƒ s: t j d | ƒ } n  | j } t | j d ƒ \ } } t | d ƒ \ } } | | j d 7} d } | rž | d | 7} n  | sª | r» | d | 7} n  | sÍ | sÍ | rÞ | d | 7} n  d	 | | f S(
   Nt   secondsi  i<   g�íµ ÷Æ°>Rd   s   %dds   %dhs   %dms   %s%.3fs(	   Rø   Rù   Rh   t   datetimet	   timedeltat   dayst   divmodRú   t   microseconds(   R   t   deltaRý   t   hourst   remt   minutesRú   t   result(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   __str__  s    	c         C€  s   t  j  j ƒ  S(   N(   Rû   t   utcnow(   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyRø     s    t   perf_counterc         C€  s
   t  j ƒ  S(   N(   t   timeR  (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyRø     s    (   R   R   R   R   R  Rø   R¶   R  (    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR÷   õ  s   				c         C€  sy   t  j d ƒ } i  } x] t |  ƒ j ƒ  D]I } y/ | j | j ƒ  ƒ \ } } } } | | | <Wq( t k
 rp q( Xq( W| S(   sY   
	Reads property files, used by msvc.py

	:param path: file to read
	:type path: string
	s   ^([^=]+)=\'(.*)\'$(   R¼   t   compileRI   t
   splitlinesRŠ   R�   R$   (   R{   t   spt   dct   lineR»   t   leftt   right(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   read_la_file  s    !c         €  s1   i  ‰  ‡  ‡ f d †  } ˆ  | _  ˆ j | _ | S(   s:  
	Decorator: let a function cache its results, use like this::

		@run_once
		def foo(k):
			return 345*2343

	.. note:: in practice this can cause memory leaks, prefer a :py:class:`waflib.Utils.lru_cache`

	:param fun: function to execute
	:type fun: function
	:return: the return value of the function executed
	c          €  s;   y ˆ  |  SWn( t  k
 r6 ˆ |  Œ  } | ˆ  |  <| SXd  S(   N(   R4   (   R   Rk   (   t   cacheR6   (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   wrap:  s    
(   t	   __cache__R   (   R6   R  (    (   R  R6   s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   run_once+  s
    	c         C€  sV   t  s
 d Sy t  j |  d | d ƒ } Wn t k
 r; n Xt j j | ƒ rR | Sd S(   sm   
	Returns the value of a registry key for an executable

	:type key: string
	:type filename: list of string
	s:   Software\Microsoft\Windows\CurrentVersion\App Paths\%s.exei    N(   t   winregR+   t
   QueryValueRY   RT   R{   R¦   (   R!   t   filenameR  (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   get_registry_app_pathE  s    c           C€  sX   t  j d k rT t j ƒ  d d k rT t  j j d ƒ rQ t  j j d ƒ rQ d SqT n  d S(   sj   
	Guess the default ``/usr/lib`` extension for 64-bit applications

	:return: '64' or ''
	:rtype: string
	R   i    t   64bits
   /usr/lib64s
   /usr/lib32t   64Rd   (   RT   Rz   Rñ   t   architectureR{   t   exists(    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   lib64V  s
    %
c         C€  s   t  j j t  j j |  ƒ ƒ S(   N(   RT   R{   R­   t
   expanduser(   t   p(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt	   sane_pathd  s    c       
   C€  s�   y t  j ƒ  SWn{ t k
 r‹ t j j t j j t ƒ ƒ t j d }  t	 j
 d t |  ƒ g } t j | d t j d t j d d d t ƒSXd S(	   sb   
	Returns a process object that can execute commands as sub-processes

	:rtype: subprocess.Popen
	s   processor.pys   -cR�   t   stdint   bufsizei    t	   close_fdsN(   t   process_poolt   popt
   IndexErrorRT   R{   t   dirnameR­   t   __file__Rz   R?   t
   executableRI   R›   t   Popent   PIPER‘   (   t   filepathRÆ   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   get_processm  s    )c         C€  sÏ  d | k r" t  t j ƒ | d <n  y% t j t j |  | | g ƒ ƒ } Wn$ t t f k
 rm t	 |  | | ƒ SXt
 ƒ  } | s� t	 |  | | ƒ S| j j | ƒ | j j d j ƒ  ƒ | j j ƒ  | j j ƒ  } | së t d | j ƒ ‚ n  t j | ƒ t j t j | ƒ ƒ } t | ƒ d k s(t ‚ | \ } } } }	 }
 |	 rÂ|	 d k r^t |
 ƒ ‚ qÂ|	 d k ryt |
 ƒ ‚ qÂ|	 d k r³t |  d | d d	 | ƒ} | | _ | ‚ qÂt |
 ƒ ‚ n  | | | f S(
   sA   
	Delegates process execution to a pre-forked process instance.
	R²   s   
s   Preforked sub-process %r diedi   RY   R$   R   t   timeoutt   output(   R   RT   R®   t   base64t	   b64encodet   cPicklet   dumpst	   TypeErrorR9   t   run_regular_processR-  R!  RL   RK   t   flushR�   t   readlineRY   t   pidR$  R    t   loadst	   b64decodeR3   t   AssertionErrorR$   R   t   stderrt	   Exception(   RÆ   t   kwargst   cargst   objt   procR   Rk   t   outt   errR¢   t   tracet   exc(    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   run_prefork_processz  s<    %			c         C€  s³   t  | t ƒ rP d d l } | j | ƒ } | sC t d | ƒ ‚ n  | d } n  t  | t ƒ r  d d l } | j | ƒ } | s“ t d | ƒ ‚ n  | d } n  t j |  | | ƒ S(   sÅ   
	Change the owner/group of a path, raises an OSError if the
	ownership change fails.

	:param user: user to change
	:type user: int or str
	:param group: group to change
	:type group: int or str
	iÿÿÿÿNs   Unknown user %ri   s   Unknown group %r(	   Rh   Ri   t   pwdt   getpwnamRY   t   grpt   getgrnamRT   t   lchown(   R{   t   userRÝ   RG  t   entryRI  (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyRK  ¢  s    
c   	      C€  s}  t  j |  | � } | j d ƒ s0 | j d ƒ rê y | j | �  \ } } Wn’ t k
 rÝ | j d ƒ r� t t d ƒ r� t j | j t	 j
 ƒ n
 | j ƒ  | j ƒ  \ } } t | j d | d d | ƒ} | | _ | ‚ n X| j } n† d \ } } y | j | �  } Wnd t k
 ro} | j d ƒ rRt t d ƒ rRt j | j t	 j
 ƒ n
 | j ƒ  | j ƒ  | ‚ n X| | | f S(	   s;   
	Executes a subprocess command by using subprocess.Popen
	R�   R<  t   start_new_sessiont   killpgR.  R/  N(   NN(   R›   R*  t   gett   communicateR   R¶   RT   RO  R8  t   signalt   SIGKILLt   killRÏ   R<  t
   returncodeR+   t   wait(	   RÆ   R>  R?  RA  RB  RC  RE  t   statusR†   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyR5  º  s.    
	



c         C€  sB   | j  d ƒ r. | j  d ƒ r. t |  | | ƒ St |  | | ƒ Sd S(   sÌ   
	Executes a subprocess by using a pre-forked process when possible
	or falling back to subprocess.Popen. See :py:func:`waflib.Utils.run_prefork_process`
	and :py:func:`waflib.Utils.run_regular_process`
	R�   R<  N(   RP  RF  R5  (   RÆ   R>  R?  (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   run_processÙ  s    c         C€  sŽ   | s" t  |  t t ƒ d ƒ }  n  y& g  t |  ƒ D] } t ƒ  ^ q2 } Wn! t k
 rk t a t a a	 n Xx | D] } t j
 | ƒ qs Wd S(   sL  
	Allocates an amount of processes to the default pool so its size is at least *n*.
	It is useful to call this function early so that the pre-forked
	processes use as little memory as possible.

	:param n: pool size
	:type n: integer
	:param force: if True then *n* more processes are added to the existing pool
	:type force: bool
	i    N(   t   maxR3   R$  Rw   R-  RY   R5  RX  Rö   t   alloc_process_poolR    (   t   nt   forceR€   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyRZ  ä  s    &c          C€  sJ   xC t  D]; }  y t j |  j d ƒ Wn t k
 r7 q X|  j ƒ  q Wd  S(   Ni	   (   R$  RT   RT  R8  RY   RV  (   R   (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   atexit_poolü  s    i i t   WAF_NO_PREFORKRð   (v   R   t
   __future__R    t   atexitRT   R?   R}   RÕ   R¼   Rû   Rñ   R0  RR  RÌ   R  R2  Rq   t   pickleR±   t   version_infot   subprocess32R›   R   R9   R=  t   collectionsR   R   t   _winregR  R+   t   waflibR   t   hashlibR   R	   RQ   R$   R   R®   t   objectR   t   ThreadRK   t   SIG_NILt   O644t   O755t   rot_chrt   rot_idxR   R   R'   R-   R5   Rz   R‘   RI   RN   RR   R^   Rb   Rc   t
   readf_unixt   writef_unixt   h_file_unixR¶   R@   R€   t   LookupErrorRf   Rl   R‡   R   RŒ   R�   R“   R”   R–   R	  R—   R˜   Rš   RŸ   t
   split_pathRP  R)  R•   R¥   R´   Rº   RÀ   RÂ   RÇ   RÈ   RÉ   RÓ   RÚ   Rà   Râ   Rè   Rõ   Rö   R÷   R  R  R  R  R   R$  R-  RF  RK  R5  RX  t   FalseRZ  R]  t   register(    (    (    s/   /git_repos/PolyLV2/poly_mclk_in/waflib/Utils.pyt   <module>
   s  �"<- 																	$												"				'	%							(		%+