
    ?wgu              
          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!jE                  ejF                         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/y)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  t        j                         D  ci c]  } | t        j
                  | d       c} cd d d        S c c} w # 1 sw Y   y xY w)NF)expand)
contextlibsuppressAttributeError	sysconfigget_scheme_names	get_paths)schemes    \/var/www/horilla/myenv/lib/python3.12/site-packages/setuptools/_distutils/command/install.py_load_sysconfig_schemesr)   a   sb    			^	, 
 $446
 I''u==

 


 
s   A!AA!A!!A*c            	          t               xs i } t        t        j                  t        |             D ci c]-  }|i t        j                  |i       | j                  |i       / c}S c c}w )z=
    Extend default schemes with schemes from sysconfig.
    )r)   set	itertoolschainINSTALL_SCHEMESget)sysconfig_schemesr'   s     r(   _load_schemesr1   i   s{    
 017R )///;LMN
 	 	 
!!&"-
##FB/
 	
  s   2A)c                  &    t        t        d      ryy)Npypy_version_infoPyPyPython)hasattrsys     r(   _get_implementationr:   y   s    s'(r9   c                     t        |t        t        |                  }t        |       j	                  t        | t        |                   y N)_inject_headers_load_scheme_resolve_schemevarsupdate_remove_set_scheme_attrs)obnamer'   s      r(   _select_schemerF      s4    T<0E#FGFHOOKM&$9:;r9   c                 p    |j                         D ci c]  \  }}t        | |      || c}}S c c}}w )z1
    Include only attrs that are None in ob.
    )itemsgetattr)rD   attrskeyvalues       r(   rB   rB      s2     */S:3'"c:J:RCJSSSs   22c                     | j                  d      \  }}}	 t        j                  |      }|S # t        $ r" t	        j
                  t        |             }Y |S w xY w)N_)	partitionr$   get_preferred_scheme	Exceptionfwr'   
_pypy_hack)rE   os_nameseprK   resolveds        r(   r?   r?      s\    s+GS#/11#6 O  /99Z-.O/s   . 'AAc                     t               |    S r<   )r1   )rE   s    r(   r>   r>      s    ?4  r9   c                 X    t        t        |             }|j                  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   )r>   rS   
setdefault)rE   r'   fallbacks      r(   r=   r=      s-     Jt,-H
i)!45Mr9   c                 B    t         D ci c]  }d| | |    c}S c c}w )z<Resolve install directories by applying the install schemes.install_)SCHEME_KEYS)r'   rK   s     r(   rC   rC      s&    5@AchsefSk)AAAs   c                     t         j                  dk  }t        t         d      xr |}| j                  d       }ddt        j
                  dk(  z  z   }|r|r|S | S )N)      r3   )_user_homer   _ntr   )r7   version_infor6   endswithosrE   )rE   PY37old_pypyprefix	pypy_names        r(   rS   rS      s\    f$Ds/09TH122F"''T/22I V955r9   c                       e Zd ZdZg dZg dZer)ej                  ddde df       ej                  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y)%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)rm   rq   rs   userNzinstall in user site-package ''ro   rm   c                 r   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| _        y)zInitializes options.NFT)ri   exec_prefixhomert   install_baseinstall_platbaserootinstall_purelibinstall_platlibinstall_headersinstall_libinstall_scriptsinstall_datar   install_userbaser   install_usersiterm   optimize
extra_pathinstall_path_filerq   
skip_buildwarn_dir
build_base	build_librecordselfs    r(   initialize_optionszinstall.initialize_options   s     		
 ! $	  $###  ) ) !% 
  r9   c                 	   | j                   s| j                  s| j                  r#| j                  s| j                  rt        d      | j                  r#| j                   s| j                  rt        d      | j                  rG| j                   s0| j                  s$| j                  s| j                  s| j                  rt        d      t        j                  dk7  r$| j                  r| j                  d       d| _        | j                  d       t        j                  dk(  r| j                          n| j                          | j                  d       t        j                  j                         d	   }t!        d
d      \  }}	 t        j"                  }| j&                  j)                         | j&                  j+                         | j&                  j-                         |t        j.                  j0                   dt        j.                  j2                   t        j.                  j0                   t        j.                  j2                   |||||t5        t        dd      t7               j9                         t7               d}t;        t5        t        dd      j=                  dd            }t>        r| j@                  |d<   | jB                  |d<   tD        jF                  jI                  tK        jL                         |tO        j                          |g      | _(        | jS                          | j                  d       | j                  |d<   | j                  |d<   tT        r,d	dl+m+} tY        d        |t;        | jP                               | j[                          | j                  d       | j                  r| j]                          | j^                  =| j&                  ja                         r| jb                  | _/        n| jd                  | _/        | jg                  dddddddd       | ji                          | j^                  | _5        t        jl                  jo                  | j^                  | jp                        | _/        | jr                  | ju                  d dddddd       | j                  d!       | jw                  d"d#d$       y# t$        $ r d}Y Iw xY w)%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   ri   rw    .
platlibdirlib)	dist_namedist_versiondist_fullname
py_versionpy_version_shortpy_version_nodot
sys_prefixri   sys_exec_prefixrw   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   )<ri   rw   rx   ry   rz   r	   rt   rf   rE   warn	dump_dirsfinalize_unixfinalize_otherr7   versionsplitr   r   r#   distributionget_nameget_versionget_fullnamerd   majorminorrI   r:   lowerdictreplaceHAS_USER_SITEr   r   jaracocollections	DictStackrR   r@   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   ri   rw   r   
local_varscompat_varsr   s           r(   finalize_optionszinstall.finalize_optionsJ  s#     KK4++tyy!6!6&i  99$++)9)9&K  99KKyy  $$&:  77g		GH#'  	2377g !56 [[&&(+
 /- H	||H
 **335 --99;!..;;=$#&#3#3#9#9":!C<L<L<R<R;S T#&#3#3#9#9":3;K;K;Q;Q:R S *& !#|U;$7$9$?$?$A13

$ ")#x"<"D"DS""M

 %)%:%:Jz"%)%:%:Jz"!--77GGI%%'	9
  	/0 "..
6!%!6!6
:%.!4(()* 	+, 99!!# #  002#'#7#7 #'#7#7  			
  	 #//77<<(8(8$//J 99 5)Y	69 	./ 	""13M	
Q  	H	s   S S"!S"c                 t   t         syddlm} t        j                  |dz          | j
                  D ]  }|d   }|d   dk(  r|dd }|| j                  v r.| j                  |   }|j                  |      }t        | |       }n|j                  |      }t        | |      }t        j                  d||        y)	zDumps the list of user options.Nr   )longopt_xlate:r   =z  %s: %s)	r   fancy_getoptr   r   debuguser_optionsnegative_opt	translaterI   )r   msgr   optopt_namevals         r(   r   zinstall.dump_dirs  s    0		#)$$ 	1C1vH|s"#Ab>4,,,,,X6#--m<!$11#--m<dH-IIj(C0	1r9   c                    | j                   | j                  l| j                  du xr | j                  du xr | j                  du xs. | j
                  du xs | j                  du xs | j                  du }|rt        d      y| j                  rA| j                  t        d      | j                  x| _         | _        | j                  d       y| j                  *| j                  x| _         | _        | j                  d       y| j                  | j                  t        d      t!        t"        dd      }t$        j&                  j)                  t*        j                        |z   | _        t$        j&                  j)                  t*        j                        |z   | _        n| j                  | j                  | _        | j                  | _         | j                  | _        | j                  d	       y)
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   )ry   rz   r   r|   r}   r~   r   r   r	   rt   r   r
   select_schemerx   ri   rw   rI   r$   rf   r   normpathr7   )r   incomplete_schemer   s      r(   r   zinstall.finalize_unix  s   (D,A,A,M $$, 5,,45,,4-
 ''4/- ''4/- $$,  !*8  99$$,,-STT8<8M8MMD 5|,YY"8<		AD 5|,{{"##/.D 
 $+96H"#M  gg..szz:=MM#%77#3#3COO#DGW#W  ##+'+{{D$ $D$($4$4D!~.r9   c                 l   | j                   rR| j                  t        d      | j                  x| _        | _        | j                  t        j                  dz          y| j                  *| j                  x| _        | _        | j                  d       y| j                  2t        j                  j                  t        j                        | _	        | j                  x| _        | _        	 | j                  t        j                         y# t        $ r t        dt        j                   d      w xY w)z)Finalizes options for non-posix platformsNr   ra   r   z&I don't know how to install stuff on 'ru   )rt   r   r
   ry   rz   r   rf   rE   rx   ri   r   r   r7   KeyErrorr   s    r(   r   zinstall.finalize_otherF  s    99$$,,-STT8<8M8MMD 5rww01YY"8<		AD 5|,{{" gg..szz:8<CD 5""277+ ,<RWWIQG s   ,D 'D3c                     t        | |       y r<   )rF   )r   rE   s     r(   r   zinstall.select_scheme\  s    tT"r9   c                     |D ]e  }t        | |      }|t        j                  dv rt        j                  j	                  |      }t        || j                        }t        | ||       g y )N)r   r   )rI   rf   rE   r   
expanduserr   r   setattr)r   rJ   attrr   s       r(   _expand_attrszinstall._expand_attrs_  s`     	)D$%C77o-'',,S1C d&6&67dC(	)r9   c                 *    | j                  g d       y)zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.)ry   rz   r{   Nr   r   s    r(   r   zinstall.expand_basedirsh  s     	GHr9   c                 *    | j                  g d       y)z+Calls `os.path.expanduser` on install dirs.)r|   r}   r   r~   r   r   Nr   r   s    r(   r   zinstall.expand_dirsm  s     
 	r9   c                 \    |D ]'  }d|z   }t        | |t        t        | |                   ) y)z!Call `convert_path` over `names`.r\   N)r   r   rI   r   namesrE   r   s       r(   r   zinstall.convert_pathsx  s5     	CD$DD$WT4-@ AB	Cr9   c                    | j                   | j                  j                   | _         | j                   t        j                  d       t	        | j                   t
              r | j                   j                  d      | _         t        | j                         dk(  r| j                   d   x}}n3t        | j                         dk(  r| j                   \  }}nt        d      t        |      }nd}d}|| _
        || _        y)	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??&KK. $//3/"&//"7"7"<4??#q()-);;	JT__%*(,%	:*B  &j1JIJ #$r9   c                 r    |D ]2  }d|z   }t        | |t        | j                  t        | |                   4 y)z:Change the install directories pointed by name using root.r\   N)r   r   r{   rI   r   s       r(   r   zinstall.change_roots  s;     	MD$DD$DIIwtT7J KL	Mr9   c                 x   | j                   syt        t        j                  j	                  d            }| j
                  j                         D ]h  }t        |      j                  |      st        j                  j                  |      r>| j                  d| d       t        j                  |d       j y)zCreate directories under ~.N~zos.makedirs('z	', 0o700)i  )rt   r   rf   r   r   r   valuesr   
startswithisdirdebug_printmakedirs)r   rx   r   s      r(   r   zinstall.create_home_path  s    yyBGG..s34$$++- 	)D4y##D)"''--2E  =i!@AD%(	)r9   c                 F   | j                   sZ| j                  d       | j                  j                  d      j                  }| j
                  r|t               k7  rt        d      | j                         D ]  }| j                  |        | j                  r| j                          | j                  r| j                         }| j                  r9t        | j                        }t        t        |            D ]  }||   |d ||<    | j!                  t"        | j                  |fd| j                   d       t%        t&        j(                  j*                  t,        j(                        }t%        t&        j(                  j.                  |      }t&        j(                  j/                  t&        j(                  j+                  | j0                              }| j
                  r?| j                  r| j2                  s&||vr!t5        j6                  d| j0                         yyyy)zRuns the command.r   z"Can't install when cross-compilingNz$writing list of installed files to 'ru   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   maprf   r   r   r7   normcaser   r   r   r   )r   
build_platcmd_nameoutputsroot_lencountersys_pathr   s           r(   runzinstall.run  s    W%**::7CMMJ }}|~!=,-QRR --/ 	'HX&	' >>!!# ;;&&(Gyytyy>$S\2 CG'.w'7	'BGG$CLLg&6t{{m1E rww''2rww''2gg&&rww'7'78H8H'IJMM^^(>(>8+IIE    , )? r9   c                    t         j                  j                  | j                  | j                  dz         }| j
                  r(| j                  t        || j                  gfd|        y| j                  d| d       y)zCreates the .pth file.pthz	creating zpath file 'z' not createdN)
rf   r   r   r   r   r   r  r   r   r   )r   filenames     r(   r  zinstall.create_path_file  sk    77<< 4 4dnnv6MN!!LLX'89Yxj;Q IIH:];<r9   c                 h   g }| j                         D ]>  }| j                  |      }|j                         D ]  }||vs|j                  |        @ | j                  rR| j
                  rF|j                  t        j                  j                  | j                  | j                  dz                |S )z.Assembles the outputs of all the sub-commands.r  )
r  get_finalized_commandr  appendr   r   rf   r   r   r   )r   r  r
  cmdr  s        r(   r  zinstall.get_outputs  s    --/ 	-H,,X6C  OO- -7*NN8,-		- >>d44NN277<<(<(<dnnv>UVWr9   c                     g }| j                         D ]2  }| j                  |      }|j                  |j                                4 |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  sK     --/ 	,H,,X6CMM#..*+	, r9   c                 n    | j                   j                         xs | j                   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WD4E4E4U4U4W	
r9   c                 6    | j                   j                         S )zLReturns true if the current distribution has any headers to
        install.)r   has_headersr   s    r(   r  zinstall.has_headers         ,,..r9   c                 6    | j                   j                         S )zMReturns true if the current distribution has any scripts to.
        install.)r   has_scriptsr   s    r(   r"  zinstall.has_scripts  r   r9   c                 6    | j                   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1r9   r   r~   r   r   install_egg_infoc                      y)NTr8   r   s    r(   <lambda>zinstall.<lambda>*  s    r9   ) __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_commandsr8   r9   r(   rl   rl      s    ;K8Lt 9O,YKq9
 	
 	v& ),LEZr
n1(//b,#)I
	C!%FM)0d= 
/
/
2 
 	K(	K(	"	./Lr9   rl   )0__doc__r!   r,   rf   r7   r$   distutils._logr   siter   r   jaraco.collectionsr   corer   r   r   errorsr	   r
   	file_utilr   r   utilr   r   r   r   r   r   rR   r   WINDOWS_SCHEMEr.   rA   schemesr]   r)   r1   r:   rF   rB   r?   r>   r=   rC   rS   rl   r8   r9   r(   <module>r9     s`  /   	 
   %    A " ' F F % *)+ W+3 7?F ))/ *)/#3 F O"OI  3#%OL!   rzz " C
 <
T!B
6w	g w	r9   