%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/distutils/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/distutils/__pycache__/ccompiler.cpython-39.pyc

a

z[yc�m�@s�ddlZddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZddlmZmZmZmZmZddlmZddlmZddlmZdd	lmZmZdd
lmZm Z m!Z!m"Z"m#Z#m$Z$ddl%Z%da&e%�'�Z(e)�Z*dd�Z+d
d�Z,dd�Z-e,ede-�dMdd�Z.e,ede.�dNdd�Z/e,ede/�dOdd�Z0e,ede0�dPdd�Z1e,ede1�d d!�Z2d"d#�Z3e,ed$e3�dQd%d&�Z4e,ed'e4�dRd)d*�Z5d+dgfd,d-�Z6e,ed.e6�d/d0�Z7e,ed1e7�d2e
d3<d4e
d5<d6e
d7<d8e
d9<d:e
d;<d<e
d=<d>e
d?<ej8d@7_8ej9dAk�rNdBe
dC<e!��rNe�:dD�dEej8e_8e
Z;dSdFdG�Z
e
e_
eZ<dHdI�Zee_dJD]0Z=ej>�?dKe=dL�Z@e@du�rxeAe@dIe��qxdS)T�N)�copy)�	ccompiler)�compiler_class�gen_lib_options�get_default_compiler�new_compiler�	CCompiler)�DistutilsExecError�DistutilsModuleError�DistutilsPlatformError�CompileError�UnknownFileError)�customize_compiler)�LooseVersion)�log)�filepath_from_subprocess_output�forward_bytes_to_stdout)�	cyg2win32�is_sequence�mingw32�get_num_build_jobs�_commandline_dep_string�sanitize_cxx_flagscCs�|d}tj�|�sdSt|d��}|��}Wd�n1s@0Yt|||�}|d}||krjdSd�|dd��}	dd�tj|	dd	�D�}
z2t�	|�j
}|
D]}t�	|�j
|kr�WdSq�Wnty�YdS0d
S)z�
    Check if an objects needs to be rebuild based on its dependencies

    Parameters
    ----------
    obj : str
        object file

    Returns
    -------
    bool
    �.dT�rN����cSs"g|]}|dkr|�d�s|�qS)�
�:)�endswith)�.0�x�r"�?/usr/lib64/python3.9/site-packages/numpy/distutils/ccompiler.py�
<listcomp>Es�z _needs_build.<locals>.<listcomp>)�posixF)�os�path�exists�open�	readlinesr�join�shlex�split�stat�st_mtime�OSError)�obj�cc_args�extra_postargs�pp_optsZdep_file�f�linesZcmdlineZlast_cmdline�contentsZdepsZt_objr"r"r#�_needs_build%s&&r8cs�fdd�}t|||�dS)Ncs�|g|�Ri|��S�Nr")�self�args�kw��funcr"r#�<lambda>Y�z replace_method.<locals>.<lambda>)�setattr)�klassZmethod_namer>�mr"r=r#�replace_methodWsrDcCsdS)z�
    Does nothing here, but is called by the get_version method and can be
    overridden by subclasses. In particular it is redefined in the `FCompiler`
    class where more documentation can be found.

    Nr"�r:r"r"r#�CCompiler_find_executablesbsrF�find_executablesc	Cs`|dur|nttj�}|dur8|}t|�r8d�t|��}t�|�z,|jrZt	j
||d�nt	j
|t	j|d�Wn�t	jy�}z|j
}|j}WYd}~nrd}~0t�y}zLd|�d�}z|�tjj�}Wnty�|�d�}Yn0d}WYd}~nd}~00dSt|��r"d�t|��}|j�r2t|�t�d	|��rFd
}nd}td|||f��dS)
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)�stderrrIz

z


�utf8�sToo many open filesz2
Try rerunning setup command until build succeeds.rz)Command "%s" failed with exit status %d%s)�dictr&�environrr+�listr�info�verbose�
subprocess�check_output�STDOUT�CalledProcessError�output�
returncoder0�encode�sys�stdout�encoding�AttributeErrorr�re�searchr	)	r:�cmd�displayrI�exc�o�s�e�msgr"r"r#�CCompiler_spawnps>

�rfZspawnrcCs�|durd}g}|D]�}tj�tj�|��\}}tj�|�d}|tj�|�d�}|�d�r�|�d�d}|d|�}	tj�tj�	|	��}	|	||d�}||j
vr�td||f��|r�tj�|�}tj�|||j
�}
|�|
�q|S)a�
    Return the name of the object files for the given source files.

    Parameters
    ----------
    source_filenames : list of str
        The list of paths to source files. Paths can be either relative or
        absolute, this is handled transparently.
    strip_dir : bool, optional
        Whether to strip the directory from the returned paths. If True,
        the file name prepended by `output_dir` is returned. Default is False.
    output_dir : str, optional
        If given, this path is prepended to the returned paths to the
        object files.

    Returns
    -------
    obj_names : list of str
        The list of paths to the object files corresponding to the source
        files in `source_filenames`.

    Nr�z..�z"unknown file type '%s' (from '%s'))r&r'�splitext�normpath�
splitdrive�isabs�
startswith�rfind�basename�abspathZsrc_extensionsr
r+Z
obj_extension�append)r:Zsource_filenamesZ	strip_dir�
output_dirZ	obj_namesZsrc_name�base�ext�i�dZobj_namer"r"r#�CCompiler_object_filenames�s&

rwZobject_filenamesc	srt�}	t�"tdurt�|	�aWd�n1s20Y|sDgSddlm}
m}m}t	�|
�r�g}
dD]4}t
�d|�}|dur�qj|
�d|d�|�f�qjd�|
�}
n�j
}d	d�|�f}
t�|
���|||||��\}}��}���||��d
d���}
��r|
dd���7}
t�|
�����fdd
�}t	�|
��r�t|���}gg}}|D]r}||v�r`||\}}�jdk�r�t|�}t|�}||��r�||��s�|�|||ff�n|�|||ff��q`|}|D]}||��q�n|��}t|�dk�rZ|	dk�rZddlm}||	��}|�||�}Wd�n1�sF0Yt|�n|D]}||��q^|S)a�
    Compile one or more source files.

    Please refer to the Python distutils API reference for more details.

    Parameters
    ----------
    sources : list of str
        A list of filenames
    output_dir : str, optional
        Path to the output directory.
    macros : list of tuples
        A list of macro definitions.
    include_dirs : list of str, optional
        The directories to add to the default include file search path for
        this compilation only.
    debug : bool, optional
        Whether or not to output debug symbols in or alongside the object
        file(s).
    extra_preargs, extra_postargs : ?
        Extra pre- and post-arguments.
    depends : list of str, optional
        A list of file names that all targets depend on.

    Returns
    -------
    objects : list of str
        A list of object file names, one per source file `sources`.

    Raises
    ------
    CompileError
        If compilation fails.

    Nr)�	FCompiler�	is_f_file�has_f90_header)Zf77Zf90ZfixZ	compiler_zFortran %s compiler: %srHrzC compiler: %s
zcompile options: '%s'z
extra options: '%s'cs|\}\}}t|����sdSt�0|tvrDt�|�Wd�qnWd�n1sX0Yt�d�qzjt�$��|||����Wd�n1s�0YWt�t�|�Wd�n1s�0Yn0t�t�|�Wd�n1s�0Y0dS)Ng�������?)	r8�_global_lock�_processing_files�add�time�sleep�_job_semaphore�_compile�remove)r;r1�srcrt�r2r3r4r:r"r#�single_compile1s
,4*�z)CCompiler_compile.<locals>.single_compileZabsoftrg)�ThreadPoolExecutor)rr{r��	threading�	SemaphoreZnumpy.distutils.fcompilerrxryrz�
isinstance�getattrrqr+�compiler_sorrPZ_setup_compileZ_get_cc_argsrO�keys�
compiler_typer�items�len�concurrent.futuresr��map)r:ZsourcesrrZmacros�include_dirs�debug�
extra_preargsr3ZdependsZjobsrxryrzr`ZfcZfcompZccompZobjectsZbuildr�Zobjects_to_buildZf77_objectsZ
other_objectsr1r�rtZbuild_itemsrbr�Zpool�resr"r�r#�CCompiler_compile�sh((

��



,
r��compiler"cst�d|jj�jjf�t|d�rJd|jdvrJ|j�d�|j�d���fdd�}|d�rl|��j	�|d	�r��j
D]\}}|�||�qz|d
�r��jD]}|�
|�q�|d�r�|�|j�j�|d�r�|�|j�j�|d
�r�|��j�|d��r|��j�dS)a�
    Customize compiler using distutils command.

    Parameters
    ----------
    cmd : class instance
        An instance inheriting from `distutils.cmd.Command`.
    ignore : sequence of str, optional
        List of `CCompiler` commands (without ``'set_'``) that should not be
        altered. Strings that are checked for are:
        ``('include_dirs', 'define', 'undef', 'libraries', 'library_dirs',
        'rpath', 'link_objects')``.

    Returns
    -------
    None

    zcustomize %s using %s�compiler�clangrz-ftrapping-mathcst�|d�duo|�vSr9)r�)�attr�r_�ignorer"r#�allow�sz&CCompiler_customize_cmd.<locals>.allowr��define�undef�	libraries�library_dirs�rpath�link_objectsN)rrP�	__class__�__name__�hasattrr�rqr�Zset_include_dirsr�r�Zdefine_macror�Zundefine_macroZ
set_librariesr�Zset_library_dirsr�Zset_runtime_library_dirsr�Zset_link_objectsr�)r:r_r�r��name�valueZmacror"r�r#�CCompiler_customize_cmdts.�

r�Z
customize_cmdcs�g}d}t|j���}dD]}||vr|�|�q|D]8}t||�r6t||�}t|t|��}|�|t|�f�q6dt|d�d��fdd�|D�}d�	|�S)	Nr)
�versionr�r�Z
object_switchZcompile_switchr�r�r�r�r�z%-rgzs = %scsg|]}�|�qSr"r")r Zprop��fmtr"r#r$�r@z'_compiler_to_string.<locals>.<listcomp>r)
rOZexecutablesr�rqr�r��maxr��reprr+)r�ZpropsZmxr��key�vr6r"r�r#�_compiler_to_string�s

r�cCsVz|��WntyYn0tjjdkrRtd�t|j�tt|��td�dS)z�
    Print the compiler customizations to stdout.

    Parameters
    ----------
    None

    Returns
    -------
    None

    Notes
    -----
    Printing is only done if the distutils log threshold is < 2.

    rhzP********************************************************************************N)�get_version�	ExceptionrZ_global_logZ	threshold�printr�r�rEr"r"r#�CCompiler_show_customization�s
r�Zshow_customizationc
	Cs�t�d|jj�t|�|r�z|j�d�WnttfyDYn0t	|d�r�d|j
dvr�|js�|j
d�d�r~d\}}nd\}}|j
d�
||�g|j
d	d
�|_n8t	|d�r�t�d|j
f�t	|d�s�t�d
|jj�t	|d��r(d|j
dv�s d|j
dv�s d|j
dv�r(d|_n�tjdk�r�dd
l}dd
l}|��}z�zjtj�|d�}t|d��}	|	�d�Wd
�n1�s�0Y|j|g|dd|dgd�d|_Wnt�y�d|_Yn0W|�|�n|�|�0d
S)am
    Do any platform-specific customization of a compiler instance.

    This method calls `distutils.sysconfig.customize_compiler` for
    platform-specific customization, as well as optionally remove a flag
    to suppress spurious warnings in case C++ code is being compiled.

    Parameters
    ----------
    dist : object
        This parameter is not used for anything.
    need_cxx : bool, optional
        Whether or not C++ has to be compiled. If so (True), the
        ``"-Wstrict-prototypes"`` option is removed to prevent spurious
        warnings. Default is False.

    Returns
    -------
    None

    Notes
    -----
    All the default options used by distutils can be extracted with::

      from distutils import sysconfig
      sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
                                'CCSHARED', 'LDSHARED', 'SO')

    zcustomize %sz-Wstrict-prototypesr��ccr�gcc)r��g++)r�zc++rgNz#### %s #######�compiler_cxxzMissing compiler_cxx fix for r�r�Tr%zfile.c�wzint a;
z-MMDz-MFr)rrr�F)rrPr�r�rr�r�r\�
ValueErrorr�r�r�rm�replace�warnZ
_auto_dependsr&r��tempfile�shutilZmkdtempr'r+r)�writer�r�rmtree)
r:ZdistZneed_cxx�a�br�r�Ztmpdir�fnr5r"r"r#�CCompiler_customize�sR
�

��*
�
r�Z	customize�[-.\d]+cs���fdd�}|S)aU
    Simple matching of version numbers, for use in CCompiler and FCompiler.

    Parameters
    ----------
    pat : str, optional
        A regular expression matching version numbers.
        Default is ``r'[-.\d]+'``.
    ignore : str, optional
        A regular expression matching patterns to skip.
        Default is ``''``, in which case nothing is skipped.
    start : str, optional
        A regular expression matching the start of where to start looking
        for version numbers.
        Default is ``''``, in which case searching is started at the
        beginning of the version string given to `matcher`.

    Returns
    -------
    matcher : callable
        A function that is appropriate to use as the ``.version_match``
        attribute of a `CCompiler` class. `matcher` takes a single parameter,
        a version string.

    csz|�dd�}d}�r0t��|�}|s(dS|��}t��||d��}|sLdS�rpt��|�d��rp|��}q0qpq0|�d�S)NrrHr)r�r]�match�endr^�group)r:�version_string�posrC�r��pat�startr"r#�matcherBsz%simple_version_match.<locals>.matcherr")r�r�r�r�r"r�r#�simple_version_match(sr�Fc	s2|st|d�r|jS|��z
|j}Wnty:YdS0|rH|dsLdSz
|j}Wn@ty�z
|j�Wnty�YYdS0�fdd�}Yn0ztj|tj	d�}WnJtj
y�}z|j}|j}WYd}~n.d}~0t
y�d}d}Yn0t|�}d}d}||v�r(||�}|�r(t|�}||_|S)	a�
    Return compiler version, or None if compiler is not available.

    Parameters
    ----------
    force : bool, optional
        If True, force a new determination of the version, even if the
        compiler already has a version attribute. Default is False.
    ok_status : list of int, optional
        The list of status values returned by the version look-up process
        for which a version string is returned. If the status value is not
        in `ok_status`, None is returned. Default is ``[0]``.

    Returns
    -------
    version : str or None
        Version string, in the format of `distutils.version.LooseVersion`.

    r�Nrcs"t��|�}|sdS|�d�}|S)Nr�)r]r�r�)r�rCr��r�r"r#r�{s

z&CCompiler_get_version.<locals>.matcher)rJrLr@)r�r�rG�version_cmdr\Z
version_matchZversion_patternrRrSrTrUrVrWr0rr)	r:�forceZ	ok_statusr�r�rVra�statusr�r"r�r#�CCompiler_get_versionWsD





r�r�cCs�|jdvr|St|�}|j|_|jdgt|jdd��|_tj�d�r|d|jdvr||jd|jdg|jdd�|_tj�d�r�|j�	d	�|j�	d
�|j�	d
�n|jdg|jdd�|_|S)z�
    Return the C++ compiler.

    Parameters
    ----------
    None

    Returns
    -------
    cxx : class instance
        The C++ compiler, as a `CCompiler` instance.

    )�msvc�intelw�intelemwrrgN)Zaix�os400Z	ld_so_aixrhr�z-D__STDC_FORMAT_MACROSz-fno-extern-tls-init)
r�rr�rr�rY�platformrmZ	linker_sorq)r:Zcxxr"r"r#�CCompiler_cxx_compiler�s&

���r�Zcxx_compiler)�intelccompilerZIntelCCompilerz(Intel C Compiler for 32-bit applications�intel)r�ZIntelItaniumCCompilerz7Intel C Itanium Compiler for Itanium-based applications�intele)r�ZIntelEM64TCCompilerz(Intel C Compiler for 64-bit applications�intelem)r�ZIntelCCompilerWz3Intel C Compiler for 32-bit applications on Windowsr�)r�ZIntelEM64TCCompilerWz3Intel C Compiler for 64-bit applications on Windowsr�)Z
pathccompilerZPathScaleCCompilerz2PathScale Compiler for SiCortex-based applications�pathcc)ZarmccompilerZArmCCompilerzArm C CompilerZarm))�linux.*r�)r�r�)r�r�)r�r�)�ntr�)r�r��win32)Zmingw32ccompilerZMingw32CCompilerz>Mingw32 port of GNU C Compiler for Win32(for MSC built Python)rz+Setting mingw32 as default compiler for nt.))r�rc
Cs�|durt��tjk}|dur$tj}z"|dur6t|�}t|\}}}Wn6ty|d|}|durp|d|}t|��Yn0d|}zt	|�Wn�t
�y$}	zxt|	�}t�dt|��|dd�}zt	|�Wn:t
�y}	z t|	�}t
d|��WYd}	~	n
d}	~	00WYd}	~	n
d}	~	00ztj|}
t|
�|}Wn$t�ydt
d||f��Yn0|d||�}||_t�d|�|S)	Nz5don't know how to compile C/C++ code on platform '%s'z with '%s' compilerznumpy.distutils.z,%s in numpy.distutils; trying from distutils�z4can't compile C/C++ code: unable to load module '%s'zBcan't compile C/C++ code: unable to find class '%s' in module '%s'znew_compiler returns %s)rZ
get_threshold�INFOr&r�rr�KeyErrorr�
__import__�ImportError�strrPr
rY�modules�varsrQr�)Zplatr�rQ�dry_runr�Zmodule_name�
class_nameZlong_descriptionrerd�modulerBr"r"r#r�sP��2
�rcCsBt||||�}g}|D]&}t|�r2|�t|��q|�|�q|Sr9)�_distutils_gen_lib_optionsr�extendrOrq)r�r�Zruntime_library_dirsr�rZlib_optsrur"r"r#rs�r)Zmsvc9r�Z_msvcZbcppZcygwincZemxcZunixcz
distutils.r�)NN)rr)NNNrNNN)r")r)r�rr)NNNrr)Br&r]rYr,r~rRrZ	distutilsrZdistutils.ccompilerrrrrrZdistutils.errorsr	r
rrr
Zdistutils.sysconfigrZdistutils.versionrZnumpy.distutilsrZnumpy.distutils.exec_commandrrZnumpy.distutils.misc_utilrrrrrrr�r��Lockr{�setr|r8rDrFrfrwr�r�r�r�r�r�r�r�Z_default_compilersr�rPZ_distutils_new_compilerr�Z_ccr��getZ_mrAr"r"r"r#�<module>s� 2

G
-�

0
Q
/C$
��
,


Zerion Mini Shell 1.0