o
    h                     @   sH   d dl Z d dlZd dlmZmZ d dlm  mZ G dd dejZdS )    N)productstarmapc                   @   sl   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Ze	dd Z
dd Ze	dd Z	dddZdd ZdS )install_libz9Don't add compiled flags to filenames of non-Python filesc                 C   s   t j|  d | _d | _d S N)origr   initialize_options	multiarchinstall_layoutself r   Z/var/www/html/olx_land/venv/lib/python3.10/site-packages/setuptools/command/install_lib.pyr   
   s   
zinstall_lib.initialize_optionsc                 C   sT   t j|  | dd | jdkr&tjd d dkr(dd l}|d| _	d S d S d S )Ninstall)r	   r	   deb   )   r   r   	MULTIARCH)
r   r   finalize_optionsset_undefined_optionsr	   sysversion_info	sysconfigget_config_varr   )r   r   r   r   r   r      s   zinstall_lib.finalize_optionsc                 C   s*   |    |  }|d ur| | d S d S r   )buildr   byte_compile)r   outfilesr   r   r   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pkgr
   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   3   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   )distributionnamespace_packagesget_finalized_command!single_version_externally_managed)r   install_cmdsvemr   r   r   r"   =   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)hasattrr   r+   r,   r-   r;   	cache_tag)baser   r   r   r#   M   s   



z install_lib._gen_exclusion_paths   r   c                    s   |r|r|rJ     sdd l}j|j_tj||S ddlm	} ddl
m g jrXdd l}	|	djdd   rHd ndd d jdd  f  fdd}
||||
 S )	Nr   )unpack_directory)log
EXT_SUFFIXz%s-%s%sc                    sz   | v r d| dS jr+r+|r+|s+|}dtj| d| tj| 	| |S )Nz/Skipping installation of %s (namespace package)Fzrenaming extension to %szcopying %s -> %s)
warnr   endswithreplaceinfor+   r,   basenamedirnameappend)srcdstexclude
ext_suffixrB   
new_suffixr   r   r   r   pf~   s   
z!install_lib.copy_tree.<locals>.pf)r(   distutils.dir_utilr   dir_util
_multiarchr   r   	copy_treesetuptools.archive_utilrA   	distutilsrB   r   r   rF   )r   infileoutfilepreserve_modepreserve_timespreserve_symlinkslevelrX   rA   r   rR   r   rN   r   rV   c   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rO   r   r   
<listcomp>   s    z+install_lib.get_outputs.<locals>.<listcomp>)r   r   get_outputsr(   )r   outputsr   r`   r   rb      s
   zinstall_lib.get_outputsN)r@   r@   r   r@   )__name__
__module____qualname____doc__r   r   r   r(   r%   staticmethodr   r"   r#   rV   rb   r   r   r   r   r      s    
	

,r   )	r+   r   	itertoolsr   r   distutils.command.install_libcommandr   r   r   r   r   r   <module>   s
    