ó
–<4Ic           @   s®  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 m Z m	 Z	 d  d l m
 Z
 m Z m Z m Z m Z d  d l m Z d  d l Z d g Z d „  Z d „  Z d „  Z e j d	 d
 g ƒ d „  Z d „  Z d e j f d „  ƒ  YZ d „  Z d g d „ Z d „  Z d d „ Z d „  Z  d „  Z! d „  Z" e e ƒ e d ƒ e ƒ e d ƒ e ƒ e d ƒ e ƒ e e ƒ e d ƒ e ƒ e d ƒ e ƒ e d ƒ e ƒ e d ƒ e ƒ e e ƒ e d ƒ e ƒ e d ƒ e ƒ e
 e ƒ e ƒ e d	 ƒ e ƒ e d ƒ e ƒ e e ƒ e d
 ƒ e ƒ e d ƒ e ƒ e d ƒ e ƒ e d	 ƒ e ƒ e e ƒ e e ƒ e e  ƒ d S(    iÿÿÿÿN(   t   debugt   warn(   t	   extensiont   taskgent   beforet   aftert   feature(   t   confs   .pyc         C   sZ   d |  _  |  j t |  d d ƒ ƒ |  _ d |  j k rI |  j j d ƒ n  t |  j d <d  S(   Ns   ${PYTHONDIR}t   uselibt    t   PYEXTt	   MACBUNDLE(   t   default_install_patht   to_listt   getattrR   t   appendt   Truet   env(   t   self(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt
   init_pyext   s
    	c         C   s   |  j  d |  j  d <d  S(   Nt   pyext_PATTERNt   shlib_PATTERN(   R   (   R   (    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   pyext_shlib_ext   s    c         C   sD   |  j  t |  d d ƒ ƒ |  _ d |  j k r@ |  j j d ƒ n  d  S(   NR   R	   t   PYEMBED(   R   R   R   R   (   R   (    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   init_pyembed   s    t   pyt
   apply_corec         C   st   t  j rp |  j rp t |  d ƒ s- g  |  _ n  t j j |  j | j |  j	 ƒ |  j	 |  j
 ƒ } |  j j | ƒ n  d  S(   Nt   _py_installed_files(   t   Optionst
   is_installt   install_patht   hasattrR   t   Buildt   bldt   install_filest   abspathR   t   chmodt   extend(   R   t   nodet   installed_files(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt
   process_py   s
    0c         C   s¬  t  j r¨|  j r¨|  j } | s% d  St  j d r d GHxc | D]X } y t j | d ƒ Wn t k
 rl n Xy t j | d ƒ Wq> t k
 r• q> Xq> Wn  t  j d r¨|  j d sÄ |  j d rÌ d GHn  |  j d r2d	 } |  j d
 d | g } | j	 | ƒ t
 j | ƒ j ƒ  } | r2t j d ƒ ‚ q2n  |  j d r¥d } |  j d
 |  j d d | g } | j	 | ƒ t
 j | ƒ j ƒ  } | r¢t j d ƒ ‚ q¢q¥q¨n  d  S(   Nt	   uninstalls%   * removing byte compiled python filest   ct   ot   installt   PYCt   PYOs   * byte compiling python filess^   
import sys, py_compile
for pyfile in sys.argv[1:]:
	py_compile.compile(pyfile, pyfile + 'c')
t   PYTHONs   -cs   bytecode compilation faileds^   
import sys, py_compile
for pyfile in sys.argv[1:]:
	py_compile.compile(pyfile, pyfile + 'o')
t   PYFLAGS_OPT(   R   R   R   R   t   commandst   ost   removet   OSErrorR   R%   t   pproct   Popent   waitt   Utilst   WafError(   R   R'   t   fnamet   programt   argvt   retval(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   byte_compile_py   s@    	 t
   py_taskgenc           B   s   e  Z d  „  Z RS(   c         O   s   t  j j |  | | Ž d  S(   N(   t   TaskGent   task_gent   __init__(   R   t   kt   kw(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyRB   H   s    (   t   __name__t
   __module__RB   (    (    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyR?   G   s   c         C   s   d |  _  d  S(   Ns   ${PYTHONDIR}(   R   (   R   (    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   init_pyJ   s    s
   import sysc         C   s  t  | ƒ } | j d ƒ x | D] } | j d | ƒ q  Wt j |  d d j | ƒ g d t j ƒ} | j ƒ  d j d ƒ } | j rà t	 j
 r× t d d j g  t | ƒ D]  \ } } d | d	 | f ^ q© ƒ ƒ n  t ‚ n  g  }	 x  | D]˜ }
 |
 j ƒ  }
 |
 sqí n  |
 d
 k r'|	 j d  ƒ qí |
 d d k r^|
 d d k r^|	 j |
 d	 d !ƒ qí |
 d j ƒ  r„|	 j t |
 ƒ ƒ qí Pqí W|	 S(   NR	   s   print repr(%s)s   -cs   
t   stdouti    sC   Python program to extract python configuration variables failed:
%ss   line %03i: %si   t   Nonet   'iÿÿÿÿ(   t   listR   R5   R6   t   joint   PIPEt   communicatet   splitt
   returncodet   Logst   verboseR   t	   enumeratet
   ValueErrort   stripRI   t   isdigitt   int(   t
   python_exet	   variablest   importsR;   t   vt   proct   outputt   linenot   linet   return_valuest   s(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   _get_python_variablesL   s.    *		G	 c         C   sÁ  |  j  } | d } | s, t d | f ƒ ‚ t j d k rK |  j d ƒ n  yT d j ƒ  } t | g  | D] } d | ^ qg d g ƒ \ } } } } }	 }
 } } Wn t k
 r¿ |  j d ƒ n X|  j	 j
 d	 | | | | | |	 |
 | | f	 ƒ d
 | | d <| d  k	 rOxC | j ƒ  D]2 } | j d ƒ r8| d } n  | j d | ƒ qWn  | d  k	 r¡xC | j ƒ  D]2 } | j d ƒ rŠ| d } n  | j d | ƒ qhWn  d } d } d | d } |	 d  k	 rñ|	 g } |  j d | d d d | ƒ } n  | r-|
 d  k	 r-|
 g } |  j d | d d d | ƒ } n  | r†t j j | d ƒ g } d | d j d d ƒ } |  j d | d d d | ƒ } n  | s©| | d <| j d | ƒ n  t j d k sßt j j d ƒ sßt j d k sß| rþ| d | d <| d | d <n  |  j d d j | d j d ƒ d  ƒ d  d! ƒ} | sm|  j d" d j | d j d ƒ d  ƒ d  d! ƒ} n  g  } | r$xz t j d# | | f ƒ j ƒ  j ƒ  j ƒ  D]M } | j d$ ƒ sÉ| j d% ƒ rÖ| d } n  | | k r¥| j | ƒ q¥q¥W|  j	 j
 d& | f ƒ | | d' <| | d( <n1 |  j	 j
 d) | f ƒ | g | d' <| g | d( <| d* rºt j d+ | d* ƒ j ƒ  } d, | k s”d- | k rº| j d. d/ ƒ | j d0 d/ ƒ qºn  | d1 rt j d+ | d1 ƒ j ƒ  } d, | k sùd2 | k r| j d3 d/ ƒ | j d4 d/ ƒ qn  | j ƒ  } | j d5 | d( ƒ | j d6 | d ƒ | j d7 | d ƒ | j d8 | d3 ƒ | j d9 | d. ƒ |  j d: d; d< d= d> | d? d@ dA dB dC d ƒ d  S(D   NR/   s   python is %r !t   darwint   osxs@   prefix SO SYSLIBS SHLIBS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHAREDs   get_config_var('%s')s.   from distutils.sysconfig import get_config_vars6   Python development headers not found (-v for details).s³   Configuration returned from %r:
python_prefix = %r
python_SO = %r
python_SYSLIBS = %r
python_SHLIBS = %r
python_LIBDIR = %r
python_LIBPL = %r
INCLUDEPY = %r
Py_ENABLE_SHARED = %r
s   %sR   s   -li   t   LIB_PYEMBEDsÇ   
#ifdef __cplusplus
extern "C" {
#endif
 void Py_Initialize(void);
 void Py_Finalize(void);
#ifdef __cplusplus
}
#endif
int main(int argc, char *argv[]) { Py_Initialize(); Py_Finalize(); return 0; }
i   t   pythont   PYTHON_VERSIONt   libR   R   t   libpatht   libst   .R	   t   LIBPATH_PYEMBEDt   win32t   os2t   LIBPATH_PYEXTt	   LIB_PYEXTs   python%s-configt   vart   PYTHON_CONFIGs   python-config-%ss   %s %s --includess   -Is   /IsL   Include path for Python extensions (found via python-config --includes): %r
t   CPPPATH_PYEXTt   CPPPATH_PYEMBEDsD   Include path for Python extensions (found via distutils module): %r
t   CCs   %s --versions   (GCC)t   gcct   CCFLAGS_PYEMBEDs   -fno-strict-aliasingt   CCFLAGS_PYEXTt   CXXs   g++t   CXXFLAGS_PYEMBEDt   CXXFLAGS_PYEXTt   CPPPATHt   LIBPATHt   LIBt   CXXFLAGSt   CCFLAGSt   header_names   Python.ht   define_namet   HAVE_PYTHON_HR   t   fragmentsc   #include <Python.h>
int main(int argc, char *argv[]) { Py_Initialize(); Py_Finalize(); return 0; }
t   errmsgs-   Could not find the python development headerst	   mandatory(   R   t   AssertionErrorR   t   platformt
   check_toolRO   Rb   RT   t   fatalt   logt   writeRI   t
   startswitht   append_valuet   checkR2   t   pathRL   t   replacet   syst   find_programt   popent   readlineRU   R   t   copy(   R   R   Rf   R[   t   xt   python_prefixt	   python_SOt   python_SYSLIBSt   python_SHLIBSt   python_LIBDIRt   python_LIBPLt	   INCLUDEPYt   Py_ENABLE_SHAREDRh   t   codet   resultt   nameR   t   python_configt   includest   incstrt   versiont   test_env(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   check_python_headersd   s–    	
H		&	!	!!
6362


c         C   sã  | d  k s! t | t ƒ s! t ‚ |  j d } | sG t d | f ƒ ‚ | d d g } t d | ƒ t j | d t j ƒ} | j	 ƒ  d j
 ƒ  } t | ƒ d k sÀ t d	 t | ƒ | f ƒ ‚ t | d ƒ t | d
 ƒ t | d ƒ | d t | d ƒ f } | d  k p| | k } | rSd j g  | d  D] } t | ƒ ^ q0ƒ }	 |	 |  j d <d t j k rwt j d }
 nª t j d k r¤t | d g d g ƒ \ } n d  } | d  k r|  j d ræt j j |  j d d |	 ƒ } qt j j |  j d d d |	 ƒ } n  t j j | d ƒ }
 t |  d ƒ rC|  j d |
 ƒ n  |
 |  j d <n  d j t t | d  ƒ ƒ } | d  k r‘|  j d d | ƒ n8 d j t t | ƒ ƒ } |  j d d | f | d | ƒ| sß|  j d ƒ n  d  S(   NR/   s   python is %r !s   -cs2   import sys
for x in sys.version_info: print str(x)s!   python: Running python command %rRH   i    i   s   found %i lines, expected 5: %ri   i   i   i   Rk   Rg   t	   PYTHONDIRRm   s   get_config_var('LIBDEST')s.   from distutils.sysconfig import get_config_vart   LIBDIRRf   t   PREFIXRh   s   site-packagest   defines   Python versionR	   s   >= %st   options   Python too old.(   RI   t
   isinstancet   tupleR‡   R   R    R5   R6   RM   RN   RO   t   lenRW   RL   t   strR2   t   environR’   Rˆ   Rb   R   R   R¬   t   mapt   check_message_customt   check_messageRŠ   (   R   t   minverRf   t   cmdR\   t   linest   pyver_tupleR¡   R—   t   pyvert   pydirt   python_LIBDESTt
   pyver_fullt
   minver_str(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   check_python_versionÃ   sB    !.A,#& c         C   si   t  j |  j d d d | g d t  j d t  j ƒj ƒ  } |  j d | | ƒ | se |  j d ƒ n  d  S(   NR/   s   -cs	   import %st   stderrRH   s   Python modules   Python module not found.(   R5   R6   R   RM   R7   Rµ   RŠ   (   R   t   module_nameR¡   (    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   check_python_moduleé   s    <c         C   s|   |  j  d d d ƒ} | s d  S|  j } d | d <d | d <d | d	 <t t j d
 d ƒ | d <t t j d d ƒ | d <d  S(   NRf   Rq   R/   sE   "import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"t   PYCMDR	   t   PYFLAGSs   -OR0   t   pyci   R-   t   pyoR.   (   R“   R   R   R   t   options(   R   Rf   R[   (    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   detectî   s     	


c      
   C   sN   |  j  d d d d d d d d d	 ƒ|  j  d
 d d d d d d d d ƒd  S(   Ns   --nopyct   actiont   store_falset   defaulti   t   helpsM   Do not install bytecode compiled .pyc files (configuration) [Default:install]t   destRÅ   s   --nopyosN   Do not install optimised compiled .pyo files (configuration) [Default:install]RÆ   (   t
   add_option(   t   opt(    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   set_options÷   s    %t   apply_incpathst   pyextt   apply_bundlet
   apply_linkt   apply_lib_varst   pyembedR,   t   vars_target_cprogramt   vars_target_cstaticlib(#   R2   R’   R@   R8   t   RunnerR   R    RQ   R    R   R   R   R   R   R   t	   ConfigureR   R5   t   EXT_PYR   R   R   t   bind_featureR(   R>   RA   R?   RG   Rb   R¨   RI   R¿   RÂ   RÈ   RÐ   (    (    (    st   /home/javi/src/hotssh/hotssh/hotssh-0.2.6+dfsg1/.waf-1.5.1-3009bf2a0164643771f76f0e24c46d7e/wafadmin/Tools/python.pyt   <module>   sV   H(						)		_&				





