
    eXfu              
          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	 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mZ ddlmZ ddlmZ ddl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*d0 Z+d1 Z,d2 Z- G d3 d4e	          Z.dS )5zFdistutils.command.install

Implements the Distutils 'install' command.    N)log   )Command)DEBUG)get_config_vars)
write_file)convert_path
subst_varschange_root)get_platform)DistutilsOptionErrorDistutilsPlatformError   )_framework_compat)_collections)	USER_BASE)	USER_SITETz{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     ^/var/www/html/Qu*py/bism/lib/python3.11/site-packages/setuptools/_distutils/command/install.py
<dictcomp>z+_load_sysconfig_schemes.<locals>.<dictcomp>e   s:     
 
 
 I'u===
 
 
    )
contextlibsuppressAttributeErrorr#   get_scheme_names r)   r'   _load_sysconfig_schemesr/   c   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>r   s`       
 	 	 
!!&"--
##FB//
  r)   )r/   set	itertoolschainr2   )r4   s   @r'   _load_schemesr8   k   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?   {   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_schemerK      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 rA   )getattr)r%   keyvaluerI   s      r'   r(   z_remove_set.<locals>.<dictcomp>   s.    SSS:3'"c:J:J:RC:R:R:Rr)   )items)rI   attrss   ` r'   rG   rG      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)rJ   os_nameseprO   resolveds        r'   rD   rD      sl    s++GS#/1#66 / / /9Z--../Os   0 +AAc                 *    t                      |          S rA   )r8   )rJ   s    r'   rC   rC      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   )rC   rY   
setdefault)rJ   r&   fallbacks      r'   rB   rB      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%   rO   r&   s     r'   r(   z!_scheme_attrs.<locals>.<dictcomp>   s(    AAAcsfSkAAAr)   )SCHEME_KEYS)r&   s   `r'   rH   rH      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)      r:   )_user_homer   _ntr   )r>   version_infor=   endswithosrJ   )rJ   PY37old_pypyprefix	pypy_names        r'   rY   rY      sb    f$Ds/009TH1222F"'T/22I 5V5995r)   c                   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)rt   rx   rz   userNz!install in user site-package '%s'rv   rt   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.Nr   r   )rp   exec_prefixhomer{   install_baseinstall_platbaserootinstall_purelibinstall_platlibinstall_headersinstall_libinstall_scriptsinstall_datar   install_userbaser   install_usersitert   optimize
extra_pathinstall_path_filerx   
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<   tA          j!        tE          j#                    |tI          j                    |g          | _%        | &                                 | 
                    d           | j        |d<   | j        |d<   tN          r2d	dl(m(} tS          d            |t7          | j%                             | *                                 | 
                    d           | j        r| +                                 | j,        2| j        -                                r| j.        | _,        n| j/        | _,        | 0                    dddd d!d"dd           | 1                                 | j,        | _2        t          j3        4                    | j,        | j5                  | _,        | j6        | 7                    d#dddd d!d"           | 
                    d$           | 8                    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   rp   r}    z%d.%dr   z%d%d
platlibdirlib)	dist_namedist_versiondist_fullname
py_versionpy_version_shortpy_version_nodot
sys_prefixrp   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   )9rp   r}   r~   r   r   r   r{   rm   rJ   warn	dump_dirsfinalize_unixfinalize_otherr>   versionsplitr   r   r,   distributionget_nameget_versionget_fullnamerk   rN   r?   lowerdictreplaceHAS_USER_SITEr   r   r   	DictStackrX   rE   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   rp   r}   r   
local_varscompat_varsr   s           r'   finalize_optionszinstall.finalize_optionsM  s     K 	4+ 	ty 		!%!6	 '>  
 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"'1WYYY%>%@%@*M
 
 	/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	translaterN   )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   r{   r   r   select_schemer~   rp   r}   rN   r#   rm   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                 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   rh   r   z)I don't know how to install stuff on '%s')r{   r   r   r   r   r   rm   rJ   r~   rp   r   r   r>   KeyErrorr   s    r'   r   zinstall.finalize_otherG  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+++++   ,?"'I  s   C0 0'Dc                 &    t          | |           d S rA   )rK   )r   rJ   s     r'   r   zinstall.select_scheme]  s    tT"""""r)   c                     |D ]y}t          | |          }|et          j        dk    st          j        dk    rt          j                            |          }t          || j                  }t          | ||           zd S )Nr   r   )rN   rm   rJ   r   
expanduserr
   r   setattr)r   rR   attrr   s       r'   _expand_attrszinstall._expand_attrs`  s     	) 	)D$%%C7g%%D',,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_basedirsi  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_dirsn  s3      		
 		
 		
 		
 		
r)   c                 r    |D ]3}d|z   }t          | |t          t          | |                               4dS )z!Call `convert_path` over `names`.rc   N)r   r	   rN   r   namesrJ   r   s       r'   r   zinstall.convert_paths{  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.rc   N)r   r   r   rN   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 ]s\  }}t          |                              |          rLt          j        	                    |          s-| 
                    d|z             t          j        |d           tdS )zCreate directories under ~.N~zos.makedirs('%s', 0o700)i  )r{   r	   rm   r   r   r   rQ   r   
startswithisdirdebug_printmakedirs)r   r~   rJ   r   s       r'   r   zinstall.create_home_path  s    y 	FBG..s3344*0022 	) 	)JD$4yy##D)) )"'--2E2E )  !;d!BCCC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        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_commandr   get_command_obj	plat_namer   r   r   get_sub_commandsr   create_path_filer   get_outputsr   r   rangeexecuter   maprm   r   r   r>   normcaser   r   r   r   )r   
build_platcmd_nameoutputsroot_lencountersys_pathr   s           r'   runzinstall.run  s     	VW%%%*::7CCMJ } V|~~!=!=,-TUUU --// 	' 	'HX&&&&> 	$!!### ; 
	&&((Gy Cty>>$S\\22 C CG'.w'7		'BGG$$LLg&9DKG   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|z             dS | 	                    d|z             dS )zCreates the .pth file.pthzcreating %szpath file '%s' not createdN)
rm   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=8;S     II2X=>>>>>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   rm   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'   rs   rs      s       ;K: : :Lx 988O 'T>JK	
 	
 	
 	v&&& ),LE E EZp
 p
 p
j1 1 1(// // //b  ,# # #) ) )I I I

 
 
C C C!% !% !%FM M M) ) )0 0 0d? ? ?     
 
 
/ / /
/ / /
2 2 2 
 	K(	K(	"	../LLLr)   rs   )/__doc__r>   rm   r*   r#   r6   distutils._logr   corer   r   r   r   	file_utilr   utilr	   r
   r   r   errorsr   r   r   r   rX   r   siter   r   r   WINDOWS_SCHEMEr2   rF   schemesrd   r/   r8   r?   rK   rG   rD   rC   rB   rH   rY   rs   r.   r)   r'   <module>r9     s  / / 


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