Ñò
 „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 l	 Z	 l
 Z
 l Z l Z y d d k l Z Wn# e j
 o d d k l Z n Xe i Z d Z d Z d Z e Z d	 Z d
 „  Z e e d „ Z d e
 i
 f d „  ƒ  YZ d „  Z e e d „ ƒ Z e d „  ƒ Z e d d d „ ƒ Z e g  d „ ƒ Z e d „  ƒ Z  e g  e e d d „ ƒ Z! d S(   s$  
Configuration system

A :py:class:`waflib.Configure.ConfigurationContext` instance is created when ``waf configure`` is called, it is used to:

* create data dictionaries (ConfigSet instances)
* store the list of modules to import
* hold configuration routines such as ``find_program``, etc
iÿÿÿÿN(   t	   ConfigSett   Utilst   Optionst   Logst   Contextt   Buildt   Errors(   t   request(   t   urlopent   breakt   continues
   config.logs}   # project %(app)s configured on %(now)s by
# waf %(wafver)s (abi %(abi)s, python %(pyver)x on %(systype)s)
# using %(args)s
#c         C   s   d S(   s^   
	Hook to check for the tools which are downloaded. Replace with your function if necessary.
	N(    (   t   node(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   download_check*   s    c   	      C   s™  xƒt  i t i ƒ D]o} xft  i t i ƒ D]R} d i | | |  d f ƒ } yD t | ƒ } y | i ƒ  d j o w, n Wn t j
 o n XWn t	 j
 o
 q, q, X| i
 i t i i t i d d |  d f ƒ ƒ } | i | i ƒ  d ƒ t i d |  | f ƒ t | ƒ y t i |  ƒ } WnQ t	 j
 oE t i d |  | f ƒ y | i ƒ  Wq, t	 j
 o q, Xq, n X| Sq, Wq Wt i d	 ƒ ‚ d
 S(   s„   
	Download a Waf tool from the remote repository defined in :py:const:`waflib.Context.remote_repo`::

		$ waf configure --download
	t   /s   .pyiÈ   t   waflibt   extrast   wbs   Downloaded %s from %ss   The tool %s from %s is unusables   Could not load the Waf toolN(   R   t   to_listR   t   remote_repot   remote_locst   joinR   t   getcodet   AttributeErrort	   Exceptiont   roott	   make_nodet   ost   sept   waf_dirt   writet   readR   t   warnR   t	   load_toolt   deleteR   t   WafError(	   t   toolt   forcet   ctxt   xt   subt   urlt   webt   tmpt   module(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   download_tool0   s:      	1
t   ConfigurationContextc           B   s¡   e  Z d  Z d Z g  Z d „  Z d d „ Z d „  Z d „  Z	 e
 e e	 ƒ Z d „  Z d „  Z d „  Z d	 „  Z d d e d
 „ Z d „  Z d „  Z d „  Z RS(   s   configures the projectt	   configurec         K   sx   t  t |  ƒ i |   t t i ƒ |  _ h  |  _ d  |  _ d  |  _	 g  |  _
 d |  _ g  |  _ g  |  _ |  i d ƒ d  S(   Ni    t    (   t   superR-   t   __init__t   dictR   t   environt   all_envst   Nonet   top_dirt   out_dirt   toolst   hasht   filest
   tool_cachet   setenv(   t   selft   kw(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyR1   _   s    							c         C   se   | |  i  j p | oA | p t i ƒ  } |  i | ƒ n | i ƒ  } | |  i  | <n | |  _ d S(   s–  
		Set a new config set for conf.env. If a config set of that name already exists,
		recall it without modification.

		The name is the filename prefix to save to ``c4che/NAME_cache.py``, and it
		is also used as *variants* by the build commands.
		Though related to variants, whatever kind of data may be stored in the config set::

			def configure(cfg):
				cfg.env.ONE = 1
				cfg.setenv('foo')
				cfg.env.ONE = 2

			def build(bld):
				2 == bld.env_of_name('foo').ONE

		:param name: name of the configuration set
		:type name: string
		:param env: ConfigSet to copy, or an empty ConfigSet is created
		:type env: :py:class:`waflib.ConfigSet.ConfigSet`
		N(   R4   R    t   prepare_envt   derivet   variant(   R=   t   namet   env(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyR<   p   s    c         C   s   |  i  |  i S(   s   Getter for the env property(   R4   RA   (   R=   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   get_env   s    c         C   s   | |  i  |  i <d S(   s   Setter for the env propertyN(   R4   RA   (   R=   t   val(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   set_env’   s    c         C   s¥  |  i  } | p t i i } n | p t t i t i d ƒ } n | p |  i	 i
 ƒ  } n t i	 i
 | ƒ } t i	 i | ƒ o
 |  i p |  i	 i | ƒ |  _ |  i p t ‚ |  i } | p t i i } n | p t t i t i d ƒ } n | p, t i i d t i d ƒ i d d ƒ } n t i	 i | ƒ o
 |  i p |  i	 i | ƒ |  _ |  i i ƒ  t i	 i |  i i
 ƒ  ƒ p t i d |  i i
 ƒ  ƒ n d S(   s>   
		Initialize the project directory and the build directory
		s   .lock-waf_%s_R/   s	   .lock-wafs'   could not create the build directory %sN(   R6   R   t   optionst   topt   getattrR   t   g_modulet   TOPR5   t   patht   abspathR   t   isabsR   t   find_dirt   srcnodet   AssertionErrorR7   t   outt   OUTt   lockfilet   replacet   syst   platformR   t   bldnodet   mkdirt   isdirt   conft   fatal(   R=   RH   RR   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt	   init_dirs˜   s*    	2	,2c         C   s   |  i  ƒ  |  i i t i ƒ |  _ |  i i ƒ  t i i	 |  i i
 ƒ  t ƒ } t i | d ƒ |  _ t t i d d ƒ } | o4 t t i d d ƒ } | o d | | f } q² n t i ƒ  } t i } t i } d i	 t i ƒ } t i } t i }	 |  i t t ƒ  ƒ |  i d |  i i
 ƒ  ƒ |  i d |  i i
 ƒ  ƒ t |  i ƒ t |  i ƒ j o t i  d	 ƒ nK t |  i ƒ t |  i ƒ j o+ |  i i! |  i ƒ o t i  d
 ƒ q´n t" t# |  ƒ i$ ƒ  |  i% ƒ  |  i i
 ƒ  t _& |  i i
 ƒ  t _' t( i( ƒ  }
 t i |
 d <t) i* i+ |
 d <t i, |
 _, t i& |
 _& t i' |
 _' |  i- |
 d <|  i. |
 d <t/ |  i0 ƒ |
 d <|  i1 i2 p" |
 i% t i, t i3 t) i4 ƒ n |  i1 i5 p" |
 i% t i& t i3 t) i4 ƒ n |  i1 i6 p" |
 i% t i' t i3 t) i4 ƒ n d S(   s3   
		See :py:func:`waflib.Context.Context.execute`
		t   cfgt   APPNAMER/   t   VERSIONs   %s (%s)t    s   Setting top tos   Setting out tos5   Setting top == out (remember to use "update_outputs")s5   Are you certain that you do not want to set top="." ?t   argvRG   R9   R:   R3   N(7   R]   RX   R   R   t	   CACHE_DIRt   cachedirRY   R   RL   R   RM   t   WAF_CONFIG_LOGR   t   make_loggert   loggerRI   R   RJ   t   timet   ctimeRV   t
   hexversionRW   Rb   t
   WAFVERSIONt   ABIt   to_logt   conf_templatet   varst   msgRP   t   idR   t   is_child_ofR0   R-   t   executet   storeR6   R7   R    R   RG   t   __dict__t   run_dirR9   R:   R2   R3   RC   t   NO_LOCK_IN_RUNR   RT   t   NO_LOCK_IN_TOPt   NO_LOCK_IN_OUT(   R=   RL   t   appt   vert   nowt   pyvert   systypet   argst   wafvert   abiRC   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyRs   ·   sV    
				
""c         C   s   | i  p+ t i i t i i t i i ƒ ƒ | _  n | i p t	 i
 d | ƒ | _ n | i p t	 i
 d | ƒ | _ n d S(   s¥   
		Insert *PREFIX*, *BINDIR* and *LIBDIR* values into ``env``

		:type env: :py:class:`waflib.ConfigSet.ConfigSet`
		:param env: a ConfigSet, usually ``conf.env``
		s   ${PREFIX}/bins   ${PREFIX}/libN(   t   PREFIXR   RL   RM   t
   expanduserR   RG   t   prefixt   BINDIRR   t
   subst_varst   LIBDIR(   R=   RC   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyR?   ù   s    
+

c         C   s›   |  i  i d ƒ } | i d t i |  i f ƒ |  i p |  i d ƒ n xJ |  i D]? } |  i | } | i t	 i
 i |  i  i ƒ  | t i ƒ ƒ qT Wd S(   s+   Save the config results into the cache files   build.config.pys   version = 0x%x
tools = %r
s.   nothing to store in the configuration context!N(   Rd   R   R   R   t
   HEXVERSIONR8   R4   R\   Rt   R   RL   R   RM   R   t   CACHE_SUFFIX(   R=   t   nt   keyt   tmpenv(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyRt     s    

 c         C   s  t  i | ƒ } | o t  i | ƒ } n xÕ| D]Í} | t |  i ƒ | f } | |  i j o |  i d | ƒ q0 n |  i i | ƒ d
 } y t i	 | | ƒ } WnÁ t
 j
 oq }	 t i i o> t | d |  ƒ} | p! |  i d | t i |	 f ƒ qqf|  i d | t i |	 f ƒ nF t j
 o9 }	 |  i d | | | f ƒ |  i t  i ƒ  ƒ ‚  n X| d
 j	 o |  i | ƒ nU t | d d
 ƒ }
 |
 o; t |
 ƒ t t  i ƒ j o |
 |  ƒ qØ|  i |
 ƒ n |  i i h | d 6| d 6| d	 6ƒ q0 Wd
 S(   s‡  
		Load Waf tools, which will be imported whenever a build is started.

		:param input: waf tools to import
		:type input: list of string
		:param tooldir: paths for the imports
		:type tooldir: list of string
		:param funs: functions to execute from the waf tools
		:type funs: list of string
		:param download: whether to download the tool from the waf repository
		:type download: bool
		s%   (tool %s is already loaded, skipping)R%   sf   Could not load the Waf tool %r or download a suitable replacement from the repository (sys.path %r)
%ssG   Could not load the Waf tool %r from %r (try the --download option?):
%ss   imp %r (%r & %r)R.   R#   t   tooldirt   funsN(   R   R   Rq   RC   R;   Rm   t   appendR5   R   R    t   ImportErrorR   RG   t   downloadR,   R\   RV   RL   R   t   ex_stackt
   eval_rulesRI   t   typet   readfR8   (   R=   t   inputR   RŽ   R‘   R8   R#   t   magR+   t   et   func(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   load  s>      %! c         C   sQ   t  t |  ƒ i | ƒ t |  i | i d ƒ f ƒ |  _ |  i i | i ƒ  ƒ d S(   s®   
		Records the path and a hash of the scripts visited, see :py:meth:`waflib.Context.Context.post_recurse`

		:param node: script
		:type node: :py:class:`waflib.Node.Node`
		t   rbN(   R0   R-   t   post_recurseR9   R   R:   R   RM   (   R=   R   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyRœ   F  s    !c         C   s³   t  i | ƒ |  _ xš |  i D] } t |  | ƒ } | p |  i d | ƒ n y | ƒ  Wq t j
 oD } |  i | | ƒ } | t j o Pq« | t j o q q« ‚  q Xq Wd S(   sí   
		Execute the configuration tests. The method :py:meth:`waflib.Configure.ConfigurationContext.err_handler`
		is used to process the eventual exceptions

		:param rules: list of configuration method names
		:type rules: list of string
		s   No such method '%s'.N(	   R   R   t   rulesRI   R\   R   t   err_handlert   BREAKt   CONTINUE(   R=   R   R&   t   fR˜   t   ret(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyR“   Q  s    
  c         C   s   d S(   sÃ   
		Error handler for the configuration tests, the default is to let the exception raise

		:param fun: configuration test
		:type fun: method
		:param error: exception
		:type error: exception
		N(    (   R=   t   funt   error(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyRž   h  s    	N(   t   __name__t
   __module__t   __doc__t   cmdt   error_handlersR1   R5   R<   RD   RF   t   propertyRC   R]   Rs   R?   Rt   t   TrueRš   Rœ   R“   Rž   (    (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyR-   U   s    					B		3		c            s<   ‡  f d †  } t  t ˆ  i | ƒ t  t i ˆ  i | ƒ ˆ  S(   sh  
	Decorator: attach new configuration functions to :py:class:`waflib.Build.BuildContext` and
	:py:class:`waflib.Configure.ConfigurationContext`. The methods bound will accept a parameter
	named 'mandatory' to disable the configuration errors::

		def configure(conf):
			conf.find_program('abc', mandatory=False)

	:param f: method to bind
	:type f: function
	c             sd   t  } d | j o | d } | d =n y ˆ  |  | Ž  SWn$ t i j
 o | o ‚  q` n Xd  S(   Nt	   mandatory(   R«   R   t   ConfigurationError(   t   kR>   R¬   (   R¡   (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyR£     s    
(   t   setattrR-   R¥   R   t   BuildContext(   R¡   R£   (    (   R¡   s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyR[   s  s    c         C   sH   y. |  i  i | p | t i |  i | ƒ ƒ Wn t j
 o n Xd S(   s  
	Import operating system environment values into ``conf.env`` dict::

		def configure(conf):
			conf.add_os_flags('CFLAGS')

	:param var: variable to use
	:type var: string
	:param dest: destination variable, by default the same as var
	:type dest: string
	N(   RC   t   append_valuet   shlext   splitR3   t   KeyError(   R=   t   vart   dest(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   add_os_flags  s     . c         C   s`   t  | t ƒ oL | i d ƒ o< y t i | ƒ Wn t j
 o t i | ƒ SX| g Sn | S(   s˜   
	Detect if a command is written in pseudo shell like ``ccache g++`` and return a list.

	:param cmd: command
	:type cmd: a string or a list of string
	Ra   (   t
   isinstancet   strt   findR   t   statt   OSErrorR²   R³   (   R=   R¨   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   cmd_to_list   s     s   1.6.99s   1.8.0c         C   s±   |  i  d t | ƒ t | ƒ f ƒ t i } t i | ƒ | j o$ |  i d t i | ƒ | f ƒ n t i | ƒ | j  o$ |  i d t i | ƒ | f ƒ n |  i d ƒ d S(   s-  
	Raise a Configuration error if the Waf version does not strictly match the given bounds::

		conf.check_waf_version(mini='1.7.0', maxi='1.8.0')

	:type  mini: number, tuple or string
	:param mini: Minimum required version
	:type  maxi: number, tuple or string
	:param maxi: Maximum allowed version
	s!   Checking for waf version in %s-%ss,   waf version should be at least %r (%r found)s+   waf version should be at most %r (%r found)t   okN(   t	   start_msgR¹   R   Rˆ   R   t   num2verR\   t   end_msg(   R=   t   minit   maxiR{   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   check_waf_version±  s    #	$$c         C   sv   x^ t  i | ƒ D]M } xD t  i | ƒ D]3 } t i i | | ƒ } t i i | ƒ o | Sq& Wq W|  i d | ƒ d S(   sÒ   
	Find a file in a list of paths

	:param filename: name of the file to search for
	:param path_list: list of directories to search
	:return: the first occurrence filename or '' if filename could not be found
	s   Could not find %rN(   R   R   R   RL   R   t   existsR\   (   R=   t   filenamet	   path_listRŠ   t   dt   p(    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt	   find_fileÆ  s    	  c         K   s¹  | i  d t i o d p d ƒ } | i  d t i ƒ } d } t i | ƒ } | i  d d ƒ } | p | d i ƒ  } n |  i | o |  i | } n | | j o | | } n | i  d d ƒ } | pû | o t i | ƒ } n | i  d	 d ƒ i t i	 ƒ } t
 | t ƒ p | g } n x£ | i d
 ƒ D]Ž } | o Pn xy | D]q }	 | o Pn x\ | D]T }
 | o Pn t i i t i i |
 |	 | ƒ ƒ } t i i | ƒ o
 | } qdqdWqKWq2Wn | o& t i o t i t i i | ƒ } n | o& t i o t i t i i | ƒ } n |  i d d
 i | ƒ | p t ƒ |  i d | | | | f ƒ | p1 |  i | i  d d ƒ p d d
 i | ƒ ƒ n | o | |  i | <n | S(   sì  
	Search for a program on the operating system

	When var is used, you may set os.environ[var] to help find a specific program version, for example::

		$ VALAC=/usr/bin/valac_test waf configure

	:param path_list: paths to use for searching
	:type param_list: list of string
	:param var: store the result to conf.env[var], by default use filename.upper()
	:type var: string
	:param ext: list of extensions for the binary (do not add an extension for portability)
	:type ext: list of string
	t   extss   .exe,.com,.bat,.cmds   ,.sh,.pl,.pyR3   R/   Rµ   i    RÇ   t   PATHt   ,s   Checking for program s%   find program=%r paths=%r var=%r -> %rt   errmsgs   Could not find the program %s(   t   getR   t   is_win32R   R3   R   t   upperRC   R³   t   pathsepR¸   t   listRL   Rƒ   R   t   isfilet   winregt   get_registry_app_patht   HKEY_CURRENT_USERt   HKEY_LOCAL_MACHINERp   t   FalseRm   R\   (   R=   RÆ   R>   RË   R3   R¢   Rµ   RÇ   t   at   bt   cR&   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   find_programÖ  sX    #   %$1R/   c         C   sÎ   y+ |  i  | d | d | d | d | ƒ} Wnˆ t j
 o| |  i  d d d ƒ|  i | t i d i t i ƒ ƒ } | p ‚  n | o( t i |  i	 d ƒ | g |  i	 | <q¶ n X|  i
 d | | ƒ d	 S(
   sÜ  
	Search for a perl program on the operating system

	:param filename: file to search for
	:type filename: string
	:param path_list: list of paths to look into
	:type path_list: list of string
	:param var: store the results into *conf.env.var*
	:type var: string
	:param environ: operating system environment to pass to :py:func:`waflib.Configure.find_program`
	:type environ: dict
	:param exts: extensions given to :py:func:`waflib.Configure.find_program`
	:type exts: list
	RÇ   Rµ   R3   RË   t   perlt   PERLRÌ   s   Checking for %rN(   RÝ   R   RÊ   R   R3   R³   RÒ   R   R   RC   Rp   (   R=   RÆ   RÇ   Rµ   R3   RË   Rz   (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   find_perl_program  s    +%-("   R§   R   R²   RV   Rh   R   R    R   R   R   R   R   R   t   urllibR   R   R   RŸ   R    Re   RÙ   t
   autoconfigRn   R   R5   R,   R-   R[   R·   R½   RÄ   RÊ   RÝ   Rà   (    (    (    s=   /home/data/ftp/pub/unpacked/waf.tmpconfig/waflib/Configure.pyt   <module>   s6   04		%ÿ 	H