%PDF- %PDF-
Mini Shell

Mini Shell

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

a

z[yc�y�@sRdZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZddl
mZmZddlmZddlmZmZmZmZmZdd	lmZdd	lmZd
d�ZGdd
�d
ej�Ze�dej �j!Z"e�dej �j!Z#e�dej �j!Z$e�dej �j%Z&e�dej �j%Z'dd�Z(dd�Z)dd�Z*e�dej �j!Z+e�dej �j!Z,dd�Z-dS)z Build swig and f2py sources.
�N)�	build_ext)�newer_group�newer)�get_platform)�DistutilsError�DistutilsSetupError)�log)�fortran_ext_match�
appendpath�	is_string�is_sequence�get_cmd)�process_filecCs�t�d�}t|d���}t|d��Z}|D]D}|�|�}|r`|�|�d|�d�||�d���q&|�|�q&Wd�n1s�0YWd�n1s�0YdS)zPSubstitute any occurrence of @foo@ by d['foo'] from source file into
    target.z@([a-zA-Z_]+)@�r�wz@%s@�N)�re�compile�open�search�write�replace�group)�target�source�d�varZfsZft�l�m�r�G/usr/lib64/python3.9/site-packages/numpy/distutils/command/build_src.py�
subst_varss

(r!c@s�eZdZdZgd�Zgd�ZgZdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zgfdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*S)+�	build_srcz1build sources from SWIG, F2PY files or a function)
)z
build-src=rzdirectory to "build" sources to)z
f2py-opts=Nz!list of f2py command line options)zswig=Nzpath to the SWIG executable)z
swig-opts=Nz!list of SWIG command line options)zswig-cppNzAmake SWIG create C++ files (default is autodetected from sources))z
f2pyflags=Nz3additional flags to f2py (use --f2py-opts= instead))z
swigflags=Nz3additional flags to swig (use --swig-opts= instead))�force�fz2forcibly build everything (ignore file timestamps))�inplace�iziignore build-lib and put compiled extensions into the source directory alongside your pure Python modules)�verbose-cfgNzJchange logging level from WARN to INFO which will show all compiler output)r#r%r'cCsjd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_dS�N)�
extensions�package�
py_modules�py_modules_dictr"�	build_lib�
build_baser#r%�package_dir�	f2pyflags�	f2py_opts�	swigflags�	swig_opts�swig_cpp�swig�verbose_cfg��selfrrr �initialize_options?s"zbuild_src.initialize_optionscCs�|�dddd�|jdur$|jj|_|jj|_|jjp8g|_|jjpFg|_|jjpTg|_|j	dur�dj
t�gtj
dd��R�}tj�|jd|�|_	i|_|jr�|jr�t�d�n|j|_d|_|jdur�g|_nt�|j�|_|j�r
|jr�t�d	�n|j|_d|_|jdu�rg|_nt�|j�|_|�d
�}|jdu�rJ|j|_|jdu�r^|j|_dD]b}d|�d
d�}t||d�}|�rbt||��r�t�d|�nt� d||f�t!|||��qbdS)NZbuild)r.r.)r-r-)r#r#z	.{}-{}.{}��srcz0ignoring --f2pyflags as --f2py-opts already usedz0ignoring --swigflags as --swig-opts already usedr)r5Zswig_optz--�_�-z-both build_src and build_ext define %s optionz+using "%s=%s" option from build_ext command)"Zset_undefined_optionsr*�distributionZext_packageZext_modulesr)�	librariesr+�
data_filesr"�formatr�sys�version_info�os�path�joinr.r,r0r1r�warn�shlex�splitr2r3�get_finalized_commandr%r4r�getattr�info�setattr)r8Zplat_specifierr�c�o�vrrr �finalize_optionsRsX�





zbuild_src.finalize_optionscCs&t�d�|js|jsdS|��dS)Nr")rrLr)r?�
build_sourcesr7rrr �run�s
z
build_src.runcCsn|jr|�d�j|_|��|jD]}|j|�q"|jrZ|�|j�|jD]}|�|�qJ|�	�|�
�dS)NZbuild_py)r%rJ�get_package_dir�build_py_modules_sourcesr?�build_library_sourcesr)Zcheck_extensions_list�build_extension_sources�build_data_files_sources�build_npy_pkg_config)r8Zlibname_info�extrrr rR�s
�

zbuild_src.build_sourcescCsJ|js
dSt�d�ddlm}g}|jD�]
}t|t�rF|�|�q*t|t��r*|\}}|j	rz|�
d�|�t
j���}nt
j�|j|�}dd�|D�}dd�|D�}|D]b}|jjdkr�||�}	n|�}	|	dur�t|	t�r�|�|	�q�t|	t��r|�|	�q�tt|	���q�|||f�}
|�||
f�q*tt|���q*||jdd�<dS)	Nzbuilding data_files sourcesr)�get_data_files�.cSsg|]}t|d�r|�qS��__call__��hasattr��.0r$rrr �
<listcomp>��z6build_src.build_data_files_sources.<locals>.<listcomp>cSsg|]}t|d�s|�qSr]r_rarrr rc�rdr)r@rrL�numpy.distutils.misc_utilr[�
isinstance�str�append�tupler%rTrFrIrD�seprEr"�__code__�co_argcount�list�extend�	TypeError�repr)r8r[Znew_data_files�datar�files�	build_dirZfuncsr$�s�	filenamesrrr rX�s:



z"build_src.build_data_files_sourcesc
Cs�|\}}}tj�|�}|��D]\}}|||<q|jdkrJtj�||�}	ntj�|j||�}	tj�tj�|�d�}
tj�|	|
�}tj�	|	�s�t�
|	�t|||�tj�||�}||fS)Nrr)rDrE�dirname�itemsr%rFr"�basename�splitext�exists�makedirsr!)
r8rL�gd�template�install_dirZ
subst_dictZtemplate_dir�krPZ
generated_dir�	generatedZgenerated_pathZfull_install_dirrrr �_build_npy_pkg_config�s 


�
zbuild_src._build_npy_pkg_configcCs�t�d�t�td��}|jdks*|��d}|jdkrBd}d}nt|d�rV|j}d}|r�|j	j
��D]`\}}|j	j|}t
j�t
j�|�|�}d|i}|D](}	|�|	|�\}
}|j	j�|
|gf�q�qfdS)	Nz(build_src: building npy-pkg config files�installrFr\T�install_libbase�prefix)rrL�copyr
Z	finalizedrQr%r`r�r>Zinstalled_pkg_configrwr/rDrErF�abspathr�r@rh)r8Zinstall_cmdZ
build_npkgZ
top_prefix�pkgZinfosZpkg_pathr�rrLr~r�rrr rY�s*




�zbuild_src.build_npy_pkg_configcCs�|js
dSt�d�g}|jD]�}t|�r�t|�dkr�|\}}}|jrR|�|�}ntj�	|j
tjj	|�d���}t|d�r�tj�	||d�}||�}|dur�q|||fg}||j
vr�g|j
|<|j
||7<q|�|�q||jdd�<dS)Nzbuilding py_modules sources�r\r^�.py)r+rrLr�lenr%rTrDrErFr"rIr`r,rh)r8Znew_py_modulesrr*Zmodule_basersr�modulesrrr rU�s.



�


z"build_src.build_py_modules_sourcescCstt|�dg��}|sdSt�d|�|�|||f�}|�|||f�}|�|�\}}|rht�d|j|�||d<dS)N�sourceszbuilding library "%s" sources�#%s - nothing done with h_files = %s)rm�getrrL�generate_sources�template_sources�filter_h_filesr*)r8Zlib_name�
build_infor��h_filesrrr rVs�zbuild_src.build_library_sourcescCs&t|j�}t�d|j�|�|j�}|�d�}d�|dd��}|jrT|�	|�|_
|�||�}|�||�}|�
||�}|�||�}|�||�}|�|�\}}||jvr�g|j|<g}|D],}tj�tj�|��d}	|�||	|f�q�|j||7<|�|�\}}
|
�rt�d||
�||_dS)Nzbuilding extension "%s" sourcesr\r���r�)rmr�rrL�nameZget_ext_fullnamerIrFr%rT�ext_target_dirr�r��swig_sources�f2py_sources�
pyrex_sources�filter_py_filesr,rDrEryrxrhr�)r8rZr��fullname�modpathr*�py_filesr�r$�moduler�rrr rW0s4



�z!build_src.build_extension_sourcescCsg}g}|D]"}t|�r$|�|�q|�|�q|s8|S|jrNt|�sN|j}n:t|�r`|d}n|j}tjj|j	g|�
d�dd��}|�|�|jr�t
j}nt
j}t
�|�}	|D]P}
|
||�}|s�q�t|�r�dd�|D�|�|�q�t
�d|f�|�|�q�t
�|	�|S)Nrr\r�cSsg|]}t�d|f��qS)�  adding '%s' to sources.)rrL)rbrtrrr rc~rdz.build_src.generate_sources.<locals>.<listcomp>r�)rrhr%rr�r�rDrErFr"rI�mkpathr6r�INFOZWARNZ
set_thresholdrnrL)r8r��	extension�new_sourcesZfunc_sourcesrrsr�Z	new_levelZ	old_level�funcrrr r�Xs@
�



zbuild_src.generate_sourcescCs|�|dg�S)Nr���filter_files�r8r�rrr r��szbuild_src.filter_py_filescCs|�|gd��S)N)z.hz.hppz.incr�r�rrr r��szbuild_src.filter_h_filescCsHg}g}|D]2}tj�|�\}}||vr4|�|�q|�|�q||fSr()rDrEryrh)r8r�Zextsr�rrr�baserZrrr r��szbuild_src.filter_filesc	Cszg}t|�r*|d�d�}|d�d�}n|j}|j}|D�]8}tj�|�\}}|dk�rj|jrntj�|�}	nt	|j
tj�|��}	|�|	�tj�|	tj�
|��}
|js�t|g||
��r&t|�r�t�d|
�t|�}nt�d|
�t|�}t|
d��}|�|�Wd�n1�s0Yt|
��r^tj�|
�}
|
|v�r^t�d|
�|�|
�|�|
�q:|�|�q:|S)	Nr�depends�include_dirsz.srczfrom_template:> %szconv_template:> %sr�  adding '%s' to include_dirs.)rr�r�r�rDrEryr%rvr
r"r�rFrxr#r�_f_pyf_ext_matchrrL�process_f_file�process_c_filerr�_header_ext_matchrh)r8r�r�r�r�r�rr�rZ�
target_dir�target_fileZoutstrZfidrrrr r��s<



*


zbuild_src.template_sourcesc	Cs`g}|j�d�d}|D]B}tj�|�\}}|dkrP|�||||�}|�|�q|�|�q|S)z@Pyrex not supported; this remains for Cython support (see below)r\r�z.pyx)r�rIrDrEry�generate_a_pyrex_sourcerh)	r8r�r�r��ext_namerr�rZr�rrr r��s�zbuild_src.pyrex_sourcescCsgS)z�Pyrex is not supported, but some projects monkeypatch this method.

        That allows compiling Cython code, see gh-6955.
        This method will remain here for compatibility reasons.
        r)r8r�r�rr�rrr r��sz!build_src.generate_a_pyrex_sourcecCsg}g}g}i}g}|j�d�d}d}	|D�]`}
tj�|
�\}}|dk�rn|jr`tj�|�}
nt|jtj�|��}
tj�	|
�r�t
|
�}||kr�td|
||f��tj�|
|d�}n�t
�d|
�|}d}	tj�|
|d�}tj�	|��sFt
�d	||f�tj�|�}
tj�|
|d�}tj�	|��s8td
|f��t
�d|�|�|
�|�|
�|||
<|�|�q,t|��r�|�|
�q,|�|
�q,|�s�|�s�|S|D]}|�|��q�|j|j}|jj�r�|jjD](\}}||jv�r�|�|�dg���q�t
�d
|�|�r�t|�dk�r.td|f��|d}
||
}tj�|��pNd}
|
g|j}|j�srt||d��r�|	�s�t
�d|
�ddl}|j� |d|
|
g�nt
�d|
�n�t!|��r�|d}n|j}tjj|jg|�d�dd��}
tj�|
|d�}|�|�||j}|j�s.t||d��rx|	�sxt
�d|�|�|
�ddl}|j� |dd|
gd|g|�nt
�d|�tj�	|��s�t"d|f��tj�|j|
�}tj�|d�}tj�|d�}t
�d|�|�|�||j#v�rt
�d|�|j#�|�|	�s�ddl}tj�|jj$�}tj�|dd�}tj�|dd�}t%||��sbt%||��r�|�tj�|��|�&||�|�&||�n8tj�	|��s�td|f��tj�	|��s�td|f��dD]>}tj�|
||�}tj�	|��r�t
�d|�|�|��q�||S) Nr\r�rz.pyf�;mismatch of extension names: %s provides %r but expected %rzmodule.cz.  source %s does not exist: skipping f2py'ing.rzd  target %s does not exist:
   Assuming %smodule.c was generated with "build_src --inplace" command.�
%r missing�&   Yes! Using %r as up-to-date target.�f2py_optionszf2py options: %szConly one .pyf file is allowed per extension module but got more: %rrzf2py: %sz--build-dirz+  skipping '%s' f2py interface (up-to-date)z	f2py:> %sz--lowerz-mz3  skipping f2py fortran files for '%s' (up-to-date)z!f2py target file %r not generatedzfortranobject.czfortranobject.hr�r�r;zf2py target_c file %r not foundzf2py target_h file %r not found)z-f2pywrappers.fz-f2pywrappers2.f90)'r�rIrDrEryr%rvr
r"�isfile�get_f2py_modulenamerrFr�debugrGrLrhr	r�r�r1r>r?rnr�r�r�r#rZ
numpy.f2pyZf2pyZrun_mainrrr��__file__rZ	copy_file)r8r�r�r�r�Z	f_sourcesZf2py_targets�target_dirsr�Z	skip_f2pyrr�rZr�r�r�rr�r�r�ZnumpyrsZtarget_cZtarget_hZsource_cZsource_hZname_ext�filenamerrr r��s

�����



����

�

�

����
zbuild_src.f2py_sourcesc	Cs�g}g}i}g}g}d}d|jvr8d}	d}
|j�d�n|jrHd}	d}
nd}	d}
d}|j�d�d}|D�]}
tj�|
�\}}|d	k�rp|jr�tj�	|�}|j
}nt|jtj�	|��}|}tj�
|
��r�t|
�}||d
d�kr�td|
||d
d�f��|	du�rt|
�}	|	dk}
nlt|
�}|du�r<t�d|
|	f�nF|	|k�r�t�d
|	|
|f�|dk�rtt�d�d}
nt�d|
�|
�r�d}tj�|d||f�}n�t�d|
�|d
d�}d
}t||�}tj�
|��s,t�d||f�tj�	|�}t||�}tj�
|��std|f��t�d|�|�|�|�|�|�tj�||d��|�|
�|d||
<qh|�|
�qh|�s�|S|�r�||S|D]}|�|��q�|j�p�|��}|dg|j}|
�r�|�d�|jD]}|�d|��q�|D]�}
||
}|
g|j}|j�s&t||d��rpt�dtj�|�|
�rBd�pDd|
f�|�||jd|d||
g�nt� d|
��q�||S) N�.cz-c++�c++TFrr\r�z.irr�z>source %r does not define swig target, assuming %s swig targetz0expected %r but source %r defines %r swig targetzAresetting swig target to c++ (some targets may have .c extension)z$assuming that %r has c++ swig target�.cpp�	%s_wrap%sz.  source %s does not exist: skipping swig'ing.zi  target %s does not exist:
   Assuming %s_wrap.{c,cpp} was generated with "build_src --inplace" command.r�r�r�z-pythonz-Irz%s: %sz++�z-oz-outdirz+  skipping '%s' swig interface (up-to-date))!r3�remover4r�rIrDrEryr%rvr�r
r"r��get_swig_modulenamer�get_swig_targetrrGrF�_find_swig_targetrhr�r5Z	find_swigr�r�r#rrLrxZspawnr�)r8r�r�r�r�Zswig_targetsr�r�Z
target_ext�typZis_cppZ	skip_swigr�rr�rZr�Z
py_target_dirr�Ztyp2r�rr5Zswig_cmdrr�rrr r�\s�


��


�
�


��
�
�




����
zbuild_src.swig_sourcesN)�__name__�
__module__�__qualname__�descriptionZuser_optionsZboolean_optionsZhelp_optionsr9rQrSrRrXr�rYrUrVrWr�r�r�r�r�r�r�r�r�rrrr r"&s0:$(.$r"z!.*\.(f90|f95|f77|for|ftn|f|pyf)\Zz.*\.(inc|h|hpp)\ZzQ\s*%module\s*(.*\(\s*package\s*=\s*"(?P<package>[\w_]+)".*\)|)\s*(?P<name>[\w_]+)z-\*-\s*c\s*-\*-z-\*-\s*c\+\+\s*-\*-cCsRt|d��4}d}|��}t|�r$d}t|�r0d}Wd�n1sD0Y|S)Nrr�rN)r�readline�_has_cpp_header�
_has_c_header)rr$�result�linerrr r��s"r�cCsVt|d��8}d}|D]}t|�}|r|�d�}q4qWd�n1sH0Y|S)Nrr�)r�_swig_module_name_matchr)rr$r�r�rrrr r��s
$r�cCs4dD]*}tj�|d||f�}tj�|�rq0q|S)N)r�r�r�)rDrErFr�)r�r�rZrrrr r��s
r�z%\s*python\s*module\s*(?P<name>[\w_]+)z4\s*python\s*module\s*(?P<name>[\w_]*?__user__[\w_]*)cCs^d}t|��>}|D](}t|�}|rt|�r,q|�d�}q<qWd�n1sP0Y|S)Nr�)r�_f2py_module_name_match�_f2py_user_module_name_matchr)rr�r$r�rrrr r��s

$r�).�__doc__rDrrBrHr�Zdistutils.commandrZdistutils.dep_utilrrZdistutils.utilrZdistutils.errorsrrZnumpy.distutilsrrer	r
rrr
Znumpy.distutils.from_templaterr�Znumpy.distutils.conv_templater�r!r"r�I�matchr�r�r�rr�r�r�r�r�r�r�r�rrrr �<module>sJ
-�

	��

Zerion Mini Shell 1.0