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: //usr/lib/python3/dist-packages/pip/_internal/commands/__pycache__/install.cpython-310.pyc
o

@%Ne�l�@s~ddlZddlZddlZddlZddlZddlmZmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZddlmZddlmZmZmZdd	lmZmZdd
lmZmZddlmZddl m!Z!dd
l"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8m9Z9ddl:m;Z;ddl<m=Z=m>Z>ddl?m@Z@mAZAmBZBe4eC�ZDde#de@fdd�ZEGdd�de�ZF	 			 	d:d!eGd"eeHd#eeHd$eGd%eeHde
eHfd&d'�ZId#eeHd$eGdeGfd(d)�ZJ				 d;d*eeGd+eeHd,eeHd-eeHd.eGdeGfd/d0�ZKd1e
e*d2ee
eHddfd3d4�ZLd5eMd6eGd7eGdeHfd8d9�ZNdS)<�N)�
SUPPRESS_HELP�Values)�Iterable�List�Optional)�canonicalize_name)�
WheelCache)�
cmdoptions)�make_target_python)�RequirementCommand�warn_if_run_as_root�with_cleanup)�ERROR�SUCCESS)�CommandError�InstallationError)�
get_scheme)�get_environment)�
FormatControl)�ConflictDetails�check_install_conflicts)�install_given_reqs)�InstallRequirement)�get_requirement_tracker)�WINDOWS)�parse_distutils_args��test_writable_dir)�	getLogger)�
ensure_dir�get_pip_version�(protect_pip_from_modification_on_windows�write_output)�
TempDirectory)�running_under_virtualenv�virtualenv_no_global)�BinaryAllowedPredicate�build� should_build_for_install_command�format_control�returncsdtdtf�fdd�}|S)N�reqr*cs t|jpd�}��|�}d|vS)N��binary)r�name�get_allowed_formats)r+�canonical_name�allowed_formats�r)��@/usr/lib/python3/dist-packages/pip/_internal/commands/install.py�check_binary_allowed5s
z6get_check_binary_allowed.<locals>.check_binary_allowed)r�bool)r)r5r3r2r4�get_check_binary_allowed4sr7c@s�eZdZdZdZddd�Zededee	de
fd	d
��Zde	ded
e
ddfdd�Zdeedeefdd�Zdede	ddfdd�ZdS)�InstallCommandaI
    Install packages from:

    - PyPI (and other indexes) using requirement specifiers.
    - VCS project urls.
    - Local project directories.
    - Local or remote source archives.

    pip also supports installing from "requirements files", which provide
    an easy way to specify a whole environment to be installed.
    a%
      %prog [options] <requirement specifier> [package-index-options] ...
      %prog [options] -r <requirements file> [package-index-options] ...
      %prog [options] [-e] <vcs project url> ...
      %prog [options] [-e] <local project path> ...
      %prog [options] <archive url/path> ...r*NcCsj|j�t���|j�t���|j�t���|j�t���|j�t���|jjddddddd�t�|j�|jjddd	d
d�|jjddd
t	d�|jjdddddd�|jjdddddd�|j�t�
��|jjdddd	dd�|jjdddddgdd�|jjddd	d d�|jjd!d"d#d	d$d�|j�t���|j�t���|j�t�
��|j�t���|j�t���|j�t���|jjd%d	d&d'd(d)�|jjd*d
d&d+d,�|jjd-d
d.d'd/d)�|jjd0d
d1d'd2d)�|j�t���|j�t���|j�t���|j�t���|j�t���t�tj|j�}|j�d3|�|j�d3|j�dS)4Nz-tz--target�
target_dir�dirz�Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions.)�dest�metavar�default�helpz--user�
use_user_site�
store_truez�Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python documentation for site.USER_BASE for full details.))r;�actionr>z	--no-user�store_falsez--root�	root_pathz=Install everything relative to this alternate root directory.z--prefix�prefix_pathzIInstallation prefix where lib, bin and other top-level folders are placedz-Uz	--upgrade�upgradez�Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.z--upgrade-strategy�upgrade_strategyzonly-if-needed�eageraGDetermines how dependency upgrading should be handled [default: %default]. "eager" - dependencies are upgraded regardless of whether the currently installed version satisfies the requirements of the upgraded package(s). "only-if-needed" -  are upgraded only when they do not satisfy the requirements of the upgraded package(s).)r;r=�choicesr>z--force-reinstall�force_reinstallz;Reinstall all packages even if they are already up-to-date.z-Iz--ignore-installed�ignore_installedz�Ignore the installed packages, overwriting them. This can break your system if the existing package is of a different version or was installed with a different package manager!z	--compile�compileTz'Compile Python source files to bytecode)rAr;r=r>z--no-compilez.Do not compile Python source files to bytecode)rAr;r>z--no-warn-script-location�warn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflicts�warn_about_conflictsz%Do not warn about broken dependenciesr)�cmd_opts�
add_optionr	�requirements�constraints�no_deps�pre�editable�add_target_python_optionsr�src�ignore_requires_python�no_build_isolation�
use_pep517�
no_use_pep517�install_options�global_options�	no_binary�only_binary�
prefer_binary�require_hashes�progress_bar�make_option_group�index_group�parser�insert_option_group)�self�
index_optsr3r3r4�add_optionsQs��
��������
�����zInstallCommand.add_options�options�argsc)s.|jr|jdurtd��t�|�d}|jr|j}tj|dd�|jp$g}t	�
dt��t|j|j
|j|j|jd�|_d}d}|jrld|_tj�|j�|_tj�|j�r_tj�|j�s_td��tdd	�}|j}|�|�|jppg}|�|�}t|�}	|j|||	|jd
�}
t|j|j�}|�t ��}t|j!ddd�}
�z<|�"|||
|�}|D]}d|_#q�t$||j�|j%|
||||
|j|j&d
�}|j'||
|||j|j|j|j(||j)d�
}|�*|
�|j+||jd�}z|�,d�}Wnt-y�d}Ynw|j.du}t/|d�t0|
j���fdd�|j1�2�D�}t3||dggd�\}}dd�|D�}|�r/t4d�5d�6|����|D]
}|j)�s:d|_7�q1|�8|�}d}|j9�oJ|j:}|�rS|�;|�}|j<}|j�s^|j
�r`d}t=||||j||j
||j|j>d�	}t?|j||j|j
|jd�}t@|�} |jAtB�Cd�d�g}!|D]*}"|"jD}#z| �E|#�}$|$du�r�|#�d|$jF��}#Wn
tG�y�Ynw|!�H|#��q�|du�r�|jI||�J|�d�d �6|!�}%|%�r�tKd!|%�Wn(tL�y�}&z|j&d"k}'tM|&|'|j�}(t	jN|(|'d#�tOWYd}&~&Sd}&~&ww|j�r|�s	J�|�P|j||j�tQ�tRS)$Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT)�check_targetzUsing %s)rDr9rC�
isolated_modez=Target path exists but is not a directory, will not continue.�target)�kind)ri�session�
target_pythonrW�install)�deletern�globally_managed)�temp_build_dirri�req_trackerro�finderr?�	verbosity)
�preparerrvri�wheel_cacher?rJrWrIrFrY)�check_supported_wheels�pipF)�
modifying_pipcsg|]	}t|��r|�qSr3)r(��.0�r�r5r3r4�
<listcomp>cs��z&InstallCommand.run.<locals>.<listcomp>)ry�verify�
build_optionsr\cSsg|]}|jr|j�qSr3)rYr.r}r3r3r4r�ss
��zYCould not build wheels for {}, which is required to install pyproject.toml-based projectsz, i� )�root�home�prefixrLr?�	pycompile)�userr�r�r��isolatedr.)�key�-)�resolver_variant� zSuccessfully installed %s�)�exc_info)Sr?r9rr	�check_install_build_globalrErF�check_dist_restrictionr[�logger�verboser �decide_user_installrDrCrlrJ�os�path�abspath�exists�isdirr#�
enter_contextr\�get_default_sessionr
�_build_package_finderrWr�	cache_dirr)r�no_clean�get_requirements�permit_editable_wheels�'reject_location_related_install_options�make_requirement_preparerrw�
make_resolverrIrY�trace_basic_info�resolve�get_requirement�KeyError�satisfied_byr!r7rP�valuesr'r�format�join�legacy_install_reason�get_installation_order�ignore_dependenciesrM�_determine_conflictsrLrrK�get_lib_location_guessesr�sort�operator�
attrgetterr.�get_distribution�version�	Exception�append�_warn_about_conflicts�determine_resolver_variantr"�OSError�create_os_error_message�errorr�_handle_target_dirrr))rfrirjrFr[�target_temp_dir�target_temp_dir_pathr\rorprvryru�	directory�reqsr+rx�resolver�requirement_set�pip_reqr|�
reqs_to_build�_�build_failures�pep517_build_failure_namesr�
to_install�	conflicts�should_warn_about_conflictsrL�	installed�
lib_locations�env�items�result�item�installed_dist�installed_descr��show_traceback�messager3r�r4�run�sh

����



���	�

��



�
�
���
�
�
��

��
�
��
���

�zInstallCommand.runr9r�rEcsHt|�g}td|jd�}|j}|j}|j}tj�|�r!|�|�tj�|�r0||kr0|�|�tj�|�r;|�|�|D]d}	t�	|	�D]\}
|	|kratj�
||
��t�fdd�|dd�D��raqDtj�
||
�}tj�|�r�|swt�
d|�qDtj�|�r�t�
d|�qDtj�|�r�t�|�nt�|�t�tj�
|	|
�|�qDq=dS)Nr,)r�c3s�|]}|���VqdS�N)�
startswith)r~�s��ddirr3r4�	<genexpr>�s�z4InstallCommand._handle_target_dir.<locals>.<genexpr>���zKTarget directory %s already exists. Specify --upgrade to force replacement.z�Target directory %s already exists and is a link. pip will not automatically replace links, please remove if replacement is desired.)rrr��purelib�platlib�datar�r�r��listdirr��anyr��warning�islinkr��shutil�rmtree�remove�move)rfr9r�rE�lib_dir_list�scheme�purelib_dir�platlib_dir�data_dir�lib_dirr��target_item_dirr3r�r4r��sL


��
��z!InstallCommand._handle_target_dirr�cCs*zt|�WStyt�d�YdSw)NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)rr�r��	exception)rfr�r3r3r4r�
s
��z#InstallCommand._determine_conflicts�conflict_detailsr�c
Cs�|\}\}}|s|sdSg}|dkr|�d�n|dksJ�|�d�|D]}||d}||D]}	dj|||	dd�}
|�|
�q1q%|D](}||d}||D]\}}}
d	j|||
|||dkrdd
ndd�}
|�|
�qRqFt�d
�|��dS)N�legacyz�pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.z
2020-resolverz�pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.rz@{name} {version} requires {requirement}, which is not installed.r�)r.r��requirementzg{name} {version} requires {requirement}, but {you} have {dep_name} {dep_version} which is incompatible.�youzyou'll)r.r�r��dep_name�dep_versionr��
)r�r�r��criticalr�)rfr�r��package_set�missing�conflicting�parts�project_namer��
dependencyr�r�r�r+r3r3r4r�sL������z$InstallCommand._warn_about_conflicts)r*N)�__name__�
__module__�__qualname__�__doc__�usagerhr
rr�str�intr�r#r6r�rrrr�r�r3r3r3r4r8=s:
 g���
�6�
����r8Fr�r�r�r�r�cCs td|||||d�}|j|jgS)Nr,)r�r�r�r�r�)rr�r�)r�r�r�r�r�r�r3r3r4r�Ps�r�cCstdd�tt||d��D��S)Ncss�|]}t|�VqdSr�r)r~�dr3r3r4r�cs
��
�z)site_packages_writable.<locals>.<genexpr>�r�r�)�all�setr�rr3r3r4�site_packages_writablebs�r
r?rDr9rCrlcCs�|dur
|s
t�d�dS|r#|rtd��t�rtd��t�d�dS|dus)J�|s-|r4t�d�dStjs>t�d	�dSt||d
�rKt�d�dSt�d�dS)
aZDetermine whether to do a user install based on the input options.

    If use_user_site is False, no additional checks are done.
    If use_user_site is True, it is checked for compatibility with other
    options.
    If use_user_site is None, the default behaviour depends on the environment,
    which is provided by the other arguments.
    Nz$Non-user install by explicit requestFzVCan not combine '--user' and '--prefix' as they imply different installation locationszZCan not perform a '--user' install. User site-packages are not visible in this virtualenv.z User install by explicit requestTz3Non-user install due to --prefix or --target optionz4Non-user install because user site-packages disabledrz0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable)	r��debugrr%r�site�ENABLE_USER_SITEr
�info)r?rDr9rCrlr3r3r4r�is8
��



�r�rPricCs�dttdttfdd�}g}|D]}|j}t|�}|r)|�d�||���|��q|r>t|�}|r>|�d�||�����|sBdStd�d	�	|����)
z�If any location-changing --install-option arguments were passed for
    requirements or on the command-line, then show a deprecation warning.
    �option_namesr*cSsdd�|D�S)NcSsg|]}d�|�dd���qS)z--{}r�r�)r��replace)r~r.r3r3r4r��szSreject_location_related_install_options.<locals>.format_options.<locals>.<listcomp>r3)rr3r3r4�format_options�sz?reject_location_related_install_options.<locals>.format_optionsz{!r} from {}z{!r} from command lineNz�Location-changing options found in --install-option: {}. This is unsupported, use pip-level options like --user, --prefix, --root, and --target instead.z; )
rrrr[rr�r��keysrr�)rPrir�	offendersr�r[�location_optionsr3r3r4r��s0�����r�r�r��using_user_sitecCs�g}|�d�|s|�d�|�t|��n|�d�|dd7<|jtjkrGd}d}t�s=|s=|�|d|��g�n|�|�|�d	�tr^|jtjkr^|j	r^t
|j	�d
kr^|�d�d�|���dS)
zrFormat an error message for an OSError

    It may occur anytime during the execution of the install command.
    z,Could not install packages due to an OSErrorz: �.r�r�z"Consider using the `--user` optionzCheck the permissionsz or z.
iz�HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths
r,)
r�r�errno�EACCESr$�extend�lowerr�ENOENT�filename�lenr��strip)r�r�rr��user_option_part�permissions_partr3r3r4r��s:



��

���r�)FNNFN)NNNF)Orr�r�r�r�optparserr�typingrrr�pip._vendor.packaging.utilsr�pip._internal.cacher�pip._internal.clir	�pip._internal.cli.cmdoptionsr
�pip._internal.cli.req_commandrrr
�pip._internal.cli.status_codesrr�pip._internal.exceptionsrr�pip._internal.locationsr�pip._internal.metadatar�#pip._internal.models.format_controlr�pip._internal.operations.checkrr�pip._internal.reqr�pip._internal.req.req_installr�pip._internal.req.req_trackerr�pip._internal.utils.compatr�"pip._internal.utils.distutils_argsr�pip._internal.utils.filesystemr�pip._internal.utils.loggingr�pip._internal.utils.miscrr r!r"�pip._internal.utils.temp_dirr#�pip._internal.utils.virtualenvr$r%�pip._internal.wheel_builderr&r'r(r�r�r7r8r6rr�r
r�r�r�r�r3r3r3r4�<module>s�	������
�	������
�=�
�
�'����