o
    5‘ðiß  ã                   @  sl   d dl mZ d dlZd dlZd dlmZmZ ddlmZ ddl	m
Z
 d dlm  mZ G dd„ dejƒZdS )	é    )ÚannotationsN)ÚproductÚstarmapé   )ÚStrPath)ÚDistributionc                   @  sp   e Zd ZU dZded< d%dd„Zdd	„ Zd
d„ Zedd„ ƒZ	dd„ Z
edd„ ƒZ				d&d'd d!„Zd"d#„ Zd$S )(Úinstall_libz9Don't add compiled flags to filenames of non-Python filesr   ÚdistributionÚreturnÚNonec                 C  s*   |   ¡  |  ¡ }|d ur|  |¡ d S d S ©N)ÚbuildÚinstallÚbyte_compile)ÚselfÚoutfiles© r   ú]/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/command/install_lib.pyÚrun   s
   þzinstall_lib.runc                   s4   ‡ fdd„ˆ   ¡ D ƒ}t|ˆ  ¡ ƒ}ttˆ j|ƒƒS )z—
        Return a collections.Sized collections.Container of paths to be
        excluded for single_version_externally_managed installations.
        c                 3  s$   � | ]}ˆ   |¡D ]}|V  q	qd S r   )Ú_all_packages)Ú.0Úns_pkgÚpkg©r   r   r   Ú	<genexpr>   s   € ýþÿz-install_lib.get_exclusions.<locals>.<genexpr>)Ú_get_SVEM_NSPsr   Ú_gen_exclusion_pathsÚsetr   Ú_exclude_pkg_path)r   Úall_packagesÚ
excl_specsr   r   r   Úget_exclusions   s
   
þzinstall_lib.get_exclusionsc                 C  s&   |  d¡|g }tjj| jg|¢R Ž S )zw
        Given a package name and exclusion path within that package,
        compute the full exclusion path.
        Ú.)ÚsplitÚosÚpathÚjoinÚinstall_dir)r   r   Úexclusion_pathÚpartsr   r   r   r   '   s   zinstall_lib._exclude_pkg_pathc                 c  s(   � | r| V  |   d¡\} }}| sdS dS )zn
        >>> list(install_lib._all_packages('foo.bar.baz'))
        ['foo.bar.baz', 'foo.bar', 'foo']
        r"   N)Ú
rpartition)Úpkg_nameÚ_sepÚ_childr   r   r   r   /   s
   €þzinstall_lib._all_packagesc                 C  s,   | j jsg S |  d¡}|j}|r| j jS g S )z‰
        Get namespace packages (list) but only for
        single_version_externally_managed installations and empty otherwise.
        r   )r	   Únamespace_packagesÚget_finalized_commandÚ!single_version_externally_managed)r   Úinstall_cmdÚsvemr   r   r   r   9   s
   
zinstall_lib._get_SVEM_NSPsc                  c  sd   � dV  dV  dV  t tdƒsdS tj ddtjj ¡} | d V  | d	 V  | d
 V  | d V  dS )zk
        Generate file paths to be excluded for namespace packages (bytecode
        cache files).
        z__init__.pyz__init__.pycz__init__.pyoÚimplementationNÚ__pycache__z	__init__.z.pycz.pyoz
.opt-1.pycz
.opt-2.pyc)ÚhasattrÚsysr$   r%   r&   r3   Ú	cache_tag)Úbaser   r   r   r   I   s   €



z install_lib._gen_exclusion_pathsTFé   Úinfiler   ÚoutfileÚstrÚpreserve_modeÚboolÚpreserve_timesÚpreserve_symlinksÚlevelÚobjectú	list[str]c           	        sr   |sJ ‚|sJ ‚|rJ ‚|   ¡ ‰ ˆ stj | ||¡S ddlm} ddlm‰ g ‰d	‡ ‡‡fdd„}||||ƒ ˆS )
Nr   )Úunpack_directory)ÚlogÚsrcr<   Údstc                   s<   |ˆ v rˆ  d|¡ dS ˆ d| tj |¡¡ ˆ |¡ |S )Nz/Skipping installation of %s (namespace package)Fzcopying %s -> %s)ÚwarnÚinfor$   r%   ÚdirnameÚappend)rF   rG   ©ÚexcluderE   r   r   r   Úpfx   s   
z!install_lib.copy_tree.<locals>.pf)rF   r<   rG   r<   )r!   Úorigr   Ú	copy_treeÚsetuptools.archive_utilrD   Ú	distutilsrE   )	r   r:   r;   r=   r?   r@   rA   rD   rN   r   rL   r   rP   ^   s   
	zinstall_lib.copy_treec                   s.   t j | ¡}|  ¡ ‰ ˆ r‡ fdd„|D ƒS |S )Nc                   s   g | ]}|ˆ vr|‘qS r   r   )r   Úf©rM   r   r   Ú
<listcomp>ˆ   s    z+install_lib.get_outputs.<locals>.<listcomp>)rO   r   Úget_outputsr!   )r   Úoutputsr   rT   r   rV   „   s
   zinstall_lib.get_outputsN)r
   r   )TTFr9   )r:   r   r;   r<   r=   r>   r?   r>   r@   r>   rA   rB   r
   rC   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r!   r   Ústaticmethodr   r   r   rP   rV   r   r   r   r   r      s"   
 

	
ø&r   )Ú
__future__r   r$   r6   Ú	itertoolsr   r   Ú_pathr   Údistr   Údistutils.command.install_libÚcommandr   rO   r   r   r   r   Ú<module>   s    