o
    Zh                     @  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   U/var/www/html/lang_env/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).0Z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   Zall_packagesZ
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joinZinstall_dir)r   r   Z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_nameZ_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_packagesZget_finalized_commandZ!single_version_externally_managed)r   Zinstall_cmdZ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#   r)   	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srcr2   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)r<   r=   excluder;   r   r   r   pfx   s   
z!install_lib.copy_tree.<locals>.pf)r<   r2   r=   r2   )r   origr   	copy_treeZsetuptools.archive_utilr:   	distutilsr;   )	r   r0   r1   r3   r5   r6   r7   r:   rD   r   rB   r   rF   ^   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rC   r   r   
<listcomp>   s    z+install_lib.get_outputs.<locals>.<listcomp>)rE   r   get_outputsr   )r   Zoutputsr   rI   r   rK      s
   zinstall_lib.get_outputsN)r
   r   )TTFr/   )r0   r   r1   r2   r3   r4   r5   r4   r6   r4   r7   r8   r
   r9   )__name__
__module____qualname____doc____annotations__r   r   r   staticmethodr   r   r   rF   rK   r   r   r   r   r      s"   
 

	
&r   )
__future__r   r!   r,   	itertoolsr   r   _pathr   distr   Zdistutils.command.install_libcommandr   rE   r   r   r   r   <module>   s    