ó
{›í]c           @   s
  d  Z  d d l Z d d l Z d d l m Z m Z m Z m Z m Z m	 Z	 d d l
 m Z m Z m Z m Z d d l m Z d Z d Z d g Z e d	 ƒ e d
 ƒ d „  ƒ ƒ Z e d ƒ d „  ƒ Z d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ e d ƒ e d d ƒ e d ƒ d „  ƒ ƒ ƒ Z e d ƒ e d d ƒ d „  ƒ ƒ Z e d ƒ e d ƒ d „  ƒ ƒ Z e d d „ ƒ Z e d d „ ƒ Z e d d „ ƒ Z e d d  „ ƒ Z e d d! „ ƒ Z  e d d" „ ƒ Z! d# Z" e d$ d% „ ƒ Z# d& „  Z$ d' „  Z% d S((   s´  
Support for Python, detect the headers and libraries and provide
*use* variables to link C/C++ programs against them::

	def options(opt):
		opt.load('compiler_c python')
	def configure(conf):
		conf.load('compiler_c python')
		conf.check_python_version((2,4,2))
		conf.check_python_headers()
	def build(bld):
		bld.program(features='pyembed', source='a.c', target='myprog')
		bld.shlib(features='pyext', source='b.c', target='mylib')
iÿÿÿÿN(   t   Errorst   Logst   Nodet   Optionst   Taskt   Utils(   t	   extensiont   before_methodt   after_methodt   feature(   t   confsþ   
#include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
	void Py_Initialize(void);
	void Py_Finalize(void);
#ifdef __cplusplus
}
#endif
int main(int argc, char **argv)
{
   (void)argc; (void)argv;
   Py_Initialize();
   Py_Finalize();
   return 0;
}
sX   
import sys, py_compile
py_compile.compile(sys.argv[1], sys.argv[2], sys.argv[3], True)
s>   from distutils.sysconfig import get_config_var, get_python_libt   process_sourcet   pyc         C   s±   t  |  d d ƒ |  _ t  |  d d ƒ } | rU t | t j ƒ rU |  j j | ƒ } n  | |  _ |  j j	 } | sƒ |  j
 j d ƒ n  t | j d d ƒ ƒ d k r­ t |  _ n  d S(	   sI   
	Create tasks to byte-compile .py files and install them, if requested
	t   install_paths   ${PYTHONDIR}t   install_fromsN   Installing python files requires PYTHON_VERSION, try conf.check_python_versiont   .t    i   N(   t   getattrR   t   Nonet
   isinstanceR   t   patht   find_dirR   t   envt   PYTHON_VERSIONt   bldt   fatalt   intt   replacet   Truet
   install_32(   t   selfR   t   ver(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt
   feature_py:   s    	s   .pyc   
   
   C   sá  t  |  d ƒ s1 t d |  j |  j j ƒ  f ƒ ‚ t |  d d ƒ |  _ t |  d t ƒ } |  j r§ t	 |  j t
 j
 ƒ s§ t d |  j |  j j ƒ  t |  j ƒ f ƒ ‚ n  |  j r|  j rä |  j d |  j d | d |  j d | ƒ q|  j d |  j d | d | ƒ n  g  } |  j j r(| j d ƒ n  |  j j rD| j d	 ƒ n  |  j râ|  j rœ| rn| j |  j ƒ n | j } t j d
 |  j | f |  j ƒ } qî| r´| j |  j ƒ n | j } t j d
 |  j | f |  j ƒ } n | j ƒ  } xì | D]ä } |  j j re|  j j re| j d  } | j j ƒ  j d ƒ j d | |  j j | f ƒ } | j j ƒ  n | j d | ƒ } |  j | | | ƒ }	 | |	 _ |  j rõ|  j d t  j j! | ƒ d | d | j j ƒ  d | ƒ qõqõWd S(   sI   
	Add signature of .py file, so it will be byte-compiled when necessary
	R   s2   add features="py" for target "%s" in "%s/wscript".R   t   relative_tricks7   add features="py" for target "%s" in "%s/wscript" (%s).t
   install_tot   cwdt   pyct   pyos   %s/%siýÿÿÿt   __pycache__s   %s.%s.%ss   .%sN("   t   hasattrt   AssertionErrort   targetR   t	   nice_pathR   R   R   R   R   R   t   typeR   t   add_install_filesR   t   PYCt   appendt   PYOt	   path_fromt   nameR   t
   subst_varst   abspatht   PYTAGt	   NOPYCACHEt   parentt   get_bldt	   make_nodet   mkdirt
   change_extt   create_taskt   pydt   ost   dirname(
   R   t   nodeR!   t   lstt
   target_dirR<   t   extR1   t   pyobjt   tsk(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt
   process_pyM   s@    1	.		+"		!%!%4		R$   c           B   s&   e  Z d  Z d Z d „  Z d „  Z RS(   s   
	Byte-compiling python files
	t   PINKc         C   s#   |  j  d } | j | j j ƒ  ƒ S(   Ni    (   t   outputsR0   t   ctxt   launch_node(   R   R?   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   __str__„   s    c         C   s]   t  j d |  j ƒ d t |  j d j ƒ  |  j d j ƒ  |  j g } |  j j	 j
 | ƒ } | S(   Ns	   ${PYTHON}s   -ci    (   R   R2   R   t   INSTt   inputsR3   RG   R<   t	   generatorR   t   exec_command(   R   t   cmdt   ret(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   run‡   s    D(   t   __name__t
   __module__t   __doc__t   colorRJ   RQ   (    (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyR$      s   	R%   c           B   s&   e  Z d  Z d Z d „  Z d „  Z RS(   s   
	Byte-compiling python files
	RF   c         C   s#   |  j  d } | j | j j ƒ  ƒ S(   Ni    (   RG   R0   RH   RI   (   R   R?   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyRJ   ‘   s    c         C   so   t  j d |  j ƒ t  j d |  j ƒ d t |  j d j ƒ  |  j d j ƒ  |  j g } |  j j	 j
 | ƒ } | S(   Ns	   ${PYTHON}s   ${PYFLAGS_OPT}s   -ci    (   R   R2   R   RK   RL   R3   RG   R<   RM   R   RN   (   R   RO   RP   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyRQ   ”   s    V(   RR   RS   RT   RU   RJ   RQ   (    (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyR%   Œ   s   	t   pyextt   propagate_uselib_varst
   apply_linkt   apply_bundlec         C   s´   |  j  t |  d g  ƒ ƒ |  _ d |  j k r@ |  j j d ƒ n  |  j j |  j _ |  j _ |  j _ |  j j |  j _	 |  j _
 y |  j s’ d SWn t k
 r¯ d |  _ n Xd S(   sp   
	Change the values of *cshlib_PATTERN* and *cxxshlib_PATTERN* to remove the
	*lib* prefix from library names.
	t   uselibt   PYEXTNs   ${PYTHONARCHDIR}(   t   to_listR   RZ   R.   R   t   pyext_PATTERNt   cshlib_PATTERNt   cxxshlib_PATTERNt   macbundle_PATTERNt   fcshlib_PATTERNt   dshlib_PATTERNR   t   AttributeError(   R   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt
   init_pyext™   s    &	c         C   s"   t  j ƒ  d k r t |  _ n  d S(   s?   Mac-specific pyext extension that enables bundles from c_osx.pyt   darwinN(   R   t   unversioned_sys_platformR   t
   mac_bundle(   R   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt
   set_bundle®   s    t   pyembedc         C   sD   |  j  t |  d g  ƒ ƒ |  _ d |  j k r@ |  j j d ƒ n  d S(   s   
	Add the PYEMBED variable.
	RZ   t   PYEMBEDN(   R\   R   RZ   R.   (   R   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   init_pyembedµ   s    c   	      C   sÎ  | s0 y |  j  } Wq0 t k
 r, t } q0 Xn  t | ƒ } | j d ƒ x | D] } | j d | ƒ qP Wt t j ƒ } y | d =Wn t k
 r˜ n Xy2 |  j	 |  j
 j d d j | ƒ g d | ƒ} Wn! t j k
 rî |  j d ƒ n X|  j | ƒ g  } xÅ | j ƒ  D]· } | j ƒ  } | s-qn  | d k rI| j d ƒ q| d	 d
 k ri| d d
 k s‰| d	 d k rŸ| d d k rŸ| j t | ƒ ƒ q| d	 j ƒ  rÅ| j t | ƒ ƒ qPqW| S(   s  
	Spawn a new python process to dump configuration variables

	:param variables: variables to print
	:type variables: list of string
	:param imports: one import by element
	:type imports: list of string
	:return: the variable values
	:rtype: list of string
	R   s   print(repr(%s))t   MACOSX_DEPLOYMENT_TARGETs   -cs   
R   s9   The distutils module is unusable: install "python-devel"?R   i    t   'iÿÿÿÿt   "N(   t   python_importsRc   t   DISTUTILS_IMPt   listR.   t   dictR=   t   environt   KeyErrort   cmd_and_logR   t   PYTHONt   joinR    t   WafErrorR   t   to_logt
   splitlinest   stripR   t   evalt   isdigitR   (	   R   t	   variablest   importst   programt   vt   os_envt   outt   return_valuest   s(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   get_python_variables¿   s@    2@s   Testing pyembed configurationc         C   s<   |  j  d d d d d | d t d d d	 d
 | | f ƒ d  S(   Nt   header_names   Python.ht   define_namet   HAVE_PYEMBEDt   msgt   fragmentt   errmsgs-   Could not build a python embedded interpretert   featuress   %s %sprogram pyembed(   t   checkt   FRAG(   R   t   modeRŠ   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   test_pyembedî   s    s   Testing pyext configurationc         C   s<   |  j  d d d d d | d t d d d	 d
 | | f ƒ d  S(   NR‡   s   Python.hRˆ   t
   HAVE_PYEXTRŠ   R‹   RŒ   s!   Could not build python extensionsR�   s   %s %sshlib pyext(   RŽ   R�   (   R   R�   RŠ   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt
   test_pyextô   s    s   pyembed pyextc         C   s|  t  j | ƒ } d |  j k p9 d |  j k p9 d |  j k s@ t SxK d j ƒ  D]= } | |  j k rv |  j d | ƒ qM |  j | |  j | <qM W|  j j r  d p£ d } d | k r|  j j d |  j j d ƒ ƒ } | d k rï |  j d	 ƒ n |  j
 | d
 ƒ |  j | ƒ n  d | k rx|  j j d |  j j d ƒ ƒ } | d k rX|  j d ƒ n |  j
 | d ƒ |  j | ƒ n  t S(   s   
	For cross-compilation purposes, it is possible to bypass the normal detection and set the flags that you want:
	PYTHON_VERSION='3.4' PYTAG='cpython34' pyext_PATTERN="%s.so" PYTHON_LDFLAGS='-lpthread -ldl' waf configure

	The following variables are used:
	PYTHON_VERSION    required
	PYTAG             required
	PYTHON_LDFLAGS    required
	pyext_PATTERN     required
	PYTHON_PYEXT_LDFLAGS
	PYTHON_PYEMBED_LDFLAGS
	t   PYTHON_LDFLAGSt   PYTHON_PYEXT_LDFLAGSt   PYTHON_PYEMBED_LDFLAGSs"   PYTHON_VERSION PYTAG pyext_PATTERNs#   Please set %s in the os environmentt   cxxt   cRV   s:   No flags provided through PYTHON_PYEXT_LDFLAGS as requiredR[   Ri   s<   No flags provided through PYTHON_PYEMBED_LDFLAGS as requiredRj   N(   R   R\   Rs   t   Falset   splitR   R   t   CXX_NAMEt   getR   t   parse_flagsR“   R‘   R   (   R   R�   t   xt   xxt   flags(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   python_cross_compileú   s*    -!!c         C   sL  t  j | ƒ } d | k s3 d | k s3 t d ƒ ‚ |  j } | j r` | j r` |  j d ƒ n  |  j | ƒ rs d S| j s‰ |  j	 ƒ  n  | j
 } | s¨ |  j d ƒ n  d j ƒ  } y* |  j g  | D] } d | ^ qÄ ƒ } Wn t k
 rþ |  j d	 ƒ n Xg  t | | ƒ D] \ } } d
 | | f ^ q} |  j d | d j | ƒ f ƒ t t | | ƒ ƒ }	 d } |	 | r’|	 | | | <|  j | <n  d |	 d | _ d j | j j d ƒ d  ƒ }
 |  j d j | ƒ d d |
 d |
 d |
 g d d d d d t ƒ| j rq|  j j rd Sd d d g g } t j d k  rcg  | d  D] } | g ^ qK} n  | j rrd! pud" } d | k rœx© | D]¡ } | d# g } y< |  j d d$ d% j | ƒ d& | j d' d d( d) d* | ƒ Wq‹|  j j k
 r+|  j d d$ d% j | ƒ d& | j d' d d( d) d* | ƒ q‹Xq‹Wy |  j | ƒ Wqœ|  j j k
 r˜|	 d+ r’|	 d, r’| j d- |	 d, g ƒ |  j | ƒ q™‚  qœXn  d | k r]xF | D]> } |  j d d. d% j | ƒ d& | j d' d d( d/ d* | ƒ q¯Wy |  j | ƒ Wq]|  j j k
 rY|	 d+ rS|	 d, rS| j d0 |	 d, g ƒ |  j | ƒ qZ‚  q]Xn  |  j  d1 d2 ƒ d S|	 d3 d% |	 d4 } |  j! | d) ƒ |	 d3 d% |	 d5 d% |	 d4 } |  j! | d/ ƒ d } |	 d6 sé| j |	 d6 <n  x¾d7 |	 d6 d7 | j d8 d7 | j j# d d ƒ f D]‡} | r€| j$ r€| j$ } |  j d9 | ƒ |  j% d: | d; d) d< | d t d d= | ƒ } n  | rà|	 d, rà|	 d, g } |  j d> | ƒ |  j% d: | d; d) d< | d t d d? | ƒ } n  | r<|	 d@ r<|	 d@ g } |  j dA ƒ |  j% d: | d; d) d< | d t d dB | ƒ } n  | sœt& j' j |	 dC dD ƒ g } |  j dE ƒ |  j% d: | d; d) d< | d t d dF | ƒ } n  | rPqqW| rÏ| | _$ | j( dG | g ƒ n |  j dH ƒ t  j) sï|	 d+ r
| j$ | _* | j+ | _, n  |  j dI |	 dJ f ƒ |	 dJ g | _- |	 dJ g | _. | j dK k rz| j dL dM g ƒ | j dN dM g ƒ n  | j dK k r²| j dO dM g ƒ | j dP dM g ƒ n  | j dQ k r dR dS l/ m0 } | ƒ  } | j1 ƒ  | j( dN | j2 ƒ | j( dP | j2 ƒ | j( dT | j3 ƒ n  |  j% dU dV dW d1 d; d) dX t4 dY dZ ƒ d S([   s  
	Check for headers and libraries necessary to extend or embed python by using the module *distutils*.
	On success the environment variables xxx_PYEXT and xxx_PYEMBED are added:

	* PYEXT: for compiling python extensions
	* PYEMBED: for embedding a python interpreter
	Ri   RV   sC   check_python_headers features must include 'pyembed' and/or 'pyext's$   load a compiler first (gcc, g++, ..)Ns$   Could not find the python executablesl   prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSIONs   get_config_var('%s') or ''s6   Python development headers not found (-v for details).s   %s = %rs#   Configuration returned from %r:
%s
s   
Rl   s   %st   SOR   i   R   s   -configs   python%s-configs   python-config-%ss   python%sm-configt   vart   PYTHON_CONFIGRŠ   s   python-configt	   mandatorys   --cflagss   --libss	   --ldflagsi  i    R—   R˜   s   --embeds)   Asking python-config for pyembed %r flagst    R   t   packaget   uselib_storeRj   t   argst   Py_ENABLE_SHAREDt   LIBDIRt   LIBPATH_PYEMBEDs'   Asking python-config for pyext %r flagsR[   t   LIBPATH_PYEXTt   HAVE_PYTHON_Hi   t   LDFLAGSt   CFLAGSt   LDSHAREDt	   LDVERSIONt   pythont   ms'   

# Trying default LIBPATH_PYEMBED: %r
t   libRZ   t   libpaths*   Checking for library %s in LIBPATH_PYEMBEDs(   

# try again with -L$python_LIBDIR: %r
s!   Checking for library %s in LIBDIRt   LIBPLsb   

# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)
s'   Checking for library %s in python_LIBPLt   prefixt   libssS   

# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)
s'   Checking for library %s in $prefix/libst   LIB_PYEMBEDs   

### LIB NOT FOUND
sD   Include path for Python extensions (found via distutils module): %r
t	   INCLUDEPYt   gcct   CFLAGS_PYEMBEDs   -fno-strict-aliasingt   CFLAGS_PYEXTt   CXXFLAGS_PYEMBEDt   CXXFLAGS_PYEXTt   msvciÿÿÿÿ(   t   MSVCCompilert   LINKFLAGS_PYEXTR‡   s   Python.hRˆ   R‹   RŒ   sK   Distutils not installed? Broken python installation? Get python-config now!(5   R   R\   R(   R   t   CC_NAMER›   R   R¡   R   t   check_python_versionRv   Rš   R†   t   RuntimeErrort   zipRy   Rw   Rr   Rs   R]   t   find_programR™   R¤   R®   t   syst
   hexversiont	   check_cfgt   errorst   ConfigurationErrorR‘   t   append_uniqueR“   t   defineR�   R   R   R¬   RŽ   R=   R   t   append_valuet   is_win32R­   Rº   t	   LIB_PYEXTt   INCLUDES_PYEXTt   INCLUDES_PYEMBEDt   distutils.msvccompilerRÂ   t
   initializet   compile_optionst   ldflags_sharedR�   (   R
   R�   R   t   pybinR�   Rž   R@   t   yt   valst   dctt   numt	   all_flagst   kRŸ   R    t
   embedflagst   resultR1   R   RÂ   t   dist_compiler(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   check_python_headers#  sÚ    	$			*2 
D	#<@
<
"
<	1111		
c         C   sz  | d k s! t | t ƒ s! t ‚ |  j j } | sC |  j d ƒ n  | d d g } t j d | ƒ |  j	 | ƒ j
 ƒ  } t | ƒ d k s¦ t d t | ƒ | f ƒ ‚ t | d ƒ t | d ƒ t | d	 ƒ | d
 t | d ƒ f } | d k pü | | k } | rÝd j g  | d	  D] } t | ƒ ^ qƒ } | |  j _ d |  j k r[|  j j }	 nÊ d |  j k rz|  j d }	 n« t j r¡|  j d d g ƒ \ }
 }	 n% d }
 |  j d |  j j g ƒ \ }	 |
 d k r%|  j j r t j j |  j j d | ƒ }
 q%t j j |  j j d d | ƒ }
 n  d |  j k rC|  j j } nM d |  j k rb|  j d } n. |  j d |  j j g ƒ \ } | s�|	 } n  t |  d ƒ rÂ|  j d |	 ƒ |  j d | ƒ n  |	 |  j _ | |  j _ n  d j t t | d
  ƒ ƒ } | d k r|  j d | ƒ nA d j t t | ƒ ƒ } |  j d | f | d | rRd pUd ƒ| sv|  j d | f ƒ n  d S(   s  
	Check if the python interpreter is found matching a given minimum version.
	minver should be a tuple, eg. to check for python >= 2.4.2 pass (2,4,2) as minver.

	If successful, PYTHON_VERSION is defined as 'MAJOR.MINOR' (eg. '2.4')
	of the actual python version found, and PYTHONDIR and PYTHONARCHDIR
	are defined, pointing to the site-packages directories appropriate for
	this python version, where modules/packages/extensions should be
	installed.

	:param minver: minimum version
	:type minver: tuple of int
	s$   could not find the python executables   -cs3   import sys
for x in sys.version_info: print(str(x))s!   python: Running python command %ri   s   found %r lines, expected 5: %ri    i   i   i   i   R   t	   PYTHONDIRs   get_config_var('LIBDEST') or ''s$   get_python_lib(standard_lib=0) or ''s/   get_python_lib(standard_lib=0, prefix=%r) or ''R³   Rµ   t   PYTHONARCHDIRs@   get_python_lib(plat_specific=1, standard_lib=0, prefix=%r) or ''RÏ   s   Checking for python versions!   Checking for python version >= %sRU   t   GREENt   YELLOWs+   The python version is too old, expecting %rN(   R   R   t   tupleR(   R   Rv   R   R   t   debugRu   Rš   t   lenR   Rw   t   strR   Rä   Rs   R   RÑ   R†   t   PREFIXR«   R=   R   Rå   R'   RÏ   t   mapRŠ   (   R
   t   minverRÙ   RO   t   linest   pyver_tupleRá   Rž   t   pyvert   pydirt   python_LIBDESTt	   pyarchdirt
   pyver_fullt
   minver_str(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyRÅ   Ì  s\    !.A,	"%	)s¡   
import %s as current_module
version = getattr(current_module, '__version__', None)
if version is not None:
	print(str(version))
else:
	print('unknown version')
R   c            s`  d | } | r# d | | f } n  |  j  | ƒ y' |  j |  j j d t | g ƒ } Wn2 t j k
 r‹ |  j t ƒ |  j	 d | ƒ n X| j
 ƒ  } | r3|  j | ƒ | d k rË |  j	 d | ƒ n  d d l m ‰  ‡  f d	 †  } i | d
 6ˆ  | ƒ d 6} t | i  | ƒ } | s\|  j	 d | ƒ q\n) | d k rO|  j t ƒ n |  j | ƒ d S(   s#  
	Check if the selected python interpreter can import the given python module::

		def configure(conf):
			conf.check_python_module('pygccxml')
			conf.check_python_module('re', condition="ver > num(2, 0, 4) and ver <= num(3, 0, 0)")

	:param module_name: module
	:type module_name: string
	s   Checking for python module %rs   %s (%s)s   -cs#   Could not find the python module %rs   unknown versions   Could not check the %s versioniÿÿÿÿ(   t   LooseVersionc             sQ   t  |  d t ƒ r? ˆ  d j g  |  D] } t | ƒ ^ q# ƒ ƒ Sˆ  |  d ƒ Sd  S(   Ni    R   (   R   R   Rw   Rë   (   Rß   Rž   (   R÷   (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyRÝ   H  s    ,RÝ   R   s0   The %s version does not satisfy the requirementsN(   t	   start_msgRu   R   Rv   t   PYTHON_MODULE_TEMPLATER    Rx   t   end_msgR™   R   R{   t   distutils.versionR÷   R|   R   (   R
   t   module_namet	   conditionRŠ   RP   RÝ   t   dt   ev(    (   R÷   s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   check_python_module+  s.    
'c         C   s_  |  j  } t t j d d ƒ r0 t j j | _ n  t t j d d ƒ rW t j j | _ n  t t j d d ƒ r~ t j j	 | _
 n  | j s® t t j d d ƒ p¢ t j g | _ n  t j | j ƒ | _ |  j d d d ƒd | _ d | _ t t j d	 d
 ƒ | _ t t j d d
 ƒ | _ y, |  j |  j  j d d g ƒ j ƒ  | _ Wn t j k
 rZn Xd S(   s!   
	Detect the python interpreter
	t	   pythondirt   pythonarchdirt	   nopycacheR³   R£   Rv   R   s   -OR$   i   R%   s   -cs   import imp;print(imp.get_tag())N(   R   R   R   t   optionsR   R  Rä   R  Rå   R  R5   Rv   RÉ   t
   executableR   R\   RÈ   t   PYFLAGSt   PYFLAGS_OPTR-   R/   Ru   R{   R4   R    Rx   (   R
   R�   (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt	   configureW  s&    		'		,c      
   C   sÎ   |  j  d ƒ } | j d d d d d d d d	 d
 ƒ| j d d d d d d d d	 d ƒ| j d d d d d d	 d ƒ| j d d d d	 d t j ƒ| j d d d d	 d ƒ| j d d d d	 d ƒd S(   s   
	Add python-specific options
	s   Python Optionss   --nopyct   destR$   t   actiont   store_falset   defaulti   t   helpsM   Do not install bytecode compiled .pyc files (configuration) [Default:install]s   --nopyoR%   sN   Do not install optimised compiled .pyo files (configuration) [Default:install]s   --nopycacheR  t
   store_truesB   Do not use __pycache__ directory to install objects [Default:auto]s   --pythonR³   s&   python binary to be used [Default: %s]s   --pythondirR  sR   Installation path for python modules (py, platform-independent .py and .pyc files)s   --pythonarchdirR  sV   Installation path for python extension (pyext, platform-dependent .so or .dylib files)N(   t   add_option_groupt
   add_optionRÉ   R  (   t   optt   pyopt(    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyR  s  s    (&   RT   R=   RÉ   t   waflibR    R   R   R   R   R   t   waflib.TaskGenR   R   R   R	   t   waflib.ConfigureR
   R�   RK   Rp   R    RE   R$   R%   Rd   Rh   Rk   R   R†   R‘   R“   R¡   Rã   RÅ   Rù   R   R  R  (    (    (    s1   /git_repos/drobillad/ingen/waflib/Tools/python.pyt   <module>   sH   ."		2				.(¨\+	