o
    tBh                     @   s   d Z ddlZddlmZ ddlZddlmZ dd Zdd Zd	d
 ZdddZ	dddZ
edkrDddlmZ edi e
dd  dS dS )zf
setup.py for HiGHS scipy interface

Some CMake files are used to create source lists for compilation
    N)datetime)joinc                 C   s2   ddl m} || j}|d ur|j| d S d S )Nr   )get_cxx_std_flag)"scipy._build_utils.compiler_helperr   _cxx_compilerextra_compile_argsappend)	build_extextr   std_flag r   r/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/scipy/optimize/_highs/setup.pypre_build_hook   s
   
r   c                 C   sD   ddl m} || j}|d ur d|vrg |d< |d | d S d S )Nr   )get_c_std_flagextra_compiler_args)r   r   compilerr   )
build_clib
build_infor   c_flagr   r   r   basiclu_pre_build_hook   s   
r   c                 C   s   t tj|  } t| ddd6}| }||t| }||d  |t|d |  }||| d}dd |D }W d    n1 sHw   Y  dd |D }|S )Nrutf-8encoding
c                 S   s    g | ]}|d  dkr|  qS )r   #)strip.0sr   r   r   
<listcomp>%   s     z _get_sources.<locals>.<listcomp>c                 S   s   g | ]}t td | qS )zsrc/)strpathlibPathr   r   r   r   r    (   s    )	r"   r#   __file__parentopenreadfindlensplit)
CMakeListsstart_token	end_tokenfr   	start_idxend_idxsourcesr   r   r   _get_sources   s   "
r2   )c                 C   s   t tj|  } t| ddd(}| }||t| d }||d  |t|d |  }W d    n1 s:w   Y  |||  S )Nr   r   r      )	r"   r#   r$   r%   r&   r'   r(   r)   r   )r+   r,   r-   r.   r   r/   r0   r   r   r   _get_version,   s   $r5    c                 C   s  ddl m} |d| |}tddd}|d\}}tdd}d	}tttj	 }	t
 d
}
ddddd| fdd|
 d fd|fd|fd|fdd|	 d fg	}g d}tddd}|jd|dtddddgd|td tddd}tdd d}d!d" |D }|jd#td$dd%g| | dtd$dtdd&tdd'tddd(dtddd(dtddddgd)dg||d*}t|_|jd+td$dd,gdtd$dtdd'tdd&tdd-gd)d.}t|_|tjd$dd/ |S )0Nr   )Configuration_highszCMakeLists.txtzproject(HIGHS VERSIONzLANGUAGES CXX C.HIGHS_VERSION_PATCHzn/az%Y-%m-%d)CMAKE_BUILD_TYPEz	"Release")HiGHSRELEASEN)IPX_ONONHIGHS_GITHASHz"%s"HIGHS_COMPILATION_DATE"HIGHS_VERSION_MAJORHIGHS_VERSION_MINOR	HIGHS_DIR)OPENMPEXT_PRESOLVESCIP_DEVHiGHSDEV	OSI_FOUNDzsrc/CMakeLists.txtzset(basiclu_sources
r3   basiclusrcipmincludec)r1   include_dirslanguagemacros_pre_build_hookzset(ipx_sources
zset(sources
c                 S   s"   g | ]}t |jjd kr|qS )mip)r"   r#   r%   namer   r   r   r   r    o   s    z!configuration.<locals>.<listcomp>_highs_wrappercythonz_highs_wrapper.cxxlp_dataioipxzc++)r1   rO   rP   	librariesdefine_macrosundef_macros_highs_constantsz_highs_constants.cxxsimplex)r1   rO   rP   z*.pxd)numpy.distutils.misc_utilr7   r5   r*   r!   r"   r#   r$   r%   resolver   todaystrftimer2   add_libraryr   r   add_extensionr   rR   add_data_filesospath)parent_packagetop_pathr7   config_major_dot_minorrB   rC   r:   GITHASHrD   
TODAY_DATEDEFINE_MACROSUNDEF_MACROSbasiclu_sourcesipx_sourceshighs_sourcesr
   r   r   r   configuration5   s   

rs   __main__)setup)ri   )r3   )r6   Nr   )__doc__r"   r   rf   os.pathr   r   r   r2   r5   rs   __name__numpy.distutils.coreru   todictr   r   r   r   <module>   s    

	h