HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //proc/thread-self/root/lib/python3.8/distutils/command/__pycache__/install.cpython-38.pyc
U

2�fGp�	@s:dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZmZmZdd
lmZddlmZddlmZdd
lmZdZdddddd�Zdddddd�dddddd�dddddd�d d d!ddd�ed"�Ze�r"d#d#d$d%d&d�ed'<d#d#d(d)d&d�ed*<dZGd+d,�d,e�ZdS)-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_SITETz$base/Lib/site-packagesz$base/Include/$dist_namez
$base/Scriptsz$base)�purelib�platlib�headers�scripts�dataz/$base/lib/python$py_version_short/site-packagesz3$platbase/lib/python$py_version_short/site-packagesz9$base/include/python$py_version_short$abiflags/$dist_namez	$base/binz5$base/local/lib/python$py_version_short/dist-packagesz9$platbase/local/lib/python$py_version_short/dist-packagesz6$base/local/include/python$py_version_short/$dist_namez$base/local/binz$base/localz$base/lib/python3/dist-packagesz#$platbase/lib/python3/dist-packagesz0$base/include/python$py_version_short/$dist_namez$base/lib/pythonz$base/include/python/$dist_name)�unix_prefix�
unix_local�
deb_system�	unix_home�ntz	$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@s<eZdZdZdddddddd	d
ddd
dddddddgZdddgZerbe�dddef�e�d�ddiZ	dd�Z
dd�Zd d!�Zd"d#�Z
d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Zd@dA�ZdBdC�ZdDdE�ZdFefdGefdHefdIefdJdKdL�fgZdS)M�installz'install everything from build directory)zprefix=Nzinstallation prefix)zexec-prefix=Nz.(Unix only) prefix for platform-specific files)zhome=Nz+(Unix only) home directory to install under)z
install-base=Nz;base installation directory (instead of --prefix or --home))zinstall-platbase=Nz\base installation directory for platform-specific files (instead of --exec-prefix or --home))zroot=Nz<install everything relative to this alternate root directory)zinstall-purelib=Nz;installation directory for pure Python module distributions)zinstall-platlib=Nz8installation directory for non-pure module distributions)zinstall-lib=Nzginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))zinstall-headers=Nz(installation directory for C/C++ headers)zinstall-scripts=Nz)installation directory for Python scripts)z
install-data=Nz%installation directory for data files)�compile�czcompile .py to .pyc [default])�
no-compileNzdon'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))zrecord=Nz3filename in which to record list of installed files)zinstall-layout=Nz7installation layout to choose (known values: deb, unix)rr r"�userNz!install in user site-package '%s'rcCs�d|_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|_d|_dS)zInitializes options.Nr�)�prefix�exec_prefix�homer#�
prefix_option�install_base�install_platbase�root�install_purelib�install_platlib�install_headers�install_lib�install_scripts�install_datar
�install_userbaser�install_usersite�install_layout�	multiarchr�optimize�
extra_path�install_path_filer �
skip_build�warn_dir�
build_base�	build_lib�record��self�r@�//usr/lib/python3.8/distutils/command/install.py�initialize_options�s8zinstall.initialize_optionscCsx|js|js|jr&|js|jr&td��|jr@|js8|jr@td��|jrl|jsd|jsd|jsd|jsd|jrltd��tjdkr�|jr�|�	d�d|_|�
d�tjdkr�|��n|��|�
d�t
j��d	}td
d�\}}z
t
j}Wntk
r�d}YnX|j��|j��|j��|d
t
jdd�dt
jdd�|||||d�|_t�rf|j|jd<|j|jd<|��|�
d�|j|jd<|j|jd<t�r�d	dlm}td�||j�|� �|�
d�|j�r�|�!�|j"dk�r�|jj#�r�|j$|_"n|j%|_"|�&dddddddd�|�'�|j"|_(tj)�*|j"|j+�|_"|j,dk	�r\|�-ddddddd�|�
d �|�.d!d"d#�dS)$zFinalizes 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 platformNzpre-finalize_{unix,other}zpost-finalize_{unix,other}()rr%r&�z%d.%d�z%d%d)�	dist_nameZdist_versionZ
dist_fullname�
py_version�py_version_short�py_version_nodotZ
sys_prefixr%Zsys_exec_prefixr&�abiflags�userbaseZusersitezpost-expand_basedirs()�base�platbase)�pprintzconfig vars:zpost-expand_dirs()�librrrrrZlibbasezafter prepending root�build)r;r;)r<r<)/r%r&r'r)r*rr#�os�name�warn�	dump_dirs�
finalize_unix�finalize_other�sys�version�splitrrJ�AttributeError�distribution�get_name�get_versionZget_fullname�version_info�config_vars�
HAS_USER_SITEr2r3�expand_basedirsrrN�print�expand_dirs�create_home_pathr/Zext_modulesr-r,�
convert_paths�handle_extra_path�install_libbase�path�join�
extra_dirsr+�change_roots�set_undefined_options)r?rGr%r&rJrNr@r@rA�finalize_options�s�������








�






�	�
�zinstall.finalize_optionscCs�tsdSddlm}t�|d�|jD]r}|d}|ddkrL|dd�}||jkrx|j|}|�|�}t||�}n|�|�}t||�}t�d||�q(dS)zDumps the list of user options.Nr)�
longopt_xlate�:����=z  %s: %s)	r�distutils.fancy_getoptrnr�debug�user_options�negative_opt�	translate�getattr)r?�msgrn�optZopt_name�valr@r@rArT�s





zinstall.dump_dirscCs|jdk	s|jdk	r\|jdkr2|jdkr2|jdksP|jdksP|jdksP|jdkrXtd��dS|j	r�|j
dkrttd��|j
|_|_|�d��n~|j
dk	r�|j
|_|_|�d��nX|j|_|jdkr�|jdk	r�td��tj�tj�|_tj�tj�|_n|jdk�r|j|_|j|_|j|_|j�r~|j��dk�rXddl}|�d	�|_|�d
�n$|j��dk�rt|�d�ntd
��n�|j�r�tj�|j�dk�s�tjtjk�s�dtjk�s�dtjk�s�dtjk�r�|�d�n6tj�|j�dk�rd|_|_d|_|_|�d�dS)z&Finalizes options for posix platforms.NzPinstall-base or install-platbase supplied, but installation scheme is incomplete�$User base directory is not specifiedrrz*must not supply exec-prefix without prefix)Zdebr�	MULTIARCHr)�unixrz"unknown value for --install-layoutz
/usr/local�PYTHONUSERBASE�VIRTUAL_ENV�real_prefixz/usrr)r)r*r/r,r-r.r0r1rr#r2r�
select_schemer'r%r(r&rQrh�normpathrWr4�lower�	sysconfig�get_config_varr5�base_prefix�environ�__dict__)r?r�r@r@rArU�s�
������
�


���
����zinstall.finalize_unixcCs�|jr8|jdkrtd��|j|_|_|�tjd�n�|jdk	r\|j|_|_|�d�n\|j	dkrvtj
�tj	�|_	|j	|_|_z|�tj�Wn"t
k
r�tdtj��YnXdS)z)Finalizes options for non-posix platformsNr{�_userrz)I don't know how to install stuff on '%s')r#r2rr)r*r�rQrRr'r%rhr�rW�KeyErrorr>r@r@rArV�s&
�

�zinstall.finalize_othercCs<t|}tD]*}d|}t||�dkrt||||�qdS)z=Sets the install directories by applying the install schemes.�install_N)�INSTALL_SCHEMES�SCHEME_KEYSrw�setattr)r?rR�scheme�key�attrnamer@r@rAr��s
zinstall.select_schemecCsX|D]N}t||�}|dk	rtjdks.tjdkr:tj�|�}t||j�}t|||�qdS)NrCr)rwrQrRrh�
expanduserr	r_r�)r?�attrs�attrrzr@r@rA�
_expand_attrs�s
zinstall._expand_attrscCs|�dddg�dS)zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.r)r*r+N�r�r>r@r@rAraszinstall.expand_basedirscCs|�ddddddg�dS)z+Calls `os.path.expanduser` on install dirs.r,r-r/r.r0r1Nr�r>r@r@rArc	s�zinstall.expand_dirscGs,|D]"}d|}t||tt||���qdS)z!Call `convert_path` over `names`.r�N)r�rrw�r?�namesrRr�r@r@rAreszinstall.convert_pathscCs�|jdkr|jj|_|jdk	r�t�d�t|jt�rB|j�d�|_t|j�dkr`|jd}}n"t|j�dkrz|j\}}ntd��t	|�}nd}d}||_
||_dS)	z4Set `path_file` and `extra_dirs` using `extra_path`.NzIDistribution option extra_path is deprecated. See issue27919 for details.�,r$rrEzY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsrD)r7r[rrS�
isinstance�strrY�lenrr�	path_filerj)r?r�rjr@r@rArfs(


��
zinstall.handle_extra_pathc	Gs0|D]&}d|}t||t|jt||���qdS)z:Change the install directories pointed by name using root.r�N)r�r
r+rwr�r@r@rArk7szinstall.change_rootscCsb|js
dSttj�d��}|j��D]8\}}|�|�r$tj�|�s$|�	d|�t�
|d�q$dS)zCreate directories under ~.N�~zos.makedirs('%s', 0o700)i�)r#rrQrhr�r_�items�
startswith�isdir�debug_print�makedirs)r?r'rRrhr@r@rArd=szinstall.create_home_pathcCs"|js6|�d�|j�d�j}|jr6|t�kr6td��|��D]}|�|�q>|j	r\|�
�|jr�|��}|j
r�t|j
�}tt|��D]}|||d�||<q�|�t|j|fd|j�ttjjtj�}ttjj|�}tj�tj�|j��}|j�r|j	�r|j�s||k�rt�d|j�dS)zRuns the command.rPz"Can't install when cross-compilingNz'writing list of installed files to '%s'z�modules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself)r9�run_commandr[�get_command_objZ	plat_namer:rr�get_sub_commandsr��create_path_filer=�get_outputsr+r��range�executer�maprQrhr�rW�normcaser/r8rrs)r?Z
build_plat�cmd_name�outputsZroot_len�counterZsys_pathr/r@r@rA�runIsD

������zinstall.runcCsJtj�|j|jd�}|jr8|�t||jgfd|�n|�	d|�dS)zCreates the .pth file�.pthzcreating %szpath file '%s' not createdN)
rQrhrirgr�r8r�rrjrS)r?�filenamer@r@rAr�us
�
�zinstall.create_path_filecCshg}|��D].}|�|�}|��D]}||kr"|�|�q"q|jrd|jrd|�tj�|j	|jd��|S)z.Assembles the outputs of all the sub-commands.r�)
r��get_finalized_commandr��appendr�r8rQrhrirg)r?r�r��cmdr�r@r@rAr��s
�zinstall.get_outputscCs.g}|��D]}|�|�}|�|���q|S)z*Returns the inputs of all the sub-commands)r�r��extend�
get_inputs)r?Zinputsr�r�r@r@rAr��s

zinstall.get_inputscCs|j��p|j��S)zSReturns true if the current distribution has any Python
        modules to install.)r[Zhas_pure_modulesZhas_ext_modulesr>r@r@rA�has_lib�s
�zinstall.has_libcCs
|j��S)zLReturns true if the current distribution has any headers to
        install.)r[�has_headersr>r@r@rAr��szinstall.has_headerscCs
|j��S)zMReturns true if the current distribution has any scripts to.
        install.)r[�has_scriptsr>r@r@rAr��szinstall.has_scriptscCs
|j��S)zJReturns true if the current distribution has any data to.
        install.)r[Zhas_data_filesr>r@r@rA�has_data�szinstall.has_datar/r.r0r1Zinstall_egg_infocCsdS)NTr@r>r@r@rA�<lambda>��zinstall.<lambda>) �__name__�
__module__�__qualname__�descriptionrtZboolean_optionsr`r�rrurBrmrTrUrVr�r�rarcrerfrkrdr�r�r�r�r�r�r�r��sub_commandsr@r@r@rArWsp	�>
�
S>		",
�r)�__doc__rWrQ�	distutilsrZdistutils.corer�distutils.debugr�distutils.sysconfigr�distutils.errorsr�distutils.file_utilrZdistutils.utilrr	r
rr�siter
rr`ZWINDOWS_SCHEMEr�r�rr@r@r@rA�<module>sz�
�����!�
	�