
    ϶vg~u              
          d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	m
Z
 ddlZddlmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZmZmZmZ ddlmZ dZddddddZ dddddddddddde dddddddddddddZ!erdddd d!de!d"<   ddd#d$d!de!d%<   e!"                    ej#                   dZ$d& Z%d' Z&d( Z'd) Z(d* Z)d+ Z*d, Z+d- Z,d. Z-d/ Z. G d0 d1e          Z/dS )2zFdistutils.command.install

Implements the Distutils 'install' command.    N)log)	USER_BASE	USER_SITE   )Command)DEBUG)DistutilsOptionErrorDistutilsPlatformError)
write_file)get_config_vars)change_rootconvert_pathget_platform
subst_vars   )_framework_compatTz{base}/Lib/site-packagesz{base}/Include/{dist_name}z{base}/Scriptsz{base})purelibplatlibheadersscriptsdatazA{base}/lib/{implementation_lower}{py_version_short}/site-packageszN{platbase}/{platlibdir}/{implementation_lower}{py_version_short}/site-packageszM{base}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}z
{base}/binz!{base}/lib/{implementation_lower}z*{base}/{platlibdir}/{implementation_lower}z1{base}/include/{implementation_lower}/{dist_name}z{base}/site-packagesz{base}/include/{dist_name})posix_prefix
posix_homentpypypypy_ntz
{usersite}zF{userbase}/{implementation}{py_version_nodot_plat}/Include/{dist_name}z:{userbase}/{implementation}{py_version_nodot_plat}/Scriptsz
{userbase}nt_userzQ{userbase}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}z{userbase}/bin
posix_userc                      t          j        t                    5  d t          j                    D             cd d d            S # 1 swxY w Y   d S )Nc                 <    i | ]}|t          j        |d           S )F)expand)	sysconfig	get_paths).0schemes     b/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/setuptools/_distutils/command/install.py
<dictcomp>z+_load_sysconfig_schemes.<locals>.<dictcomp>c   s:     
 
 
 I'u===
 
 
    )
contextlibsuppressAttributeErrorr"   get_scheme_names r(   r&   _load_sysconfig_schemesr.   a   s    		^	,	, 
 

 
#466
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   AAAc                       t                      pi   fdt          t          j        t                               D             S )z=
    Extend default schemes with schemes from sysconfig.
    c                 x    i | ]6}|i t                               |i                               |i           7S r-   )INSTALL_SCHEMESget)r$   r%   sysconfig_schemess     r&   r'   z!_load_schemes.<locals>.<dictcomp>p   s`       
 	 	 
!!&"--
##FB//
  r(   )r.   set	itertoolschainr1   )r3   s   @r&   _load_schemesr7   i   sX    
 0117R   
 )//;LMMNN   r(   c                  4    t          t          d          rdS dS )Npypy_version_infoPyPyPython)hasattrsysr-   r(   r&   _get_implementationr>   y   s    s'(( vxr(   c                     t          |t          t          |                              }t          |                               t          | t          |                               d S N)_inject_headers_load_scheme_resolve_schemevarsupdate_remove_set_scheme_attrs)obnamer%   s      r&   _select_schemerJ      sQ    T<0E0E#F#FGGFHHOOKM&$9$9::;;;;;r(   c                 D      fd|                                 D             S )z1
    Include only attrs that are None in ob.
    c                 <    i | ]\  }}t          |          ||S r@   )getattr)r$   keyvaluerH   s      r&   r'   z_remove_set.<locals>.<dictcomp>   s.    SSS:3'"c:J:J:RC:R:R:Rr(   )items)rH   attrss   ` r&   rF   rF      s(     TSSSSSSSr(   c                     |                      d          \  }}}	 t          j        |          }n1# t          $ r$ t	          j        t          |                     }Y nw xY w|S )N_)	partitionr"   get_preferred_scheme	Exceptionfwr%   
_pypy_hack)rI   os_nameseprN   resolveds        r&   rC   rC      sl    s++GS#/1#66 / / /9Z--../Os   0 +AAc                 *    t                      |          S r@   )r7   )rI   s    r&   rB   rB      s    ??4  r(   c                 v    t          t          |                     }|                    d|d                    |S )z
    Given a scheme name and the resolved scheme,
    if the scheme does not include headers, resolve
    the fallback scheme for the name and use headers
    from it. pypa/distutils#88
    r   )rB   rX   
setdefault)rI   r%   fallbacks      r&   rA   rA      s9     Jt,,--H
i)!4555Mr(   c                 *      fdt           D             S )z<Resolve install directories by applying the install schemes.c                 (    i | ]}d | |         S )install_r-   )r$   rN   r%   s     r&   r'   z!_scheme_attrs.<locals>.<dictcomp>   s(    AAAcsfSkAAAr(   )SCHEME_KEYS)r%   s   `r&   rG   rG      s    AAAA[AAAAr(   c                     t           j        dk     }t          t           d          o|}|                     d           }ddt          j        dk    z  z   }|r|r|n| S )N)      r9   )_user_homer   _ntr   )r=   version_infor<   endswithosrI   )rI   PY37old_pypyprefix	pypy_names        r&   rX   rX      sb    f$Ds/009TH1222F"'T/22I 5V5995r(   c                   2   e Zd ZdZg dZg dZer1e                    ddde df           e                    d           dd	iZ	d
 Z
d Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zdefd efd!efd"efd#d$ fgZdS )%installz'install everything from build directory))zprefix=Nzinstallation prefix)zexec-prefix=Nz.(Unix only) prefix for platform-specific files)zhome=Nz+(Unix only) home directory to install under)zinstall-base=Nz;base installation directory (instead of --prefix or --home))zinstall-platbase=Nz\base installation directory for platform-specific files (instead of --exec-prefix or --home))zroot=Nz<install everything relative to this alternate root directory)zinstall-purelib=Nz;installation directory for pure Python module distributions)zinstall-platlib=Nz8installation directory for non-pure module distributions)zinstall-lib=Nzginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))zinstall-headers=Nz(installation directory for C/C++ headers)zinstall-scripts=Nz)installation directory for Python scripts)zinstall-data=Nz%installation directory for data files)compileczcompile .py to .pyc [default])
no-compileNzdon't compile .py files)z	optimize=Ozlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])forcefz1force installation (overwrite any existing files))
skip-buildNz2skip rebuilding everything (for testing/debugging))zrecord=Nz3filename in which to record list of installed files)rs   rw   ry   userNzinstall in user site-package ''ru   rs   c                 x   d| _         d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _	        d| _
        d| _        d| _        t          | _        t          | _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        dS )zInitializes options.NFT)ro   exec_prefixhomerz   install_baseinstall_platbaserootinstall_purelibinstall_platlibinstall_headersinstall_libinstall_scriptsinstall_datar   install_userbaser   install_usersiters   optimize
extra_pathinstall_path_filerw   
skip_buildwarn_dir
build_base	build_librecordselfs    r&   initialize_optionszinstall.initialize_options   s     		
 ! $	  $###  ) ) !% 
  r(   c                 	   | j         s| j        s| j        r| j        s| j        rt          d          | j        r| j         s| j        rt          d          | j        r2| j         s| j        s| j        s| j        s| j        rt          d          t          j        dk    r#| j        r| 	                    d           d| _        | 
                    d           t          j        dk    r|                                  n|                                  | 
                    d           t          j                                        d	         }t!          d
d          \  }}	 t          j        }n# t$          $ r d}Y nw xY w| j                                        | j                                        | j                                        |dt          j        dd         z  dt          j        dd         z  |||||t1          t          dd          t3                                                      t3                      d}t7          t1          t          dd                              dd                    }t:          r| j        |d<   | j        |d<   t@          j!        "                    tG          j$                    |tK          j                    |g          | _&        | '                                 | 
                    d           | j        |d<   | j        |d<   tP          r2d	dl)m)} tU          d            |t7          | j&                             | +                                 | 
                    d           | j        r| ,                                 | j-        2| j        .                                r| j/        | _-        n| j0        | _-        | 1                    dddd d!d"dd           | 2                                 | j-        | _3        t          j4        5                    | j-        | j6                  | _-        | j7        | 8                    d#dddd d!d"           | 
                    d$           | 9                    d%d&d'           dS )(zFinalizes options.zWmust supply either prefix/exec-prefix/home or install-base/install-platbase -- not bothz9must supply either home or prefix/exec-prefix -- not bothzGcan't combine user with prefix, exec_prefix/home, or install_(plat)baseposixz+exec-prefix option ignored on this platformNzpre-finalize_{unix,other}zpost-finalize_{unix,other}()r   ro   r}    z%d.%dr   z%d%d
platlibdirlib)	dist_namedist_versiondist_fullname
py_versionpy_version_shortpy_version_nodot
sys_prefixro   sys_exec_prefixr}   abiflagsr   implementation_lowerimplementationwinver.)py_version_nodot_platuserbaseusersitezpost-expand_basedirs()baseplatbase)pprintzconfig vars:zpost-expand_dirs()r   r   r   r   r   libbasezafter prepending rootbuild)r   r   )r   r   ):ro   r}   r~   r   r   r	   rz   rl   rI   warn	dump_dirsfinalize_unixfinalize_otherr=   versionsplitr   r   r+   distributionget_nameget_versionget_fullnamerj   rM   r>   lowerdictreplaceHAS_USER_SITEr   r   jaracocollections	DictStackrW   rD   r"   config_varsexpand_basedirsr   r   printexpand_dirscreate_home_pathr   has_ext_modulesr   r   convert_pathshandle_extra_pathinstall_libbasepathjoin
extra_dirsr   change_rootsset_undefined_options)r   r   ro   r}   r   
local_varscompat_varsr   s           r&   finalize_optionszinstall.finalize_optionsJ  s     K 	4+ 	ty 		!%!6	 'i   9 	$+ 	)9 	&K   9 
	K
	
	 y
	  	
	
 $
	 ':   7g (		GHHH#'  	23337g    !!!5666 [&&((+
 /- H H	|HH 	 	 	HHH	 *3355 -99;;!.;;==$ '#*:2A2*> > &)9"1")= = *& !#|U;;$7$9$9$?$?$A$A133
 

$ ")#x"<"<"D"DS""M"M
 
 

  	;%)%:Jz"%)%:Jz"!-77GII%''	9
   	/000 ".
6!%!6
: 	+%%%%%%.!!!F4())*** 	+,,, 9 	$!!### # 0022 8#'#7  #'#7  			
 		
 		
  	   #/7<<(8$/JJ 9 5)Y	69   	./// 	""13M	
 	
 	
 	
 	
s   E+ +E:9E:c                    t           sdS ddlm} t          j        |dz              | j        D ]}|d         }|d         dk    r
|dd         }|| j        v r4| j        |         }|                    |          }t          | |           }n%|                    |          }t          | |          }t          j        d||           dS )	zDumps the list of user options.Nr   )longopt_xlate:r   =z  %s: %s)	r   fancy_getoptr   r   debuguser_optionsnegative_opt	translaterM   )r   msgr   optopt_namevals         r&   r   zinstall.dump_dirs  s     	F000000	#)$ 	1 	1C1vH|s""#AbD>4,,,,X6#--m<<!$111#--m<<dH--Ij(C0000	1 	1r(   c                 P   | j         | j        I| j        du o| j        du o| j        du p| j        du p| j        du p| j        du }|rt          d          dS | j	        r@| j
        t          d          | j
        x| _         | _        |                     d           dS | j        *| j        x| _         | _        |                     d           dS | j        | j        t          d          t!          t"          dd          }t$          j                            t*          j                  |z   | _        t$          j                            t*          j                  |z   | _        n| j        | j        | _        | j        | _         | j        | _        |                     d	           dS )
z&Finalizes options for posix platforms.NzPinstall-base or install-platbase supplied, but installation scheme is incomplete$User base directory is not specifiedr   r   z*must not supply exec-prefix without prefix_prefix_additionr   r   )r   r   r   r   r   r   r   r   r	   rz   r   r
   select_schemer~   ro   r}   rM   r"   rl   r   normpathr=   )r   incomplete_schemer   s      r&   r   zinstall.finalize_unix  s   (D,A,M $, 5,45,4-
 '4/- '4/- $,  ! *8   F9 	/$,,-STTT8<8MMD 5|,,,,,Y"8<	AD 5|,,,,,{"#/.D  
 $+96H"#M#M  g..sz::=MM#%7#3#3CO#D#DGW#W   #+'+{D$ $D$($4D!~.....r(   c                 6   | j         rM| j        t          d          | j        x| _        | _        |                     t          j        dz              dS | j        *| j        x| _        | _        |                     d           dS | j	        .t          j
                            t          j	                  | _	        | j	        x| _        | _        	 |                     t          j                   dS # t          $ r t          dt          j         d          w xY w)z)Finalizes options for non-posix platformsNr   rg   r   z&I don't know how to install stuff on 'r{   )rz   r   r
   r   r   r   rl   rI   r~   ro   r   r   r=   KeyErrorr   s    r&   r   zinstall.finalize_otherF  s   9 	$,,-STTT8<8MMD 5rw011111Y"8<	AD 5|,,,,,{" g..sz::8<CD 5""27+++++   ,GRWGGG  s   C0 0(Dc                 &    t          | |           d S r@   )rJ   )r   rI   s     r&   r   zinstall.select_scheme\  s    tT"""""r(   c                     |D ]g}t          | |          }|St          j        dv rt          j                            |          }t          || j                  }t          | ||           hd S )N)r   r   )rM   rl   rI   r   
expanduserr   r   setattr)r   rQ   attrr   s       r&   _expand_attrszinstall._expand_attrs_  sv     	) 	)D$%%C7o--',,S11C d&677dC(((	) 	)r(   c                 4    |                      g d           dS )zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.)r   r   r   Nr   r   s    r&   r   zinstall.expand_basedirsh  s%     	GGGHHHHHr(   c                 4    |                      g d           dS )z+Calls `os.path.expanduser` on install dirs.)r   r   r   r   r   r   Nr   r   s    r&   r   zinstall.expand_dirsm  s3     
 
 
 	 	 	 	 	r(   c                 r    |D ]3}d|z   }t          | |t          t          | |                               4dS )z!Call `convert_path` over `names`.rb   N)r   r   rM   r   namesrI   r   s       r&   r   zinstall.convert_pathsx  sP     	C 	CD$DD$WT4-@-@ A ABBBB	C 	Cr(   c                    | j         | j        j         | _         | j         t          j        d           t	          | j         t
                    r| j                             d          | _         t          | j                   dk    r| j         d         x}}n2t          | j                   dk    r| j         \  }}nt          d          t          |          }nd}d}|| _
        || _        dS )	z4Set `path_file` and `extra_dirs` using `extra_path`.NzIDistribution option extra_path is deprecated. See issue27919 for details.,r   r   r   zY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsr   )r   r   r   warning
isinstancestrr   lenr	   r   	path_filer   )r   r   r   s      r&   r   zinstall.handle_extra_path~  s    ?""/:DO?&K.   $/3// ="&/"7"7"<"<4?##q(()-);;	JJT_%%**(,%	::*B   &j11JJIJ #$r(   c                 ~    |D ]9}d|z   }t          | |t          | j        t          | |                               :dS )z:Change the install directories pointed by name using root.rb   N)r   r   r   rM   r   s       r&   r   zinstall.change_roots  sT     	M 	MD$DD$DIwtT7J7J K KLLLL	M 	Mr(   c                    | j         sdS t          t          j                            d                    }| j                                        D ]q}t          |                              |          rMt          j        	                    |          s.| 
                    d| d           t          j        |d           rdS )zCreate directories under ~.N~zos.makedirs('z	', 0o700)i  )rz   r   rl   r   r   r   valuesr   
startswithisdirdebug_printmakedirs)r   r~   r   s      r&   r   zinstall.create_home_path  s    y 	FBG..s3344$++-- 	) 	)D4yy##D)) )"'--2E2E )  !@!@!@!@AAAD%(((	) 	)r(   c                    | j         s\|                     d           | j                            d          j        }| j        r!|t                      k    rt          d          |                                 D ]}|                     |           | j	        r| 
                                 | j        r|                                 }| j        rFt          | j                  }t          t          |                    D ]}||         |d         ||<   |                     t"          | j        |fd| j         d           t%          t&          j        j        t,          j                  }t%          t&          j        j        |          }t&          j                            t&          j                            | j                            }| j        r.| j	        r| j        s$||vrt5          j        d| j                   dS dS dS dS )zRuns the command.r   z"Can't install when cross-compilingNz$writing list of installed files to 'r{   zmodules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself)r   run_commandr   get_command_obj	plat_namer   r   r
   get_sub_commandsr   create_path_filer   get_outputsr   r   rangeexecuter   maprl   r   r   r=   normcaser   r   r   r   )r   
build_platcmd_nameoutputsroot_lencountersys_pathr   s           r&   runzinstall.run  s      	SW%%%*::7CCMJ } S|~~!=!=,-QRRR --// 	' 	'HX&&&&> 	$!!### ; 
	&&((Gy Cty>>$S\\22 C CG'.w'7		'BGG$$LLg&Et{EEE   rw'22rw'22g&&rw'7'78H'I'IJJM	^	(,(>	 8++IE      	 	 ,+	 	r(   c                     t           j                            | j        | j        dz             }| j        r)|                     t          || j        gfd|            dS | 	                    d| d           dS )zCreates the .pth file.pthz	creating zpath file 'z' not createdN)
rl   r   r   r   r   r   r
  r   r   r   )r   filenames     r&   r  zinstall.create_path_file  s    7<< 4dnv6MNN! 	=LLX'89;Qx;Q;Q     II;H;;;<<<<<r(   c                 ^   g }|                                  D ]G}|                     |          }|                                D ]}||vr|                    |           H| j        rG| j        r@|                    t          j                            | j	        | j        dz                        |S )z.Assembles the outputs of all the sub-commands.r  )
r  get_finalized_commandr  appendr   r   rl   r   r   r   )r   r  r  cmdr  s        r&   r  zinstall.get_outputs  s    --// 	- 	-H,,X66C  OO-- - -7**NN8,,,- > 	Xd4 	XNN27<<(<dnv>UVVWWWr(   c                     g }|                                  D ]>}|                     |          }|                    |                                           ?|S )z*Returns the inputs of all the sub-commands)r  r  extend
get_inputs)r   inputsr  r  s       r&   r  zinstall.get_inputs  s[     --// 	, 	,H,,X66CMM#..**++++r(   c                 f    | j                                         p| j                                         S )zSReturns true if the current distribution has any Python
        modules to install.)r   has_pure_modulesr   r   s    r&   has_libzinstall.has_lib  s/     ..00WD4E4U4U4W4W	
r(   c                 4    | j                                         S )zLReturns true if the current distribution has any headers to
        install.)r   has_headersr   s    r&   r#  zinstall.has_headers        ,,...r(   c                 4    | j                                         S )zMReturns true if the current distribution has any scripts to.
        install.)r   has_scriptsr   s    r&   r&  zinstall.has_scripts  r$  r(   c                 4    | j                                         S )zJReturns true if the current distribution has any data to.
        install.)r   has_data_filesr   s    r&   has_datazinstall.has_data  s      //111r(   r   r   r   r   install_egg_infoc                     dS )NTr-   r   s    r&   <lambda>zinstall.<lambda>*  s    $ r(   ) __name__
__module____qualname__descriptionr   boolean_optionsr   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r!  r#  r&  r)  sub_commandsr-   r(   r&   rr   rr      s       ;K8 8 8Lt 988O '9Y999
 	 	 	
 	v&&& ),LE E EZr
 r
 r
n1 1 1(// // //b  ,# # #) ) )I I I
	 	 	C C C!% !% !%FM M M) ) )0 0 0d= = =     
 
 
/ / /
/ / /
2 2 2 
 	K(	K(	"	../LLLr(   rr   )0__doc__r)   r5   rl   r=   r"   distutils._logr   siter   r   jaraco.collectionsr   corer   r   r   errorsr	   r
   	file_utilr   r   utilr   r   r   r   r   r   rW   r   WINDOWS_SCHEMEr1   rE   schemesrc   r.   r7   r>   rJ   rF   rC   rB   rA   rG   rX   rr   r-   r(   r&   <module>r=     s   / /         				 



           % % % % % % % %                 A A A A A A A A " " " " " " ' ' ' ' ' ' F F F F F F F F F F F F % % % % % % *)+  W+3  7?F  ))/  *)/# 3   F  O" "OI  3#% %OL!   rz " " " C
 
 
     < < <
T T T  ! ! !  B B B
6 6 6w	 w	 w	 w	 w	g w	 w	 w	 w	 w	r(   