https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/numpy/distutils/command/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/numpy/distutils/command/__pycache__/build_src.cpython-310.pyc
o

6��a�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��K}t|d��-}|D]"}|�|�}|r0|�|�d|�d�||�d���q|�|�qWd�n1s@wYWd�dSWd�dS1sXwYdS)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�var�fs�ft�l�m�r!�C/usr/lib/python3/dist-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��selfr!r!r"�initialize_options?s"
zbuild_src.initialize_optionscCs�|�dddd�|jdur|jj|_|jj|_|jjpg|_|jjp#g|_|jjp*g|_|j	durKdj
t�gtj
dd��R�}tj�|jd|�|_	i|_|jra|jrZt�d�n|j|_d|_|jdurjg|_nt�|j�|_|jr�|jr}t�d	�n|j|_d|_|jdur�g|_nt�|j�|_|�d
�}|jdur�|j|_|jdur�|j|_dD].}d|�d
d�}t||d�}|r�t||�r�t�d|�q�t� d||f�t!|||�q�dS)N�build)r0r0)r/r/)r%r%z	.{}-{}.{}��srcz0ignoring --f2pyflags as --f2py-opts already usedz0ignoring --swigflags as --swig-opts already usedr)r7�swig_optz--�_�-z-both build_src and build_ext define %s optionz+using "%s=%s" option from build_ext command)"�set_undefined_optionsr,�distribution�ext_package�ext_modulesr+�	librariesr-�
data_filesr$�formatr�sys�version_info�os�path�joinr0r.r2r3r�warn�shlex�splitr4r5�get_finalized_commandr'r6r�getattr�info�setattr)r:�plat_specifierr�c�o�vr!r!r"�finalize_optionsRs\�









��zbuild_src.finalize_optionscCs&t�d�|js
|js
dS|��dS)Nr$)rrSr+rF�
build_sourcesr9r!r!r"�run�s
z
build_src.runcCsn|jr
|�d�j|_|��|jD]}|j|�q|jr-|�|j�|jD]}|�|�q%|�	�|�
�dS)N�build_py)r'rQ�get_package_dir�build_py_modules_sourcesrF�build_library_sourcesr+�check_extensions_list�build_extension_sources�build_data_files_sources�build_npy_pkg_config)r:�libname_info�extr!r!r"rZ�s
�

zbuild_src.build_sourcescCsB|jsdSt�d�ddlm}g}|jD]�}t|t�r"|�|�qt|t�r�|\}}|j	r;|�
d�|�t
j���}nt
j�|j|�}dd�|D�}dd�|D�}|D]0}|jjdkr`||�}	n|�}	|	dur�t|	t�rr|�|	�qSt|	t�r}|�|	�qStt|	���qS|||f�}
|�||
f�qtt|���||jdd�<dS)	Nzbuilding data_files sourcesr)�get_data_files�.cSsg|]	}t|d�r|�qS��__call__��hasattr��.0r&r!r!r"�
<listcomp>��z6build_src.build_data_files_sources.<locals>.<listcomp>cSsg|]	}t|d�s|�qSrhrjrlr!r!r"rn�ror)rGrrS�numpy.distutils.misc_utilrf�
isinstance�str�append�tupler'r]rMrPrK�seprLr$�__code__�co_argcount�list�extend�	TypeError�repr)r:rf�new_data_files�datar�files�	build_dir�funcsr&�s�	filenamesr!r!r"rb�s<






�z"build_src.build_data_files_sourcesc
Cs�|\}}}tj�|�}|��D]\}}|||<q|jdkr%tj�||�}	n	tj�|j||�}	tj�tj�|�d�}
tj�|	|
�}tj�	|	�sLt�
|	�t|||�tj�||�}||fS)Nrr)rKrL�dirname�itemsr'rMr$�basename�splitext�exists�makedirsr#)
r:rS�gd�template�install_dir�
subst_dict�template_dir�krX�
generated_dir�	generated�generated_path�full_install_dirr!r!r"�_build_npy_pkg_config�s 


�
zbuild_src._build_npy_pkg_configcCs�t�d�t�td��}|jdks|��d}|jdkr!d}d}n
t|d�r+|j}d}|rd|j	j
��D]2\}}|j	j|}t
j�t
j�|�|�}d|i}|D]}	|�|	|�\}
}|j	j�|
|gf�qNq3dSdS)	Nz(build_src: building npy-pkg config files�installrFrgT�install_libbase�prefix)rrS�copyr
�	finalizedrYr'rkr�rC�installed_pkg_configr�r1rKrLrM�abspathr�rGrs)r:�install_cmd�
build_npkg�
top_prefix�pkg�infos�pkg_pathr�rrSr�r�r!r!r"rc�s0




���zbuild_src.build_npy_pkg_configcCs�|jsdSt�d�g}|jD]_}t|�rit|�dkri|\}}}|jr)|�|�}ntj�	|j
tjj	|�d���}t|d�rJtj�	||d�}||�}|durOq|||fg}||j
vr_g|j
|<|j
||7<q|�|�q||jdd�<dS)Nzbuilding py_modules sources�rgri�.py)r-rrSr�lenr'r]rKrLrMr$rPrkr.rs)r:�new_py_modulesrr,�module_baserr�modulesr!r!r"r^�s.



�


z"build_src.build_py_modules_sourcescCstt|�dg��}|sdSt�d|�|�|||f�}|�|||f�}|�|�\}}|r4t�d|j|�||d<dS)N�sourceszbuilding library "%s" sources�#%s - nothing done with h_files = %s)rx�getrrS�generate_sources�template_sources�filter_h_filesr,)r:�lib_name�
build_infor��h_filesr!r!r"r_s�zbuild_src.build_library_sourcescCs$t|j�}t�d|j�|�|j�}|�d�}d�|dd��}|jr*|�	|�|_
|�||�}|�||�}|�
||�}|�||�}|�||�}|�|�\}}||jvrYg|j|<g}|D]}tj�tj�|��d}	|�||	|f�q]|j||7<|�|�\}}
|
r�t�d||
�||_dS)Nzbuilding extension "%s" sourcesrgr���r�)rxr�rrS�name�get_ext_fullnamerPrMr'r]�ext_target_dirr�r��swig_sources�f2py_sources�
pyrex_sources�filter_py_filesr.rKrLr�r�rsr�)r:rer��fullname�modpathr,�py_filesr�r&�moduler�r!r!r"ra0s4



�
z!build_src.build_extension_sourcescCsg}g}|D]}t|�r|�|�q|�|�q|s|S|jr't|�s'|j}nt|�r0|d}n|j}tjj|j	g|�
d�dd��}|�|�|jrPt
j}nt
j}t
�|�}	|D](}
|
||�}|sdqZt|�rudd�|D�|�|�qZt
�d|f�|�|�qZt
�|	�|S)Nrrgr�cSsg|]
}t�d|f��qS)�  adding '%s' to sources.)rrS)rmr�r!r!r"rn~sz.build_src.generate_sources.<locals>.<listcomp>r�)rrsr'rr�r�rKrLrMr$rP�mkpathr8r�INFO�WARN�
set_thresholdryrS)r:r��	extension�new_sources�func_sourcesrrr��	new_level�	old_level�funcr!r!r"r�Xs@
�



zbuild_src.generate_sourcescCs|�|dg�S)Nr���filter_files�r:r�r!r!r"r��szbuild_src.filter_py_filescCs|�|gd��S)N)z.hz.hppz.incr�r�r!r!r"r��szbuild_src.filter_h_filescCsHg}g}|D]}tj�|�\}}||vr|�|�q|�|�q||fSr*)rKrLr�rs)r:r��extsr�r~r�baserer!r!r"r��szbuild_src.filter_filesc	Csng}t|�r|d�d�}|d�d�}n|j}|j}|D]�}tj�|�\}}|dkr�|jr5tj�|�}	n
t	|j
tj�|��}	|�|	�tj�|	tj�
|��}
|jsZt|g||
�r�t|�rjt�d|
�t|�}nt�d|
�t|�}t|
d��
}|�|�Wd�n1s�wYt|
�r�tj�|
�}
|
|vr�t�d|
�|�|
�|�|
�q|�|�q|S)	Nr�depends�include_dirsz.srczfrom_template:> %szconv_template:> %sr�  adding '%s' to include_dirs.)rr�r�r�rKrLr�r'r�r
r$r�rMr�r%r�_f_pyf_ext_matchrrS�process_f_file�process_c_filerr�_header_ext_matchrs)r:r�r�r�r�r�rr�re�
target_dir�target_file�outstr�fidrr!r!r"r��s>

�
zbuild_src.template_sourcesc	Cs`g}|j�d�d}|D]!}tj�|�\}}|dkr(|�||||�}|�|�q|�|�q|S)z@Pyrex not supported; this remains for Cython support (see below)rgr�z.pyx)r�rPrKrLr��generate_a_pyrex_sourcers)	r:r�r�r��ext_namerr�rer�r!r!r"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!)r:r�r�rr�r!r!r"r��sz!build_src.generate_a_pyrex_sourcecCs�g}g}g}i}g}|j�d�d}d}	|D]�}
tj�|
�\}}|dkr�|jr.tj�|�}
n
t|jtj�|��}
tj�	|
�rYt
|
�}||krOtd|
||f��tj�|
|d�}nFt
�d|
�|}d}	tj�|
|d�}tj�	|�s�t
�d	||f�tj�|�}
tj�|
|d�}tj�	|�s�td
|f��t
�d|�|�|
�|�|
�|||
<|�|�qt|�r�|�|
�q|�|
�q|s�|s�|S|D]}|�|�q�|j|j}|jjr�|jjD]\}}||jvr�|�|�dg��q�t
�d
|�|�rPt|�dk�rtd|f��|d}
||
}tj�|��pd}
|
g|j}|j�s.t||d��rH|	�sHt
�d|
�ddl}|j� |d|
|
g�npt
�d|
�nht!|��rZ|d}n|j}tjj|jg|�d�dd��}
tj�|
|d�}|�|�||j}|j�s�t||d��r�|	�s�t
�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%||��s&t%||��r;|�tj�|��|�&||�|�&||�ntj�	|��sJtd|f��tj�	|��sXtd|f��dD]}tj�|
||�}tj�	|��rxt
�d|�|�|��qZ||S) Nrgr�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�rPrKrLr�r'r�r
r$�isfile�get_f2py_modulenamerrMr�debugrNrSrsr	r�r�r3rCrFryr�r�r�r%r�
numpy.f2py�f2py�run_mainrrr��__file__r�	copy_file)r:r�r�r�r��	f_sources�f2py_targets�target_dirsr��	skip_f2pyrr�rer�r�r�rr�r�r��numpyr�target_c�target_h�source_c�source_h�name_ext�filenamer!r!r"r��s�����


�����

�

�

����
�
�zbuild_src.f2py_sourcesc	Cs�g}g}i}g}g}d}d|jvrd}	d}
|j�d�n|jr$d}	d}
nd}	d}
d}|j�d�d}|D�]}
tj�|
�\}}|d	k�r2|jrQtj�	|�}|j
}nt|jtj�	|��}|}tj�
|
�r�t|
�}||d
d�kr|td|
||d
d�f��|	dur�t|
�}	|	dk}
n3t|
�}|dur�t�d|
|	f�n!|	|kr�t�d
|	|
|f�|dkr�t�d�d}
nt�d|
�|
r�d}tj�|d||f�}nDt�d|
�|d
d�}d
}t||�}tj�
|��st�d||f�tj�	|�}t||�}tj�
|��s	td|f��t�d|�|�|�|�|�|�tj�||d��|�|
�|d||
<q4|�|
�q4|�s=|S|�rD||S|D]}|�|��qF|j�pV|��}|dg|j}|
�rf|�d�|jD]
}|�d|��qi|D]E}
||
}|
g|j}|j�s�t||d��r�t�dtj�|�|
�r�d�p�d|
f�|�||jd|d||
g��qvt� d|
��qv||S) N�.cz-c++�c++TFrrgr�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))!r5�remover6r�rPrKrLr�r'r�r�r
r$r��get_swig_modulenamer�get_swig_targetrrNrM�_find_swig_targetrsr�r7�	find_swigr�r�r%rrSr��spawnr�)r:r�r�r�r��swig_targetsr�r��
target_ext�typ�is_cpp�	skip_swigr�rr�rer��
py_target_dirr��typ2r�rr7�swig_cmdrr�r!r!r"r�\s�


��
��

��
�
�




��
�
�zbuild_src.swig_sourcesN)�__name__�
__module__�__qualname__�description�user_options�boolean_options�help_optionsr;rYr[rZrbr�rcr^r_rar�r�r�r�r�r�r�r�r�r!r!r!r"r$&s2:$(.$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*-\*-cCsdt|d��#}d}|��}t|�rd}t|�r d}Wd�|SWd�|S1s+wY|S)Nrr�rV)r�readline�_has_cpp_header�
_has_c_header)rr&�result�liner!r!r"r��s
��
��r�cCsht|d��%}d}|D]}t|�}|r|�d�}n	q
Wd�|SWd�|S1s-wY|S)Nrr�)r�_swig_module_name_matchr)rr&r�rr r!r!r"r��s 
��
��
��r�cCs6dD]}tj�|d||f�}tj�|�r|Sq|S)N)r�r�r�)rKrLrMr�)r�r�rerr!r!r"r��s�r�z%\s*python\s*module\s*(?P<name>[\w_]+)z4\s*python\s*module\s*(?P<name>[\w_]*?__user__[\w_]*)cCspd}t|��(}|D]}t|�}|rt|�rq	|�d�}n	q	Wd�|SWd�|S1s1wY|S)Nr�)r�_f2py_module_name_match�_f2py_user_module_name_matchr)rr�r&rr r!r!r"r��s$

��
��
��r�).�__doc__rKrrIrOr��distutils.commandr�distutils.dep_utilrr�distutils.utilr�distutils.errorsrr�numpy.distutilsrrpr	r
rrr
�numpy.distutils.from_templaterr��numpy.distutils.conv_templater�r#r$r�I�matchr�r�rrrrr�r�r�rrr�r!r!r!r"�<module>sX
-��

	����

https://t.me/RX1948 - 2025