
    ZQdRx              
          d 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 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 dd
lmZ ddlmZ ddlmZ ddlmZ eduZdZi i i dZdddddddddd	ed<   dddddddddd	ed<   eD ]6Zd D ]1\  ZZ eZ!ej"        e          Z#ed!k    ree#vrd"Z!e#e!         ee         e<   27eD ]Z$ee$         %                                D ]\  ZZ& ej'        d#d$e&          Z&e&(                    d%d&          Z&e&(                    d'd(          Z&ed!k    re&d)z  Z&ej)        d*k    red+k    re&(                    d,d-          Z&e&ee$         e<   erd.d.d/d0d1ded2<   d.d.d3d4d1ded5<    G d6 d7e          Z*dS )8zFdistutils.command.install

Implements the Distutils 'install' command.    N)log)Command)DEBUG)get_config_varsis_virtual_environment)DistutilsPlatformError)
write_file)convert_path
subst_varschange_root)get_platform)DistutilsOptionError)	USER_BASE)	USER_SITE)purelibplatlibheadersscriptsdata)unix_prefix	unix_homentz6{installed_base}/{platlibdir}/python{py_version_short}z0{platbase}/{platlibdir}/python{py_version_short}z7{base}/local/lib/python{py_version_short}/dist-packageszD{platbase}/local/{platlibdir}/python{py_version_short}/dist-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z7{base}/local/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z{base}/local/binz{base}/local)	stdlib
platstdlibr   r   includer   platincluder   r   
unix_localz {base}/lib/python3/dist-packagesz-{platbase}/{platlibdir}/python3/dist-packagesz
{base}/binz{base}
deb_system))r   posix_prefix)r   
posix_home)r   r   r   r   z	\{(.+?)\}z$\g<1>z$installed_basez$basez$py_version_nodot_platz$py_version_nodotz/$dist_name)   	   r   z/lib/z/$platlibdir/z	$usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz	$userbasent_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez$userbase/bin	unix_userc                   0   e Zd ZdZg dZg dZer0e                    dddez  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)zinstall-layout=Nz7installation layout to choose (known values: deb, unix))r'   r+   r-   userNz!install in user site-package '%s'r)   r'   c                    d| _         d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _	        d| _
        d| _        d| _        d| _        t          rt          | _        t"          | _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        dS )zInitializes options.Nr      )prefixexec_prefixhomer.   prefix_optioninstall_baseinstall_platbaserootinstall_purelibinstall_platlibinstall_headersinstall_libinstall_scriptsinstall_dataHAS_USER_SITEr   install_userbaser   install_usersiteinstall_layout	multiarchr'   optimize
extra_pathinstall_path_filer+   
skip_buildwarn_dir
build_base	build_librecordselfs    0/usr/lib/python3.11/distutils/command/install.pyinitialize_optionszinstall.initialize_options   s     		!
 ! $	  $###  	.$-D!$-D! # !" 
      c                 0   | 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  |||||t          j        d| _        t4          r| j        | j        d<   | j        | j        d<   t;          j        d          rt;          j        d          | j        d<   |                                   | 
                    d           | j        | j        d<   | j        | j        d<   tB          r%d	dl"m"} tG          d            || j                   | $                                 | 
                    d           | j        r| %                                 | j&        %| j        j'        r| j(        | _&        n| j)        | _&        | *                    dddddd            t4          r| *                    dd           | +                                 | j&        | _,        t          j-        .                    | j&        | j/                  | _&        | j0        | 1                    d!dddddd            | 
                    d"           | 2                    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   r1   r2    z%d.%d   z%d%d)	dist_namedist_versiondist_fullname
py_versionpy_version_shortpy_version_nodot
sys_prefixr1   sys_exec_prefixr2   abiflags
platlibdiruserbaseusersiteTsrcdirzpost-expand_basedirs()baseplatbase)pprintzconfig vars:zpost-expand_dirs()libr   r   r   r   r   libbasezafter prepending rootbuild)rH   rH   )rI   rI   )3r1   r2   r3   r5   r6   r   r.   osnamewarn	dump_dirsfinalize_unixfinalize_othersysversionsplitr   r\   AttributeErrordistributionget_nameget_versionget_fullnameversion_infor]   config_varsr>   r?   r@   	sysconfigis_python_buildget_config_varexpand_basedirsr   rc   printexpand_dirscreate_home_pathr;   ext_modulesr9   r8   convert_pathshandle_extra_pathinstall_libbasepathjoin
extra_dirsr7   change_rootsset_undefined_options)rL   rW   r1   r2   r\   rc   s         rM   finalize_optionszinstall.finalize_options  s     [ 	@D, 	@	 	@	@"&"7	@&?@ @ @ 9 	O$+ 	O)9 	O&MO O O 9 	R$+ 	R)9 	RTY 	R!	R%)%:	R& (Q R R R 7g (		GHHH#'  	23337g    !!!5666 [&&((+
 /- H H	|HH 	 	 	HHH	 *.):)C)C)E)E,0,=,I,I,K,K-1->-K-K-M-M*407#:J2A2:N0N069I"1"9M0M*0&,/:+6(0*-.   	A+/+@DZ(+/+@DZ($T** 	L)2)A()K)KDX&/000 $(#4 '+'<$ 	%%%%%%%.!!!F4#$$$ 	+,,, 9 	$!!### # , 8#'#7  #'#7 
 	5)Y$fi	9 	9 	9 	7z:666 	   #/7<<(8$/JJ 9 i	9'< < < 	./// 	""7#?#=	? 	? 	? 	? 	?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:=z  %s: %s)	r   distutils.fancy_getoptr   r   debuguser_optionsnegative_opt	translategetattr)rL   msgr   optopt_namevals         rM   rj   zinstall.dump_dirs  s     	F888888	#)$ 	1 	1C1vH|s""#AbD>4,,,,X6#--m<<!$111#--m<<dH--Ij(C0000	1 	1rO   c                 j   | j         | j        ;| j        | j        | j        | j        | j        | j        t          d          dS | j	        r@| j
        t          d          | j
        x| _         | _        |                     d           dS | j        *| j        x| _         | _        |                     d           dS | j        | _        | j        s| j        t          d          t"          j                            t(          j                  | _        t"          j                            t(          j                  | _        n| j        | j        | _        | j        | _         | j        | _        | j        r| j                                        dv r0ddl} |j        d	          | _        |                     d
           dS | j                                        dv r|                     d           dS t          d          | j        r(t"          j                            | j                  dk    st5                      r|                     d           dS t"          j                            | j                  dk    rdx| _        | _        dx| _         | _        |                     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)debr   	MULTIARCHr   )unixr   z"unknown value for --install-layoutz
/usr/localz/usrr   )r5   r6   r;   r8   r9   r:   r<   r=   r   r.   r?   r   select_schemer3   r1   r4   r2   rg   r   normpathrm   rA   lowerrw   ry   rB   r   )rL   rw   s     rM   rk   zinstall.finalize_unix  s   (D,A,M!)%-%-$,$,!)*:; ; ; F9 +	1$,,:< < <8<8MMD 5{+++++Y"8<	AD 5{+++++!%D{"#/.FH H H !g..sz::#%7#3#3CO#D#D   #+'+{D$ $D$($4D!" 1&,,..'99$$$$%=Y%=k%J%JDN&&|44444(..00H<<&&}55555.<> > >% 17##DK00L@@+-- A""=111117##DK00L@@5;;DK$"2@FFD%(=""<00000rO   c                 4   | 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        z            w xY w)z)Finalizes options for non-posix platformsNr   _userr   z)I don't know how to install stuff on '%s')r.   r?   r   r5   r6   r   rg   rh   r3   r1   r   r   rm   KeyErrorrK   s    rM   rl   zinstall.finalize_other  s&   9 	M$,,:< < <8<8MMD 5rw011111Y"8<	AD 5{+++++{" g..sz::8<CD 5M""27+++++ M M M,ABGKM M MMs   C0 0'Dc                     t           |         }t          D ].}d|z   }t          | |          t          | |||                    /dS )z=Sets the install directories by applying the install schemes.install_N)INSTALL_SCHEMESSCHEME_KEYSr   setattr)rL   rh   schemekeyattrnames        rM   r   zinstall.select_scheme  sX     !& 	5 	5C!C'HtX&&.hs444	5 	5rO   c                     |D ]y}t          | |          }|et          j        dk    st          j        dk    rt          j                            |          }t          || j                  }t          | ||           zd S )NrQ   r   )r   rg   rh   r   
expanduserr   rv   r   )rL   attrsattrr   s       rM   _expand_attrszinstall._expand_attrs  s     	) 	)D$%%C7g%%D',,S11C d&677dC(((	) 	)rO   c                 4    |                      g d           dS )zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.)r5   r6   r7   Nr   rK   s    rM   rz   zinstall.expand_basedirs"  s%     	GGGHHHHHrO   c                 4    |                      g d           dS )z+Calls `os.path.expanduser` on install dirs.)r8   r9   r;   r:   r<   r=   Nr   rK   s    rM   r|   zinstall.expand_dirs'  s;     @ @ @ 	A 	A 	A 	A 	ArO   c                 r    |D ]3}d|z   }t          | |t          t          | |                               4dS )z!Call `convert_path` over `names`.r   N)r   r
   r   rL   namesrh   r   s       rM   r   zinstall.convert_paths-  sP     	C 	CD$DD$WT4-@-@ A ABBBB	C 	CrO   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.,r0   r   rS   zY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsrR   )rD   rq   r   ri   
isinstancestrro   lenr   r
   	path_filer   )rL   r   r   s      rM   r   zinstall.handle_extra_path3  s    ?""/:DO?&H.   $/3// ="&/"7"7"<"<4?##q(()-);;	JJT_%%**(,%	::*DE E E &j11JJIJ #$rO   c                 ~    |D ]9}d|z   }t          | |t          | j        t          | |                               :dS )z:Change the install directories pointed by name using root.r   N)r   r   r7   r   r   s       rM   r   zinstall.change_rootsU  sT     	M 	MD$DD$DIwtT7J7J K KLLLL	M 	MrO   c                 p   | j         sdS t          t          j                            d                    }| j                                        D ]f\  }}|                    |          rLt          j                            |          s-| 	                    d|z             t          j
        |d           gdS )zCreate directories under ~.N~zos.makedirs('%s', 0o700)i  )r.   r
   rg   r   r   rv   items
startswithisdirdebug_printmakedirs)rL   r3   rh   r   s       rM   r}   zinstall.create_home_path[  s    y 	FBG..s3344*0022 	) 	)JD$t$$ )RW]]4-@-@ )  !;d!BCCCD%(((	) 	)rO   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        z             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.rf   z"Can't install when cross-compilingNz'writing list of installed files to '%s'zmodules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself)rF   run_commandrq   get_command_obj	plat_namerG   r   r   get_sub_commandsr   create_path_filerJ   get_outputsr7   r   rangeexecuter	   maprg   r   r   rm   normcaser;   rE   r   r   )rL   
build_platcmd_nameoutputsroot_lencountersys_pathr;   s           rM   runzinstall.rung  s#     		@W%%%*::7CCMJ } @|~~!=!=, .? @ @ @ --// 	' 	'HX&&&&> 	$!!### ; 		&&&((Gy Cty>>$S\\22 C CG'.w'7		'BGG$$LL+w/B%& & &
 rw'22rw'22g&&rw'7'78H'I'IJJM 	)	)$($:	)x''I H ') ) ) ) )	) 	)''	) 	)rO   c                     t           j                            | j        | j        dz             }| j        r)|                     t          || j        gfd|z             dS | 	                    d|z             dS )zCreates the .pth file.pthzcreating %szpath file '%s' not createdN)
rg   r   r   r   r   rE   r   r	   r   ri   )rL   filenames     rM   r   zinstall.create_path_file  s    7<< 4 $ 79 9! 	?LL"T_$56&13 3 3 3 3 II2X=>>>>>rO   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   rE   rg   r   r   r   )rL   r   r   cmdr   s        rM   r   zinstall.get_outputs  s    --// 	- 	-H,,X66C  OO-- - -7**NN8,,,- > 	Bd4 	BNN27<<(<(,(?A A B B B rO   c                     g }|                                  D ]>}|                     |          }|                    |                                           ?|S )z*Returns the inputs of all the sub-commands)r   r   extend
get_inputs)rL   inputsr   r   s       rM   r   zinstall.get_inputs  s[     --// 	, 	,H,,X66CMM#..**++++rO   c                 f    | j                                         p| j                                         S )zSReturns true if the current distribution has any Python
        modules to install.)rq   has_pure_moduleshas_ext_modulesrK   s    rM   has_libzinstall.has_lib  s2     !2244 4!1133	5rO   c                 4    | j                                         S )zLReturns true if the current distribution has any headers to
        install.)rq   has_headersrK   s    rM   r   zinstall.has_headers        ,,...rO   c                 4    | j                                         S )zMReturns true if the current distribution has any scripts to.
        install.)rq   has_scriptsrK   s    rM   r   zinstall.has_scripts  r   rO   c                 4    | j                                         S )zJReturns true if the current distribution has any data to.
        install.)rq   has_data_filesrK   s    rM   has_datazinstall.has_data  s      //111rO   r;   r:   r<   r=   install_egg_infoc                     dS )NT rK   s    rM   <lambda>zinstall.<lambda>  s    T rO   ) __name__
__module____qualname__descriptionr   boolean_optionsr>   r   r   r   rN   r   rj   rk   rl   r   r   rz   r|   r   r   r   r}   r   r   r   r   r   r   r   r   sub_commandsr   rO   rM   r&   r&   r   s       ;K<
 <
 <
L| 988O 'VT@9LN 	O 	O 	Ov&&& 9-LK K KhU? U? U?t1 1 1&91 91 91vM M M,5 5 5) ) )I I I
A A AC C C %  %  %DM M M) ) )*) *) *)X	? 	? 	?  "  5 5 5/ / /
/ / /
2 2 2 #0&4&4#1')9)9:	LLLrO   r&   )+__doc__rm   rw   rg   re	distutilsr   distutils.corer   distutils.debugr   distutils.sysconfigr   r   distutils.errorsr   distutils.file_utilr	   distutils.utilr
   r   r   r   r   siter   r   r>   r   r   r   distutils_scheme_namesys_scheme_namesys_key_INSTALL_SCHEMES
sys_schememain_keyr   valuesubreplaceru   r&   r   rO   rM   <module>r	     s_  / / 


     				 				       " " " " " " ! ! ! ! ! ! G G G G G G G G 3 3 3 3 3 3 * * * * * * @ @ @ @ @ @ @ @ @ @ ' ' ' ' ' ' 1 1 1 1 1 1            $&
 C #%2R@@ GDHULHT!
! 
!  GD1>LLT
! 
!   J JC3 J J. /@
): 5 5  G6@6I-.s33J   / /H%h/5577 
/ 
/
U|Y66/9968KLL)]"Ev%%#*:*:MM'?;;E).!#&&
/  
I>"
 "
OI K"$
 $
OK h	 h	 h	 h	 h	g h	 h	 h	 h	 h	rO   