Current Dir: /snap/core22/2437/usr/lib/python3/dist-packages/setuptools/_distutils/command/__pycache__/

[FILE] bdist.cpython-310.pyc [ edit | delete | rename ]
[FILE] bdist_dumb.cpython-310.pyc [ edit | delete | rename ]
[FILE] bdist_msi.cpython-310.pyc [ edit | delete | rename ]
[FILE] bdist_rpm.cpython-310.pyc [ edit | delete | rename ]
[FILE] bdist_wininst.cpython-310.pyc [ edit | delete | rename ]
[FILE] build.cpython-310.pyc [ edit | delete | rename ]
[FILE] build_clib.cpython-310.pyc [ edit | delete | rename ]
[FILE] build_ext.cpython-310.pyc [ edit | delete | rename ]
[FILE] build_py.cpython-310.pyc [ edit | delete | rename ]
[FILE] build_scripts.cpython-310.pyc [ edit | delete | rename ]
[FILE] check.cpython-310.pyc [ edit | delete | rename ]
[FILE] clean.cpython-310.pyc [ edit | delete | rename ]
[FILE] config.cpython-310.pyc [ edit | delete | rename ]
[FILE] install.cpython-310.pyc [ edit | delete | rename ]
[FILE] install_data.cpython-310.pyc [ edit | delete | rename ]
[FILE] install_egg_info.cpython-310.pyc [ edit | delete | rename ]
[FILE] install_headers.cpython-310.pyc [ edit | delete | rename ]
[FILE] install_lib.cpython-310.pyc [ edit | delete | rename ]
[FILE] install_scripts.cpython-310.pyc [ edit | delete | rename ]
[FILE] py37compat.cpython-310.pyc [ edit | delete | rename ]
[FILE] register.cpython-310.pyc [ edit | delete | rename ]
[FILE] sdist.cpython-310.pyc [ edit | delete | rename ]
[FILE] upload.cpython-310.pyc [ edit | delete | rename ]
[FILE] __init__.cpython-310.pyc [ edit | delete | rename ]

Viewing: /snap/core22/2437/usr/lib/python3/dist-packages/setuptools/_distutils/command/__pycache__/build_ext.cpython-310.pyc

o

�_�a|{�@s�dZddlZddlZddlZddlZddlmZddlTddlm	Z	m
Z
ddlmZddlm
Z
ddlmZdd	lmZdd
lmZddlmZdd
lmZe�d�Zdd�ZGdd�de�ZdS)z�distutils.command.build_ext

Implements the Distutils 'build_ext' command, for building extension
modules (currently limited to C extensions, should accommodate C++
extensions ASAP).�N)�Command)�*)�customize_compiler�get_python_version)�get_config_h_filename)�newer_group)�	Extension)�get_platform)�log�)�
py37compat)�	USER_BASEz3^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$cCsddlm}|�dS)Nr��show_compilers)�distutils.ccompilerrr�r�I/usr/lib/python3/dist-packages/setuptools/_distutils/command/build_ext.pyrs
rc@seZdZdZdejZddddde�fdd	d
defdd
ddddefddddddddddgZgd�Z	ddde
fgZd d!�Zd"d#�Z
d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zejd2d3��Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Zd@dA�ZdBdC�ZdS)D�	build_extz8build C/C++ extensions (compile/link to build directory)z (separated by '%s'))z
build-lib=�bz(directory for compiled extension modules)zbuild-temp=�tz1directory for temporary files (build by-products)z
plat-name=�pz>platform name to cross-compile for, if supported (default: %s))�inplace�iziignore build-lib and put compiled extensions into the source directory alongside your pure Python modulesz
include-dirs=�Iz.list of directories to search for header files)zdefine=�DzC preprocessor macros to define)zundef=�Uz!C preprocessor macros to undefine)z
libraries=�lz!external C libraries to link withz
library-dirs=�Lz.directories to search for external C libraries)zrpath=�Rz7directories to search for shared C libraries at runtime)z
link-objects=�Oz2extra explicit link objects to include in the link)�debug�gz'compile/link with debugging information)�force�fz2forcibly build everything (ignore file timestamps))z	compiler=�czspecify the compiler type)z	parallel=�jznumber of parallel build jobs)�swig-cppNz)make SWIG create C++ files (default is C))z
swig-opts=Nz!list of SWIG command line options)zswig=Nzpath to the SWIG executable)�userNz#add user include, library and rpath)rr r"r&r'z
help-compilerNzlist available compilerscCs�d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_dS)Nr)�
extensions�	build_lib�	plat_name�
build_tempr�package�include_dirs�define�undef�	libraries�library_dirs�rpath�link_objectsr r"�compiler�swig�swig_cpp�	swig_optsr'�parallel��selfrrr�initialize_optionsks*
zbuild_ext.initialize_optionsc	
Cs�ddlm}|�ddddddd	d
�|jdur|jj|_|jj|_|��}|jdd�}|j	dur7|jj	p5g|_	t
|j	t�rE|j	�t
j�|_	tjtjkrW|j	�t
j�tjd
��|j	�|�t
jj��||krq|j	�|�t
jj��|�d�|�d�|jdur�g|_|jdur�g|_nt
|jt�r�|j�t
j�|_|jdur�g|_nt
|jt�r�|j�t
j�|_t
jdk�r%|j�t
j�tjd��tjtjkr�|j�t
j�tjd��|jr�t
j�|jd�|_n	t
j�|jd�|_|j	�t
j�t���|j�tj�|j dk�rd}n|j dd�}t
j�tjd�}|�rt
j�||�}|j�|�tj!dd�dk�rK|j"�sE|j�t
j�tjddt#�d��n|j�d�|�$d��re|j"�s_|j�|�$d��n|j�d�|j%�rw|j%�d�}d d!�|D�|_%|j&�r�|j&�d�|_&|j'du�r�g|_'n|j'�d"�|_'|j(�r�t
j�t)d
�}t
j�t)d�}t
j�*|��r�|j	�|�t
j�*|��r�|j�|�|j�|�t
|j+t��r�z	t,|j+�|_+WdSt-�y�t.d#��wdS)$Nr)�	sysconfig�build)r)r))r+r+)r4r4)r r )r"r")r8r8)r*r*r)�
plat_specific�includer0r3�nt�libs�Debug�Release�win32��PCbuild��cygwin�lib�python�config�.�Py_ENABLE_SHARED�LIBDIR�,cSsg|]}|df�qS)�1r)�.0�symbolrrr�
<listcomp>�sz.build_ext.finalize_options.<locals>.<listcomp>� zparallel should be an integer)/�	distutilsr<�set_undefined_optionsr,�distribution�ext_package�ext_modulesr(�get_python_incr-�
isinstance�str�split�os�pathsep�sys�exec_prefix�base_exec_prefix�append�path�join�extend�ensure_string_listr0r1r2�name�prefixr r+�dirnamerr*�platform�python_buildr�get_config_varr.r/r7r'r
�isdirr8�int�
ValueError�DistutilsOptionError)	r:r<�
py_include�plat_py_include�suffix�new_lib�defines�user_include�user_librrr�finalize_options�s��




�




���zbuild_ext.finalize_optionscCsbddlm}|jsdS|j��r&|�d�}|j�|��pg�|j	�
|j�||j|j
|j|jd�|_t|j�tjdkrJ|jt�krJ|j�|j�|jdurV|j�|j�|jdurj|jD]\}}|j�||�q^|jdur{|jD]}|j�|�qr|jdur�|j�|j�|j	dur�|j�|j	�|jdur�|j�|j�|j dur�|j�!|j �|�"�dS)Nr)�new_compiler�
build_clib)r4�verbose�dry_runr"r@)#rrzr(rW�has_c_libraries�get_finalized_commandr0rf�get_library_namesr1rcr{r4r|r}r"rr^rhr*r	�
initializer-�set_include_dirsr.�define_macror/�undefine_macro�
set_libraries�set_library_dirsr2�set_runtime_library_dirsr3�set_link_objects�build_extensions)r:rzr{rh�value�macrorrr�runs@

�








z
build_ext.runc
Csht|t�s	td��t|�D]�\}}t|t�rq
t|t�r"t|�dkr&td��|\}}t�d|�t|t	�r:t
�|�s>td��t|t�sGtd��t||d�}dD]}|�
|�}|d	urat|||�qP|�
d
�|_d|vrqt�d�|�
d
�}|r�g|_g|_|D],}	t|	t�r�t|	�dvs�td��t|	�dkr�|j�|	d�q�t|	�dkr�|j�|	�q�|||<q
d	S)a�Ensure that the list of extensions (presumably provided as a
        command option 'extensions') is valid, i.e. it is a list of
        Extension objects.  We also support the old-style list of 2-tuples,
        where the tuples are (ext_name, build_info), which are converted to
        Extension instances here.

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        z:'ext_modules' option must be a list of Extension instances�zMeach element of 'ext_modules' option must be an Extension instance or 2-tuplezvold-style (ext_name, build_info) tuple found in ext_modules for extension '%s' -- please convert to Extension instancezRfirst element of each tuple in 'ext_modules' must be the extension name (a string)zOsecond element of each tuple in 'ext_modules' must be a dictionary (build info)�sources)r-r1r0�
extra_objects�extra_compile_args�extra_link_argsNr2�def_filez9'def_file' element of build info dict no longer supported�macros)rr�z9'macros' element of build info dict must be 1- or 2-tuplerr)r[�list�DistutilsSetupError�	enumerater�tuple�lenr
�warnr\�extension_name_re�match�dict�get�setattr�runtime_library_dirs�
define_macros�undef_macrosrc)
r:r(r�ext�ext_name�
build_info�key�valr�r�rrr�check_extensions_listUsd

�
��
��
�
�

��
�zbuild_ext.check_extensions_listcCs,|�|j�g}|jD]}|�|j�q|S�N)r�r(rfr�)r:�	filenamesr�rrr�get_source_files�s

zbuild_ext.get_source_filescCs2|�|j�g}|jD]}|�|�|j��q|Sr�)r�r(rc�get_ext_fullpathrh)r:�outputsr�rrr�get_outputs�s

zbuild_ext.get_outputscCs*|�|j�|jr|��dS|��dSr�)r�r(r8�_build_extensions_parallel�_build_extensions_serialr9rrrr��szbuild_ext.build_extensionsc
s��j}�jdurt��}zddlm}Wntyd}Ynw|dur*���dS||d��8���fdd��jD�}t�j|�D]\}}��	|��|�
�Wd�n1sYwYqAWd�dS1sjwYdS)NTr)�ThreadPoolExecutor)�max_workerscsg|]	}���j|��qSr)�submit�build_extension)rQr���executorr:rrrS�s�z8build_ext._build_extensions_parallel.<locals>.<listcomp>)r8r^�	cpu_count�concurrent.futuresr��ImportErrorr�r(�zip�_filter_build_errors�result)r:�workersr��futuresr��futrr�rr��s,
��
���"�z$build_ext._build_extensions_parallelc	CsD|jD]}|�|��
|�|�Wd�n1swYqdSr�)r(r�r�)r:r�rrrr��s
���z"build_ext._build_extensions_serialc
csX�zdVWdStttfy+}z|js�|�d|j|f�WYd}~dSd}~ww)Nz"building extension "%s" failed: %s)�CCompilerError�DistutilsError�CompileError�optionalr�rh)r:r��errrr��s����zbuild_ext._filter_build_errorsc
CsL|j}|dust|ttf�std|j��t|�}|�|j�}||j}|j	s6t
||d�s6t�d|j�dSt�
d|j�|�||�}|jpGg}|jdd�}|jD]}|�|f�qR|jj||j||j|j||jd�}|dd�|_|jr||�|j�|jp�g}|jp�|j�|�}	|jj|||�|�|j|j ||�!|�|j|j|	d�
dS)Nzjin 'ext_modules' option (extension '%s'), 'sources' must be present and must be a list of source filenames�newerz$skipping '%s' extension (up-to-date)zbuilding '%s' extension)�
output_dirr�r-r �extra_postargs�depends)r0r1r�r��export_symbolsr r+�target_lang)"r�r[r�r�r�rh�sortedr�r�r"rr
r �info�swig_sourcesr�r�r�rcr4�compiler+r-�_built_objectsr�rfr��language�detect_language�link_shared_object�
get_librariesr1r��get_export_symbols)
r:r�r��ext_pathr��
extra_argsr�r/�objectsr�rrrr��sV��


�


�zbuild_ext.build_extensioncCs$g}g}i}|jrt�d�|jsd|jvsd|jvrd}nd}|D](}tj�|�\}}	|	dkrE|�|d|�|�|�|d||<q"|�|�q"|sO|S|jpU|�	�}
|
dg}|�
|j�|jrh|�d�|jsv|jD]}|�|�qn|D]}||}
t�d	||
�|�|d
|
|g�qx|S)z�Walk the list of source files in 'sources', looking for SWIG
        interface (.i) files.  Run SWIG on all that are found, and
        return a modified 'sources' list with SWIG source files replaced
        by the generated C (or C++) files.
        z/--swig-cpp is deprecated - use --swig-opts=-c++z-c++z.cppz.cz.i�_wrap���z-pythonzswigging %s to %sz-o)
r6r
r�r7r^rd�splitextrcr5�	find_swigrfr��spawn)r:r��	extension�new_sourcesr��swig_targets�
target_ext�source�baser�r5�swig_cmd�o�targetrrrr�1s>




zbuild_ext.swig_sourcescCsZtjdkrdStjdkr&dD]}tj�d|d�}tj�|�r#|SqdStdtj��)z�Return the name of the SWIG executable.  On Unix, this is
        just "swig" -- it should be in the PATH.  Tries a bit harder on
        Windows.
        �posixr5r@)z1.3z1.2z1.1z	c:\swig%szswig.exez>I don't know how to find (much less run) SWIG on platform '%s')r^rhrdre�isfile�DistutilsPlatformError)r:�vers�fnrrrr�gs

���zbuild_ext.find_swigcCs�|�|�}|�d�}|�|d�}|js)tjj|dd�|g�}tj�|j|�Sd�|dd��}|�d�}tj�	|�
|��}tj�||�S)z�Returns the path of the filename for a given extension.

        The file is located in `build_lib` or directly in the package
        (inplace option).
        rLr�Nr�build_py)�get_ext_fullnamer]�get_ext_filenamerr^rdrer)r�abspath�get_package_dir)r:r��fullname�modpath�filenamer,r��package_dirrrrr�s


zbuild_ext.get_ext_fullpathcCs|jdur|S|jd|S)zSReturns the fullname of a given extension name.

        Adds the `package.` prefixNrL)r,)r:r�rrrr��s
zbuild_ext.get_ext_fullnamecCs.ddlm}|�d�}|d�}tjj|�|S)z�Convert the name of an extension (eg. "foo.bar") into the name
        of the file from which it will be loaded (eg. "foo/bar.so", or
        "foo\bar.pyd").
        r�rmrL�
EXT_SUFFIX)�distutils.sysconfigrmr]r^rdre)r:r�rmr��
ext_suffixrrrr��s
zbuild_ext.get_ext_filenamecCsz|j�d�d}z|�d�Wnty&d|�d��dd��d�}Ynwd|}d	|}||jvr:|j�|�|jS)
aReturn the list of symbols that a shared extension has to
        export.  This either uses 'ext.export_symbols' or, if it's not
        provided, "PyInit_" + module_name.  Only relevant on Windows, where
        the .pyd file (DLL) must export the module "PyInit_" function.
        rLr��ascii�U_�punycode�-�_�_�PyInit)rhr]�encode�UnicodeEncodeError�replace�decoder�rc)r:r�rhrt�
initfunc_namerrrr��s �
zbuild_ext.get_export_symbolscCs�tjdkr/ddlm}t|j|�s.d}|jr|d}|tjd?tjd?d@f}|j|gSn@dd	l	m
}d
}|d�rattd�rCd
}ntjdkrKd
}ndtj
vra|d�dkrYd
}n|d�dkrad
}|ro|d�}|jd|gS|jt��S)z�Return the list of libraries to link against when building a
        shared extension.  On most platforms, this is just 'ext.libraries';
        on Windows, we add the Python library (eg. python20.dll).
        rDr)�MSVCCompilerz
python%d%d�_d���r�FrM�getandroidapilevelTrH�_PYTHON_HOST_PLATFORM�ANDROID_API_LEVEL�MACHDEP�	LDVERSIONrJ)r`rk�distutils._msvccompilerrr[r4r �
hexversionr0r�rm�hasattrr^�environr�	pythonlib)r:r�r�templaterrm�link_libpython�	ldversionrrrr��s6

��


zbuild_ext.get_libraries) �__name__�
__module__�__qualname__�descriptionr^r_�sep_byr	�user_options�boolean_optionsr�help_optionsr;ryr�r�r�r�r�r�r��
contextlib�contextmanagerr�r�r�r�r�r�r�r�r�rrrrr"sp
�����+��@N	
	L6	
r)�__doc__rr^�rer`�distutils.corer�distutils.errorsr�rrr�distutils.dep_utilr�distutils.extensionr�distutils.utilr	rUr
�r�siter
r�r�rrrrrr�<module>s(�
Upload File: