o
    tBhd                     @   sV   d dl Z d dlZd dlZd dlZd dlmZ d dlmZ dd Zdd Z	d
dd	Z
dS )    N)DistutilsExecError)logc                 C   s2   t | trdS zt|  W dS  ty   Y dS w )NFT)
isinstancestrlen	Exception)seq r	   ~/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/sklearn/externals/_numpy_compiler_patch.pyis_sequence(   s   

r   c                 C   s^   t tjdrtjj|  dS t tjdr"tj| tjj dS tj| jddd dS )z
    Forward bytes from a subprocess call to the console, without attempting to
    decode them.

    The assumption is that the subprocess call already returned bytes in
    a suitable encoding.
    bufferencodingutf8replace)errorsN)hasattrsysstdoutr   writedecoder   )valr	   r	   r
   forward_bytes_to_stdout2   s
   r   c           	      C   sV  |dur|nt tj}|du r|}t|rdt|}t| z| jr/t	j
||d W dS t	j
|t	j|d W dS  t	jyS } z|j}|j}W Y d}~n6d}~w ty } z&d| d}z	|tjj}W n tyw   |d}Y nw d}W Y d}~nd}~ww t|rdt|}| jrt| td	|rd
}nd}td|||f )a  
    Execute a command in a sub-process.

    Parameters
    ----------
    cmd : str
        The command to execute.
    display : str or sequence of str, optional
        The text to add to the log file kept by `numpy.distutils`.
        If not given, `display` is equal to `cmd`.
    env: a dictionary for environment variables, optional

    Returns
    -------
    None

    Raises
    ------
    DistutilsExecError
        If the command failed, i.e. the exit status was not 0.

    N )env)stderrr   z

z


r      s   Too many open filesz2
Try rerunning setup command until build succeeds. z)Command "%s" failed with exit status %d%s)dictosenvironr   joinlistr   infoverbose
subprocesscheck_outputSTDOUTCalledProcessErroroutput
returncodeOSErrorencoder   r   r   AttributeErrorr   researchr   )	selfcmddisplayr   excosemsgr	   r	   r
   CCompiler_spawnE   sH   
r7   )NN)r   r   r$   r-   distutils.errorsr   numpy.distutilsr   r   r   r7   r	   r	   r	   r
   <module>   s   
