
    dRn                        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 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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d d!ded"<   ddd#d$d!ded%<    G d& d'e          Z)dS )(zFdistutils.command.install

Implements the Distutils 'install' command.    N)log)Command)DEBUG)get_config_vars)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nt))r   posix_prefix)r   
posix_home)r   r   r   includez	\{(.+?)\}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)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| _        t          rt          | _        t           | _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        dS )zInitializes options.Nr      )prefixexec_prefixhomer(   install_baseinstall_platbaserootinstall_purelibinstall_platlibinstall_headersinstall_libinstall_scriptsinstall_dataHAS_USER_SITEr   install_userbaser   install_usersiter!   optimize
extra_pathinstall_path_filer%   
skip_buildwarn_dir
build_base	build_librecordselfs    +  /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/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   r+   r,    z%d.%d   z%d%d)	dist_namedist_versiondist_fullname
py_versionpy_version_shortpy_version_nodot
sys_prefixr+   sys_exec_prefixr,   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)r?   r?   )r@   r@   )3r+   r,   r-   r.   r/   r   r(   osnamewarn	dump_dirsfinalize_unixfinalize_othersysversionsplitr   rS   AttributeErrordistributionget_nameget_versionget_fullnameversion_inforT   config_varsr7   r8   r9   	sysconfigis_python_buildget_config_varexpand_basedirsr   rZ   printexpand_dirscreate_home_pathr4   ext_modulesr2   r1   convert_pathshandle_extra_pathinstall_libbasepathjoin
extra_dirsr0   change_rootsset_undefined_options)rC   rN   r+   r,   rS   rZ   s         rD   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)rC   msgr   optopt_namevals         rD   ra   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 	1rF   c                    | 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        s| j        t          d          t           j                            t&          j                  | _        t           j                            t&          j                  | _        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 prefixr   )r.   r/   r4   r1   r2   r3   r5   r6   r   r(   r8   r   select_schemer-   r+   r,   r^   ry   normpathrd   rB   s    rD   rb   zinstall.finalize_unix  s   (D,A,M!)%-%-$,$,!)*:; ; ; F9 	.$,,:< < <8<8MMD 5{+++++Y"8<	AD 5{+++++{"#/.FH H H !g..sz::#%7#3#3CO#D#D   #+'+{D$ $D$($4D!}-----rF   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(   r8   r   r.   r/   r   r^   r_   r-   r+   ry   r   rd   KeyErrorrB   s    rD   rc   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)rC   r_   schemekeyattrnames        rD   r   zinstall.select_scheme  sX     !& 	5 	5C!C'HtX&&.hs444	5 	5rF   c                     |D ]y}t          | |          }|et          j        dk    st          j        dk    rt          j                            |          }t          || j                  }t          | ||           zd S )NrH   r   )r   r^   r_   ry   
expanduserr
   rm   r   )rC   attrsattrr   s       rD   _expand_attrszinstall._expand_attrs  s     	) 	)D$%%C7g%%D',,S11C d&677dC(((	) 	)rF   c                 4    |                      g d           dS )zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.)r.   r/   r0   Nr   rB   s    rD   rq   zinstall.expand_basedirs  s%     	GGGHHHHHrF   c                 4    |                      g d           dS )z+Calls `os.path.expanduser` on install dirs.)r1   r2   r4   r3   r5   r6   Nr   rB   s    rD   rs   zinstall.expand_dirs  s;     @ @ @ 	A 	A 	A 	A 	ArF   c                 r    |D ]3}d|z   }t          | |t          t          | |                               4dS )z!Call `convert_path` over `names`.r   N)r   r	   r   rC   namesr_   r   s       rD   rv   zinstall.convert_paths  sP     	C 	CD$DD$WT4-@-@ A ABBBB	C 	CrF   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   rJ   zY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsrI   )r;   rh   r   r`   
isinstancestrrf   lenr   r	   	path_filer{   )rC   r   r{   s      rD   rw   zinstall.handle_extra_path   s    ?""/:DO?&H.   $/3// ="&/"7"7"<"<4?##q(()-);;	JJT_%%**(,%	::*DE E E &j11JJIJ #$rF   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   r0   r   r   s       rD   r|   zinstall.change_roots"  sT     	M 	MD$DD$DIwtT7J7J K KLLLL	M 	MrF   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	   r^   ry   r   rm   items
startswithisdirdebug_printmakedirs)rC   r-   r_   ry   s       rD   rt   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%(((	) 	)rF   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.r]   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)r=   run_commandrh   get_command_obj	plat_namer>   r   r   get_sub_commandsr   create_path_filerA   get_outputsr0   r   rangeexecuter   mapr^   ry   r   rd   normcaser4   r<   r   r   )rC   
build_platcmd_nameoutputsroot_lencountersys_pathr4   s           rD   runzinstall.run4  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 ') ) ) ) )	) 	)''	) 	)rF   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)
r^   ry   rz   rx   r   r<   r   r   r{   r`   )rC   filenames     rD   r   zinstall.create_path_file`  s    7<< 4 $ 79 9! 	?LL"T_$56&13 3 3 3 3 II2X=>>>>>rF   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<   r^   ry   rz   rx   )rC   r   r   cmdr   s        rD   r   zinstall.get_outputsn  s    --// 	- 	-H,,X66C  OO-- - -7**NN8,,,- > 	Bd4 	BNN27<<(<(,(?A A B B B rF   c                     g }|                                  D ]>}|                     |          }|                    |                                           ?|S )z*Returns the inputs of all the sub-commands)r   r   extend
get_inputs)rC   inputsr   r   s       rD   r   zinstall.get_inputs  s[     --// 	, 	,H,,X66CMM#..**++++rF   c                 f    | j                                         p| j                                         S )zSReturns true if the current distribution has any Python
        modules to install.)rh   has_pure_moduleshas_ext_modulesrB   s    rD   has_libzinstall.has_lib  s2     !2244 4!1133	5rF   c                 4    | j                                         S )zLReturns true if the current distribution has any headers to
        install.)rh   has_headersrB   s    rD   r   zinstall.has_headers        ,,...rF   c                 4    | j                                         S )zMReturns true if the current distribution has any scripts to.
        install.)rh   has_scriptsrB   s    rD   r   zinstall.has_scripts  r   rF   c                 4    | j                                         S )zJReturns true if the current distribution has any data to.
        install.)rh   has_data_filesrB   s    rD   has_datazinstall.has_data  s      //111rF   r4   r3   r5   r6   install_egg_infoc                     dS )NT rB   s    rD   <lambda>zinstall.<lambda>  s    T rF   ) __name__
__module____qualname__descriptionr   boolean_optionsr7   r   r   r   rE   r~   ra   rb   rc   r   r   rq   rs   rv   rw   r|   rt   r   r   r   r   r   r   r   r   sub_commandsr   rF   rD   r    r    Z   s       ;K9
 9
 9
Lv 988O 'VT@9LN 	O 	O 	Ov&&& 9-LF F F^U? U? U?t1 1 1&&. &. &.P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:	LLLrF   r    )*__doc__rd   rn   r^   re	distutilsr   distutils.corer   distutils.debugr   distutils.sysconfigr   distutils.errorsr   distutils.file_utilr   distutils.utilr	   r
   r   r   r   siter   r   r7   r   r   r   distutils_scheme_namesys_scheme_namesys_key_INSTALL_SCHEMES
sys_schememain_keyr   valuesubreplacerl   r    r   rF   rD   <module>r      s  / / 


     				 				       " " " " " " ! ! ! ! ! ! / / / / / / 3 3 3 3 3 3 * * * * * * @ @ @ @ @ @ @ @ @ @ ' ' ' ' ' ' 1 1 1 1 1 1            $&
 C #%2R@@  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 M	 M	 M	 M	 M	g M	 M	 M	 M	 M	rF   