U
    WÄ±b&  ã                   @   sB   d dl mZ d dlZd dlmZ dd„ Zed
dd„ƒZdd	„ ZdS )é    N)Úconfc                 C   sB   |   d¡} | jdddd� | jddddd	� | jd
dddd	� d S )Nzpython Optionsz--with-pythonÚstringz!give python installation location)ÚtypeÚhelpz--with-python-includeÚ z)give python include installation location)r   Údefaultr   z--with-python-libz%give python lib installation location)Úadd_option_groupÚ
add_option)Úopt© r   ú0/home/yuhw/wc/wire-cell/waf-tools/find_python.pyÚoptions   s    
ÿ
ÿ
ÿr   Tc                 C   s  | j j}|d ks| ¡ dkr:|  d¡ | jddd|d� n^| ¡ dkrJd S |  d| ¡ | j jrp| j jg| j_nt 	|d	¡g| j_| j j
r˜| j j
g| j_| jd
d|d� d tjd d … d tjd d … d ¡}| j j|ddddg7  _t| jjƒ�r|  | jjd ¡ n
|  d¡ d S )N)ÚyesÚtrueÚonz&Checking for PYTHON in PKG_CONFIG_PATHÚpythonZPYTHONz--cflags --libs)ÚpackageÚuselib_storeÚargsÚ	mandatory)ÚnoÚoffÚfalsezChecking for PYTHON in %sÚincludezPython.h)Úheader_nameÚuser   zpython{}.{}r   é   ZpthreadZdlÚutilÚmzPYTHON not found)r   Zwith_pythonÚlowerÚ	start_msgÚ	check_cfgZwith_python_includeÚenvZINCLUDES_PYTHONÚospÚjoinZwith_python_libZLIBPATH_PYTHONÚcheckÚformatÚsysÚversion_infoZ
LIB_PYTHONÚlenÚend_msg)Úctxr   ÚinstdirZ
python_libr   r   r   Úcheck_python   s*    
 ÿ(r-   c                 C   s   |   ¡  d S )N)r-   )Úcfgr   r   r   Ú	configure.   s    r/   )T)	Zos.pathÚpathr#   r'   Zwaflib.Configurer   r   r-   r/   r   r   r   r   Ú<module>   s   
