HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/setuptools/command/__pycache__/build_py.cpython-37.pyc
B

N��g�:�@s�ddlmZddlmZddlmZddlmmZddl	Z	ddl
Z
ddlZddlZddl
ZddlZddlZddlmZddlmZmZmZmZmZmZddlmZdd	lmZd
d�ZGdd
�d
ej�Zdd�ZGdd�d�Z dS)�)�partial)�glob)�convert_pathN)�Path)�Dict�Iterable�Iterator�List�Optional�Tuple�)�unique_everseen)�SetuptoolsDeprecationWarningcCst�|t�|�jtjB�dS)N)�os�chmod�stat�st_mode�S_IWRITE)�target�r�?/tmp/pip-unpacked-wheel-yrlplx0q/setuptools/command/build_py.py�
make_writablesrcs@eZdZUdZdZeed<dZee	ed<dd�Z
d5�fd	d
�	Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd6ee	d��fdd�
Zee	e	fd�dd�Zeee	e	fd�dd�Zeee	e	fd�d d!�Zd"d#�Zd$d%�Zee	e	ee	d&�d'd(�Zd)d*�Zd+d,�Z d-d.�Z!d/d0�Z"d1d2�Z#e$d3d4��Z%�Z&S)7�build_pyaXEnhanced 'build_py' command that includes data files with packages

    The data files are specified via a 'package_data' argument to 'setup()'.
    See 'setuptools.dist.Distribution' for more details.

    Also, this version of the 'build_py' command allows you to specify both
    'py_modules' and 'packages' in the same setup operation.
    F�
editable_modeN�existing_egg_info_dircCs@tj�|�|jj|_|jjp i|_d|jkr6|jd=g|_dS)N�
data_files)�origr�finalize_options�distribution�package_data�exclude_package_data�__dict__�_build_py__updated_files)�selfrrrr#s

zbuild_py.finalize_options�cs:|r$tt|����}tt|����}t��||||||�S)N)�strr�resolve�super�	copy_file)r#�infile�outfile�
preserve_mode�preserve_times�link�level)�	__class__rrr(+s
zbuild_py.copy_filecCsT|js|jr|jrdS|jr$|��|jr:|��|��|�tjj	|dd��dS)z?Build modules, packages, and copy data files to build directoryNr)�include_bytecode)
�
py_modules�packagesrZ
build_modulesZbuild_packages�build_package_data�byte_compilerr�get_outputs)r#rrr�run4szbuild_py.runcCs&|dkr|��|_|jStj�||�S)zlazily compute data filesr)�_get_data_filesrrr�__getattr__)r#�attrrrrr8Ds
zbuild_py.__getattr__cCs.tj�||||�\}}|r&|j�|�||fS)N)rr�build_moduler"�append)r#�module�module_file�packager*�copiedrrrr:Kszbuild_py.build_modulecCs|��tt|j|jpd��S)z?Generate list of '(package,src_dir,build_dir,filenames)' tuplesr)�analyze_manifest�list�map�_get_pkg_data_filesr2)r#rrrr7Qszbuild_py._get_data_filescCs$|j�di�tt|j|jpd��S)z�
        Generate list of ``(package,src_dir,build_dir,filenames)`` tuples,
        but without triggering any attempt to analyze or build the manifest.
        �manifest_filesr)r!�
setdefaultrArBrCr2)r#rrr�get_data_files_without_manifestVsz(build_py.get_data_files_without_manifestcsJ|�|��tjj|jg|�d��}�fdd�|�|��D�}|�||fS)N�.csg|]}tj�|���qSr)r�path�relpath)�.0�file)�src_dirrr�
<listcomp>isz0build_py._get_pkg_data_files.<locals>.<listcomp>)�get_package_dirrrH�join�	build_lib�split�find_data_files)r#r>�	build_dir�	filenamesr)rLrrC`s


zbuild_py._get_pkg_data_filescCs`|�|j||�}tttdd�|�}tj�|�}tt	j
j|�}t�|j�
|g�|�}|�|||�S)z6Return filenames for package's data files in 'src_dir'T)�	recursive)�_get_platform_patternsrrBrr�	itertools�chain�
from_iterable�filterrrH�isfilerD�get�exclude_data_files)r#r>rL�patternsZglobs_expandedZ
globs_matchesZ
glob_files�filesrrrrRnszbuild_py.find_data_files)�returncs"|jrt|�����St��|�S)z1See :class:`setuptools.commands.build.SubCommand`)rrA�get_output_mapping�keysr'r5)r#r0)r/rrr5szbuild_py.get_outputscCs(t�|��|���}tt|dd�d��S)z1See :class:`setuptools.commands.build.SubCommand`cSs|dS)Nrr)�xrrr�<lambda>��z-build_py.get_output_mapping.<locals>.<lambda>)�key)rWrX� _get_package_data_output_mapping�_get_module_mapping�dict�sorted)r#�mappingrrrra�s
zbuild_py.get_output_mappingccs@x:|��D].\}}}|�d�}|�|j||�}||fVq
WdS)z5Iterate over all modules producing (dest, src) pairs.rGN)Zfind_all_modulesrQZget_module_outfilerP)r#r>r<r=�filenamerrrrh�s
zbuild_py._get_module_mappingccsPxJ|jD]@\}}}}x2|D]*}tj�||�}tj�||�}||fVqWqWdS)z6Iterate over package data producing (dest, src) pairs.N)rrrHrO)r#r>rLrSrTrlr�srcfilerrrrg�s

z)build_py._get_package_data_output_mappingcCsDx>|��D]2\}}|�tj�|��|�||�\}}t|�q
WdS)z$Copy data files into build directoryN)rg�mkpathrrH�dirnamer(r)r#rrmZ_outfZ_copiedrrrr3�szbuild_py.build_package_datacCsvi|_}|jjsdSi}x$|jp$dD]}||t|�|��<q&Wt|dd�r~t|jd��	�r~|j}t|d�}|j
dd���}n"|�d�|�
d�}|j}|jj}t�}x�|�||�D]�}	tj�t|	��\}
}d}|}
x@|
�r|
|k�r|
|k�r|
}tj�|
�\}
}tj�||�}q�W|
|kr�||
k�r8|�|��rXq�n |�||
|�}|�rX|�|�|�||
g��|	�q�WdS)NrrzSOURCES.txtzutf-8)�encoding�egg_info)rDrZinclude_package_datar2�assert_relativerN�getattrrr�exists�	read_text�
splitlines�run_command�get_finalized_commandrq�filelistr_�_IncludePackageDataAbuse�_filter_build_filesrrHrQrO�	is_module�importable_subpackage�warnrEr;)r#ZmfZsrc_dirsr>�egg_info_dir�manifestr_Zei_cmd�checkrH�d�f�prevZoldfZdf�
importablerrrr@�s@





zbuild_py.analyze_manifest)r_rqr`c#sp|�d�}||j|j|jf}dd�|D�}x@|D]8}tj�|��tj�|�rbt�fdd�|D��r0|Vq0WdS)a}
        ``build_meta`` may try to create egg_info outside of the project directory,
        and this can be problematic for certain plugins (reported in issue #3500).

        Extensions might also include between their sources files created on the
        ``build_lib`` and ``build_temp`` directories.

        This function should filter this case of invalid files out.
        �buildcSsg|]}|rtj�|��qSr)rrH�normpath)rJ�prrrrM�sz0build_py._filter_build_files.<locals>.<listcomp>c3s|]}|�kVqdS)Nr)rJr�)�	norm_pathrr�	<genexpr>�sz/build_py._filter_build_files.<locals>.<genexpr>N)	rxrP�
build_temp�
build_baserrHr��isabs�all)r#r_rqr�Z
build_dirsZ	norm_dirsrKr)r�rr{�s


"zbuild_py._filter_build_filescCsdS)Nr)r#rrr�get_data_files�szbuild_py.get_data_filesc	Cs�y
|j|Stk
rYnXtj�|||�}||j|<|rF|jjsJ|Sx,|jjD]}||ksn|�|d�rTPqTW|St�	|d��}|�
�}WdQRXd|kr�tj�
d|f��|S)z8Check namespace packages' __init__ for declare_namespacerG�rbNsdeclare_namespacez�Namespace package problem: %s is a namespace package, but its
__init__.py does not call declare_namespace()! Please fix it.
(See the setuptools manual under "Namespace Packages" for details.)
")�packages_checked�KeyErrorrr�
check_packagerZnamespace_packages�
startswith�io�open�read�	distutils�errors�DistutilsError)r#r>�package_dirZinit_py�pkgr��contentsrrrr��s&


zbuild_py.check_packagecCs"i|_tj�|�d|_d|_dS)NF)r�rr�initialize_optionsrr)r#rrrr�szbuild_py.initialize_optionscCs0tj�||�}|jjdk	r,tj�|jj|�S|S)N)rrrNrZsrc_rootrrHrO)r#r>�resrrrrNszbuild_py.get_package_dircs\t���|�|j||�}�fdd�|D�}tj�|�}t|���fdd��D�}tt|��S)z6Filter filenames for package's data files in 'src_dir'c3s|]}t��|�VqdS)N)�fnmatchrZ)rJ�pattern)r_rrr�sz.build_py.exclude_data_files.<locals>.<genexpr>c3s|]}|�kr|VqdS)Nr)rJ�fn)�badrrr�s)rArVr rWrXrY�setr
)r#r>rLr_r^Zmatch_groups�matchesZkeepersr)r�r_rr]szbuild_py.exclude_data_filescs.t�|�dg�|�|g��}�fdd�|D�S)z�
        yield platform-specific path patterns (suitable for glob
        or fn_match) from a glob-based spec (such as
        self.package_data or self.exclude_package_data)
        matching package in src_dir.
        �c3s |]}tj��t|��VqdS)N)rrHrOr)rJr�)rLrrr�*sz2build_py._get_platform_patterns.<locals>.<genexpr>)rWrXr\)�specr>rLZraw_patternsr)rLrrVs


zbuild_py._get_platform_patterns)r$r$Nr$)r$)'�__name__�
__module__�__qualname__�__doc__r�bool�__annotations__rr
r%rr(r6r8r:r7rFrCrRr	r5rrarrrhrgr3r@rr{r�r�r�rNr]�staticmethodrV�
__classcell__rr)r/rrs4

)rcCs:tj�|�s|Sddlm}t�d���|}||��dS)Nr)�DistutilsSetupErrorz�
        Error: setup script specifies an absolute path:

            %s

        setup() arguments must *always* be /-separated paths relative to the
        setup.py directory, *never* absolute paths.
        )rrHr��distutils.errorsr��textwrap�dedent�lstrip)rHr��msgrrrrr/srrc@s@eZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
d�Z	dS)
rzz>Inform users that package or module is included as 'data file'c@seZdZdZdZdS)z!_IncludePackageDataAbuse._WarningzU
        Package {importable!r} is absent from the `packages` configuration.
        a|
        ############################
        # Package would be ignored #
        ############################
        Python recognizes {importable!r} as an importable package[^1],
        but it is absent from setuptools' `packages` configuration.

        This leads to an ambiguous overall configuration. If you want to distribute this
        package, please make sure that {importable!r} is explicitly added
        to the `packages` configuration field.

        Alternatively, you can also rely on setuptools' discovery methods
        (for example by using `find_namespace_packages(...)`/`find_namespace:`
        instead of `find_packages(...)`/`find:`).

        You can read more about "package discovery" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

        If you don't want {importable!r} to be distributed and are
        already explicitly excluding {importable!r} via
        `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
        you can try to use `exclude_package_data`, or `include-package-data=False` in
        combination with a more fine grained `package-data` configuration.

        You can read more about "package data files" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


        [^1]: For Python, any directory (with suitable naming) can be imported,
              even if it does not contain any `.py` files.
              On the other hand, currently there is no concept of package data
              directory, all directories are treated like packages.
        N)r�r�r�Z_SUMMARYZ_DETAILSrrrr�_WarningGs$r�cCst�|_dS)N)r��_already_warned)r#rrr�__init__rsz!_IncludePackageDataAbuse.__init__cCs |�d�o|dtd����S)Nz.py)�endswith�len�isidentifier)r#rKrrrr|usz"_IncludePackageDataAbuse.is_modulecCs6t|�j}tt�tj|j��}|r2d�|f|��SdS)NrG)	r�parentrArW�	takewhiler%r��partsrO)r#r�rKr�r�rrrr}xs

z._IncludePackageDataAbuse.importable_subpackagecCs(||jkr$|jj|d�|j�|�dS)N)r�)r�r��emit�add)r#r�rrrr~s
z_IncludePackageDataAbuse.warnN)
r�r�r�r�rr�r�r|r}r~rrrrrzDs+rz)!�	functoolsrr�distutils.utilrZdistutils.command.build_py�commandrrrr�r�r�r�r�rWr�pathlibr�typingrrrr	r
rZextern.more_itertoolsr
�warningsrrrrrzrrrr�<module>s(