
    f}                     l    d dl Z d dlZd dlmZmZ d dlmc mZ ddl	m
Z
  G d dej                        Zy)    N)productstarmap   )StrPathc                   h    e Zd ZdZd Zd Zd Zed        Zd Z	ed        Z
	 	 	 	 dded	efd
Zd Zy)install_libz9Don't add compiled flags to filenames of non-Python filesc                 l    | j                          | j                         }|| j                  |       y y N)buildinstallbyte_compile)selfoutfiless     R/app/.heroku/python/lib/python3.12/site-packages/setuptools/command/install_lib.pyrunzinstall_lib.run   s/    

<<>h'      c                       fd j                         D        }t        | j                               }t        t	         j
                  |            S )z
        Return a collections.Sized collections.Container of paths to be
        excluded for single_version_externally_managed installations.
        c              3   N   K   | ]  }j                  |      D ]  }|   y wr
   )_all_packages).0ns_pkgpkgr   s      r   	<genexpr>z-install_lib.get_exclusions.<locals>.<genexpr>   s9      
))&1
  

s   "%)_get_SVEM_NSPsr   _gen_exclusion_pathssetr   _exclude_pkg_path)r   all_packages
excl_specss   `  r   get_exclusionszinstall_lib.get_exclusions   sJ    

--/
 \4+D+D+FG
7411:>??r   c                     |j                  d      |gz   }t        j                  j                  | j                  g| 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partss       r   r   zinstall_lib._exclude_pkg_path    s7    
 		#.!11ww||D,,5u55r   c              #   J   K   | r|  | j                  d      \  } }}| ryyw)zn
        >>> list(install_lib._all_packages('foo.bar.baz'))
        ['foo.bar.baz', 'foo.bar', 'foo']
        r"   N)
rpartition)pkg_namesepchilds      r   r   zinstall_lib._all_packages(   s,      N#+#6#6s#; Hc5 s   ##c                     | j                   j                  sg S | j                  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svems      r   r   zinstall_lib._get_SVEM_NSPs2   sL       33I00;<<7;t  33CCr   c               #      K   d d d t        t        d      syt        j                  j	                  ddt        j
                  j                  z         } | dz    | d	z    | d
z    | dz    yw)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&   r7   	cache_tag)bases    r   r   z install_lib._gen_exclusion_pathsB   sw      s,-ww||M;9K9K9U9U+UVVmVm\!!\!!s   A6A8infileoutfilec                    	
 |r|r|rJ | j                         		s!t        j                  j                  | ||      S ddlm} ddlm
 g 	
fd} ||||       S )Nr   )unpack_directory)logc                     |v rj                  d|       yj                  d| t        j                  j	                  |             j                  |       |S )Nz/Skipping installation of %s (namespace package)Fzcopying %s -> %s)warninfor$   r%   dirnameappend)srcdstexcluderA   r   s     r   pfz!install_lib.copy_tree.<locals>.pfm   sK    g~JCPHH'bggooc.BCOOC Jr   )r    origr   	copy_treesetuptools.archive_utilr@   	distutilsrA   )r   r=   r>   preserve_modepreserve_timespreserve_symlinkslevelr@   rJ   rI   rA   r   s            @@@r   rL   zinstall_lib.copy_treeW   sd     8III%%'##--dFGDD 	=!	 	"-r   c                     t         j                  j                  |       }| j                         }|r|D cg c]	  }||vs| c}S |S c c}w r
   )rK   r   get_outputsr    )r   outputsrI   fs       r   rT   zinstall_lib.get_outputsy   sK    ""..t4%%'&;!!7*:A;; <s   	A	 A	N)TTF   )__name__
__module____qualname____doc__r   r    r   staticmethodr   r   r   r   strrL   rT    r   r   r   r      sn    C(@6 < <D  " "0     Dr   r   )r$   r:   	itertoolsr   r   distutils.command.install_libcommandr   rK   _pathr   r^   r   r   <module>rc      s+    	 
 & , , v$"" vr   