a
    |Ä#d…~  ã                   @   s„  d dl 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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 d dlmZ d d	lmZmZmZ d d
lmZ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 dl)m*Z* d dl+m,Z,m-Z- d dl.m/Z/ d dl0m1Z1m2Z2m3Z3 d dl4m5Z5 d dl6m7Z7m8Z8 d dl9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@mAZAmBZBmCZCmDZD d dlEmFZF d dlGmHZHmIZI d dlJmKZKmLZLmMZM e>eNƒZOe&eKdœdd„ZPG d d!„ d!eƒZQd2eReeS eeS eReeS eeS d#œd$d%„ZTeeS eReRd&œd'd(„ZUd3eeR eeS eeS eeS eReRd)œd*d+„ZVee1 eeeS  dd,œd-d.„ZWeXeReReSd/œd0d1„ZYdS )4é    N)ÚSUPPRESS_HELPÚValues)ÚIterableÚListÚOptional)Úcanonicalize_name)Ú
print_json)Ú
WheelCache)Ú
cmdoptions)Úmake_target_python)ÚRequirementCommandÚwarn_if_run_as_rootÚwith_cleanup)ÚERRORÚSUCCESS)ÚCommandErrorÚInstallationError)Ú
get_scheme)Úget_environment)ÚFormatControl)ÚInstallationReport)Úget_build_tracker)ÚConflictDetailsÚcheck_install_conflicts)Úinstall_given_reqs)ÚInstallRequirementÚLegacySetupPyOptionsCheckModeÚcheck_legacy_setup_py_options)ÚWINDOWS)Ú#LegacyInstallReasonFailedBdistWheelÚ
deprecated)Úparse_distutils_args©Útest_writable_dir)Ú	getLogger)Úcheck_externally_managedÚ
ensure_dirÚget_pip_versionÚ(protect_pip_from_modification_on_windowsÚwrite_output)ÚTempDirectory)Úrunning_under_virtualenvÚvirtualenv_no_global)ÚBdistWheelAllowedPredicateÚbuildÚ should_build_for_install_command)Úformat_controlÚreturnc                    s   t tdœ‡ fdd„}|S )N)Úreqr1   c                    s    t | jp
dƒ}ˆ  |¡}d|v S )NÚ Úbinary)r   ÚnameÚget_allowed_formats)r2   Úcanonical_nameÚallowed_formats©r0   © úU/var/www/html/gsl.tools/lib/python3.9/site-packages/pip/_internal/commands/install.pyÚcheck_binary_allowedC   s    
z;get_check_bdist_wheel_allowed.<locals>.check_binary_allowed)r   Úbool)r0   r<   r:   r9   r;   Úget_check_bdist_wheel_allowed@   s    r>   c                   @   sz   e Zd ZdZdZddœdd„Zeeee	 e
dœdd	„ƒZe	eedd
œdd„Zee ee dœdd„Zee	ddœdd„ZdS )Ú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> ...N)r1   c                 C   sÖ  | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j jdddddd� | j jddd	d
d dd� t | j ¡ | j jddddd� | j jdddt	d� | j jddd
d dd� | j jddd
d dd� | j  t 
¡ ¡ | j jdddddd� | j jddddd gd!d"� | j jd#d$dd%d� | j jd&d'd(dd)d� | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j jd*dd+d,d-d� | j jd.dd+d/d0� | j jd1dd2d,d3d� | j jd4dd5d,d6d� | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ | j  t ¡ ¡ t tj| j¡}| j d7|¡ | j d7| j ¡ | j jd8d9d:d d;d� d S )<Nz	--dry-runÚ
store_trueÚdry_runFzŒDon't actually install anything, just print what would be. Can be used in combination with --ignore-installed to 'resolve' the requirements.)ÚactionÚdestÚdefaultÚhelpz-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.)rC   ÚmetavarrD   rE   z--userÚuse_user_sitez¸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.))rC   rB   rE   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_strategyzonly-if-neededÚeageraG  Determines 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).)rC   rD   ÚchoicesrE   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 bytecodez--no-compilez.Do not compile Python source files to bytecode)rB   rC   rE   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   z--reportÚjson_report_fileÚfileaW  Generate a JSON file describing what pip did to install the provided requirements. Can be used in combination with --dry-run and --ignore-installed to 'resolve' the requirements. When - is used as file name it writes to stdout. When writing to stdout, please combine with the --quiet option to avoid mixing pip logging output with JSON output.)Ú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Úcheck_build_depsÚoverride_externally_managedÚconfig_settingsÚinstall_optionsÚglobal_optionsÚ	no_binaryÚonly_binaryÚprefer_binaryÚrequire_hashesÚprogress_barÚroot_user_actionÚmake_option_groupÚindex_groupÚparserÚinsert_option_group)ÚselfÚ
index_optsr:   r:   r;   Úadd_options_   s   úùûüûúúúüúûüûûþúzInstallCommand.add_options)ÚoptionsÚargsr1   c           -         sn  |j r|jd urtdƒ‚|jo"|j oB|jd u oB|jd u oB|jd u }|rT|jsTtƒ  d}|j	rd|j
}tj|dd� |jpzg }t dtƒ ¡ t|j |j|j|j|jd�|_ d }d }|j�rd|_tj |j¡|_tj |j¡ròtj |j¡sòtdƒ‚tdd	�}|j}|  |¡ |j�pg }|  |¡}	t|ƒ}
| j||	|
|jd
�}|  t ƒ ¡}t|j! ddd�}�z„|  "||||	¡}t#||t$j%ƒ d|j&v �r–t'|j(ƒ}n*|j)j*�r²t+dddddd� t'|j(|j)ƒ}|D ]}d|_,�qÄt-||jƒ | j.||||	||j | j/d�}| j0|||||j |j|j|j1||j2d�
}|  3|¡ |j4||j d�}|j�r´t5|j6ƒ}|jdk�rlt7| 8¡ d� nHt9|jddd��&}t:j;| 8¡ |ddd� W d   ƒ n1 �sª0    Y  |j�röt<dd„ |j6D ƒƒ}|�rðt=d d! >d"d„ |D ƒ¡ƒ t?W S z| @d#¡}W n tA�y   d}Y n0 |jBd u }tC|d$� tD|j)ƒ‰ ‡ fd%d&„|jE F¡ D ƒ}tG||dg |d'�\}}d(d&„ |D ƒ}|�r’tHd) Id* >|¡¡ƒ‚|D ]}|j2�s–tJ|_K�q–| L|¡}d }|jM �oÈ|jN} | �rÚ|  O|¡}|jP}!|j�sð|j�rôd}!tQ||||j||j|!|j |jRd+�	}"tS|j ||j|j|jd,�}#tT|#ƒ}$|"jUtV Wd-¡d.� g }%|"D ]T}&|&jX}'z(|$ Y|'¡}(|(d u�r‚|'› d|(jZ› �}'W n t[�y˜   Y n0 |% \|'¡ �qR|d u�rÆ| j]||  ^|¡d/� d! >|%¡})|)�ràt=d0|)ƒ W nP t_�y2 }* z6| j/d1k}+t`|*|+|j ƒ},tja|,|+d2� tbW  Y d }*~*S d }*~*0 0 |j�rX|�sFJ ‚|  c|j||j	¡ |jdd3k�rjteƒ  t?S )4Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT)Úcheck_targetzUsing %s)rL   rF   rK   Úisolated_modez=Target path exists but is not a directory, will not continue.Útarget)Úkind)rw   ÚsessionÚtarget_pythonra   Úinstall)Údeleter|   Úglobally_managedzno-binary-enable-wheel-cachezŒ--no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary will not influence the wheel cache.z to use the --no-cache-dir optioni½,  z23.1)ÚreasonÚreplacementÚfeature_flagÚissueÚgone_in)Útemp_build_dirrw   Úbuild_trackerr}   ÚfinderrI   Ú	verbosity)
Úpreparerr‰   rw   Úwheel_cacherI   rR   ra   rQ   rN   rc   )Úcheck_supported_wheelsú-)ÚdataÚwzutf-8)Úencodingé   F)ÚindentÚensure_asciic                 s   s"   | ]}|j d  |j d fV  qdS )r5   ÚversionN)Úmetadata©Ú.0Úrr:   r:   r;   Ú	<genexpr>°  s   ÿz%InstallCommand.run.<locals>.<genexpr>zWould install %sú c                 s   s   | ]}d   |¡V  qdS )rŽ   N)Újoin)r˜   Úitemr:   r:   r;   rš   ·  ó    Úpip)Úmodifying_pipc                    s   g | ]}t |ˆ ƒr|‘qS r:   )r/   r—   ©Úcheck_bdist_wheel_allowedr:   r;   Ú
<listcomp>É  s   
þz&InstallCommand.run.<locals>.<listcomp>)rŒ   ÚverifyÚbuild_optionsri   c                 S   s   g | ]}|j r|j‘qS r:   )rc   r5   r—   r:   r:   r;   r£   Ù  s   zYCould not build wheels for {}, which is required to install pyproject.toml-based projectsz, )ÚrootÚhomeÚprefixrT   rI   Ú	pycompile)Úuserr§   r¦   r¨   Úisolatedr5   )Úkey)Úresolver_variantzSuccessfully installed %sé   )Úexc_infoÚwarn)frI   rF   r   rA   rV   rK   rL   rf   r%   rM   rN   r
   Úcheck_dist_restrictionrh   ÚloggerÚverboser'   Údecide_user_installrz   rR   ÚosÚpathÚabspathÚexistsÚisdirr*   Úenter_contextri   Úget_default_sessionr   Ú_build_package_finderra   r   Úno_cleanÚget_requirementsr   r   ÚINSTALLÚfeatures_enabledr	   Ú	cache_dirr0   rj   r    Úpermit_editable_wheelsÚ'reject_location_related_install_optionsÚmake_requirement_preparerrŠ   Úmake_resolverrQ   rc   Útrace_basic_infoÚresolver   Úrequirements_to_installr   Úto_dictÚopenÚjsonÚdumpÚsortedr)   rœ   r   Úget_requirementÚKeyErrorÚsatisfied_byr(   r>   rZ   Úvaluesr.   r   Úformatr   Úlegacy_install_reasonÚget_installation_orderÚignore_dependenciesrU   Ú_determine_conflictsrT   r   rS   Úget_lib_location_guessesr   ÚsortÚoperatorÚ
attrgetterr5   Úget_distributionr•   Ú	ExceptionÚappendÚ_warn_about_conflictsÚdetermine_resolver_variantÚOSErrorÚcreate_os_error_messageÚerrorr   Ú_handle_target_dirro   r   )-rt   rw   rx   Z#installing_into_current_environmentrN   rh   Útarget_temp_dirÚtarget_temp_dir_pathri   r}   r~   r‰   rˆ   Ú	directoryÚreqsrŒ   r2   r‹   ÚresolverÚrequirement_setÚreportÚfÚwould_install_itemsÚpip_reqr    Úreqs_to_buildÚ_Úbuild_failuresÚpep517_build_failure_namesr™   Ú
to_installÚ	conflictsÚshould_warn_about_conflictsrT   Ú	installedÚlib_locationsÚenvÚitemsÚresultr�   Úinstalled_distÚinstalled_descrâ   Úshow_tracebackÚmessager:   r¡   r;   Úrun  s®   ÿþüÿþ
ûþýÿ


üýÿ
÷
ù	ö
ÿ
6þþ


ÿ
þû

ÿþÿ


ÿ
÷û


þ
þ
ý

ÿzInstallCommand.run)rF   rä   rM   r1   c                    sN  t |ƒ g }td|jd�}|j}|j}|j}tj |¡rB| |¡ tj |¡r`||kr`| |¡ tj |¡rv| |¡ |D ]Î}	t 	|	¡D ]¾}
|	|krÂtj 
||
¡‰ t‡ fdd„|d d… D ƒƒrÂqˆtj 
||
¡}tj |¡�r0|sðt d|¡ qˆtj |¡�rt d|¡ qˆtj |¡�r&t |¡ n
t |¡ t tj 
|	|
¡|¡ qˆqzd S )Nr3   )r§   c                 3   s   | ]}|  ˆ ¡V  qd S ©N)Ú
startswith)r˜   Ús©Úddirr:   r;   rš   X  rž   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.)r&   r   r¶   ÚpurelibÚplatlibr�   rµ   r¸   rÝ   Úlistdirrœ   Úanyr²   ÚwarningÚislinkr¹   ÚshutilÚrmtreeÚremoveÚmove)rt   rF   rä   rM   Úlib_dir_listÚschemeÚpurelib_dirÚplatlib_dirÚdata_dirÚlib_dirr�   Útarget_item_dirr:   r  r;   rã   =  sH    


ýû
z!InstallCommand._handle_target_dir)rò   r1   c                 C   s.   z
t |ƒW S  ty(   t d¡ Y d S 0 d S )NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)r   rÜ   r²   Ú	exception)rt   rò   r:   r:   r;   rÖ   s  s    
ÿz#InstallCommand._determine_conflicts)Úconflict_detailsr­   r1   c              
   C   sò   |\}\}}|s|sd S g }|dkr0|  d¡ n|dks<J ‚|  d¡ |D ]<}|| d }|| D ]"}	dj|||	d d�}
|  |
¡ qbqJ|D ]P}|| d }|| D ]6\}}}d	j||||||dkrÈd
ndd�}
|  |
¡ q¤qŒt d |¡¡ d S )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.r   z@{name} {version} requires {requirement}, which is not installed.r®   )r5   r•   Úrequirementzg{name} {version} requires {requirement}, but {you} have {dep_name} {dep_version} which is incompatible.Úyouzyou'll)r5   r•   r  Údep_nameÚdep_versionr  Ú
)rÝ   rÒ   r²   Úcriticalrœ   )rt   r  r­   Úpackage_setÚmissingÚconflictingÚpartsÚproject_namer•   Ú
dependencyrý   r  r  r2   r:   r:   r;   rÞ     sH    ÿÿÿúÿ÷z$InstallCommand._warn_about_conflicts)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úusagerv   r   r   r   ÚstrÚintrþ   r*   r=   rã   r   r   r   rÖ   rÞ   r:   r:   r:   r;   r?   K   s"    >  #þ7þþr?   F)rª   r§   r¦   r«   r¨   r1   c                 C   s    t d| ||||d�}|j|jgS )Nr3   )rª   r§   r¦   r«   r¨   )r   r  r  )rª   r§   r¦   r«   r¨   r  r:   r:   r;   r×   ¶  s    úr×   )r¦   r«   r1   c                 C   s   t dd„ tt| |d�ƒD ƒƒS )Nc                 s   s   | ]}t |ƒV  qd S rÿ   r"   )r˜   Údr:   r:   r;   rš   É  s   ÿz)site_packages_writable.<locals>.<genexpr>©r¦   r«   )ÚallÚsetr×   r-  r:   r:   r;   Úsite_packages_writableÈ  s    þr0  )rI   rL   rF   rK   rz   r1   c                 C   s¤   | dur| st  d¡ dS | rF|r*tdƒ‚tƒ r8tdƒ‚t  d¡ dS | du sRJ ‚|sZ|rht  d¡ dS tjs|t  d	¡ dS t||d
�r–t  d¡ dS t  d¡ dS )aZ  Determine 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 disabledr-  z0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable)	r²   Údebugr   r,   r   ÚsiteÚENABLE_USER_SITEr0  Úinfo)rI   rL   rF   rK   rz   r:   r:   r;   r´   Ï  s8    
ÿÿ



ÿr´   )rZ   rw   r1   c                 C   sš   t t tt dœdd„}g }| D ]0}|j}t|ƒ}|r | d || ¡ ƒ|¡¡ q |rzt|ƒ}|rz| d || ¡ ƒ¡¡ |s‚dS td d 	|¡¡ƒ‚dS )	z’If any location-changing --install-option arguments were passed for
    requirements or on the command-line, then show a deprecation warning.
    )Úoption_namesr1   c                 S   s   dd„ | D ƒS )Nc                 S   s   g | ]}d   | dd¡¡‘qS )z--{}rï   rŽ   )rÒ   Úreplace)r˜   r5   r:   r:   r;   r£     rž   zSreject_location_related_install_options.<locals>.format_options.<locals>.<listcomp>r:   )r5  r:   r:   r;   Úformat_options  s    z?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; )
r   r*  r   rh   r!   rÝ   rÒ   Úkeysr   rœ   )rZ   rw   r7  Ú	offendersr  rh   Úlocation_optionsr:   r:   r;   rÃ     s0    ÿÿÿþÿrÃ   )râ   rü   Úusing_user_siter1   c                 C   sÎ   g }|  d¡ |s,|  d¡ |  t| ƒ¡ n
|  d¡ |d  d7  < | jtjkrŽd}d}tƒ sz|sz| |d| ¡ g¡ n
|  |¡ |  d	¡ tr¼| jtjkr¼| j	r¼t
| j	ƒd
kr¼|  d¡ d |¡ ¡ d S )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` optionzCheck the permissionsz or z.
i  zÉ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
r3   )rÝ   r*  ÚerrnoÚEACCESr+   ÚextendÚlowerr   ÚENOENTÚfilenameÚlenrœ   Ústrip)râ   rü   r;  r"  Úuser_option_partÚpermissions_partr:   r:   r;   rá   3  s>    



ýÿ

ÿ
þýüÿrá   )FNNFN)NNNF)Zr=  rË   rÙ   rµ   r  r2  Úoptparser   r   Útypingr   r   r   Zpip._vendor.packaging.utilsr   Úpip._vendor.richr   Úpip._internal.cacher	   Úpip._internal.clir
   Zpip._internal.cli.cmdoptionsr   Úpip._internal.cli.req_commandr   r   r   Úpip._internal.cli.status_codesr   r   Úpip._internal.exceptionsr   r   Úpip._internal.locationsr   Úpip._internal.metadatar   Ú#pip._internal.models.format_controlr   Ú(pip._internal.models.installation_reportr   Ú,pip._internal.operations.build.build_trackerr   Úpip._internal.operations.checkr   r   Úpip._internal.reqr   Zpip._internal.req.req_installr   r   r   Úpip._internal.utils.compatr   Úpip._internal.utils.deprecationr   r    Ú"pip._internal.utils.distutils_argsr!   Úpip._internal.utils.filesystemr#   Úpip._internal.utils.loggingr$   Úpip._internal.utils.miscr%   r&   r'   r(   r)   Úpip._internal.utils.temp_dirr*   Úpip._internal.utils.virtualenvr+   r,   Úpip._internal.wheel_builderr-   r.   r/   r%  r²   r>   r?   r=   r*  r×   r0  r´   rÃ   rà   rá   r:   r:   r:   r;   Ú<module>   s’   þ    p     ûú	    ûú>þ(þ