U ÀÒ.eï_ã@sØddlmZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZmZmZdd lmZddl m!Z!ddl"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5e1�r’ddl m6Z6ddl7m8Z8m9Z9m:Z:ddl;mZ>ddl4m?Z?e @eA¡ZBdd„ZCdd„ZDd d!„ZEGd"d#„d#eƒZFd$d%„ZGd&d'„ZHdS)(é)Úabsolute_importN)Úpath)Ú SUPPRESS_HELP)Ú pkg_resources)Úcanonicalize_name)Ú WheelCache)Ú cmdoptions)Úmake_target_python)ÚRequirementCommand)ÚERRORÚSUCCESS)Ú CommandErrorÚInstallationErrorÚPreviousBuildDirError©Údistutils_scheme)Úcheck_install_conflicts)ÚRequirementSetÚinstall_given_reqs)ÚRequirementTracker)Úcheck_path_owner)Ú ensure_dirÚget_installed_versionÚ(protect_pip_from_modification_on_windowsÚ write_output)Ú TempDirectory)ÚMYPY_CHECK_RUNNING)Úvirtualenv_no_global)Ú WheelBuilder)ÚValues)ÚAnyÚListÚOptional)Ú FormatControl)ÚInstallRequirement)ÚBinaryAllowedPredicatecCs(z ddl}Wntk r"YdSXdS)z8 Return whether the wheel package is installed. rNFT)ÚwheelÚ ImportError)r&©r(úB/usr/lib/python3.8/site-packages/pip/_internal/commands/install.pyÚis_wheel_installed<s  r*cCs*tƒ}|j|dd�}|r&|j|dd�|S)zQ Build wheels for requirements, depending on whether wheel is installed. T)Z should_unpack)r*Zbuild)ÚbuilderÚpep517_requirementsÚlegacy_requirementsZshould_build_legacyÚbuild_failuresr(r(r)Ú build_wheelsHs þþr/cs‡fdd„}|S)Ncs&|jr dSt|jƒ}ˆ |¡}d|kS)NTZbinary)Ú use_pep517rÚnameZget_allowed_formats)ÚreqZcanonical_nameZallowed_formats©Úformat_controlr(r)Úcheck_binary_allowedhs   z6get_check_binary_allowed..check_binary_allowedr()r4r5r(r3r)Úget_check_binary_allowedfs r6cs<eZdZdZdZ‡fdd„Zdd„Zdd„Zd d „Z‡Z 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] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...cs^tt|ƒj||Ž|j}| t ¡¡| t ¡¡| t ¡¡| t  ¡¡| t  ¡¡|jddddddd�t  |¡|jddd d d �|jd dd t d �|jdddddd�|jdddddd�| t  ¡¡| t ¡¡|jdddd dd �|jdddddgdd�|jddd d d �|jd!d"d#d d$d �| t ¡¡| t ¡¡| t ¡¡| t ¡¡| t ¡¡| t ¡¡|jd%d d&d'd(d)�|jd*d d&d+d,�|jd-d d.d'd/d)�|jd0d d1d'd2d)�| t ¡¡| t ¡¡| t ¡¡| t ¡¡| t ¡¡| t ¡¡t tj|j¡}|j d3|¡|j d3|¡dS)4Nz-tz--targetÚ target_dirÚdirz¥Install packages into . By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in with new versions.)ÚdestÚmetavarÚdefaultÚhelpú--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-userZ 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-neededZeageraGDetermines 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)Úsuperr7Ú__init__Úcmd_optsZ add_optionrÚ requirementsZ constraintsZno_depsZpreZeditableZadd_target_python_optionsrÚ build_dirÚsrcÚignore_requires_pythonZno_build_isolationr0Z no_use_pep517Úinstall_optionsÚglobal_optionsZ no_binaryZ only_binaryZ prefer_binaryÚno_cleanÚrequire_hashesZ progress_barZmake_option_groupZ index_groupÚparserZinsert_option_group)ÚselfÚargsÚkwrNZ index_opts©Ú __class__r(r)rM‡sèû üüûûü ûüü ûüûûþzInstallCommand.__init__c*Csþt |¡dd„}t ¡dkrZ|ƒsZt tjd¡}|dkrLt tj¡d}t   d|¡d}|j rj|j }|j r€tj |j ¡|_ tj|dd �tj |j¡|_|jp¦g}|jrÞ|jr¼td ƒ‚tƒrÊtd ƒ‚| d ¡| d ¡d}d}|j�rJd|_tj |j¡|_tj |j¡�r,tj |j¡�s,tdƒ‚tdd�}|j}| d|¡|j�pTg} | |¡} t|ƒ} |j || | |j!d�} |j"�pˆ|j } t#|j$|j%ƒ}|j$�rÂt&|j$ƒ�sÂt   d|j$¡d|_$t'ƒ��}t|j | dd���ò}t(|j)|j d�}�z¼�z*| ,|||| | |¡|j-|||d�}|j.|| | |||j|j|j!|j/||j0d� }| 1|¡z| 2d¡}Wnt3k �rzd}Yn X|j4dk}t5|d�t6| j%ƒ}g}g}|j7 8¡D]$}|j0�rÄ| |¡n | |¡�q¬t9||gg|d�}t:|||d�}|�rtd ;d  �o.|j?}|�r@| @|¡|jA}|j�rRd!}tB||| |jC||j|jD||jd"� }tE|j||jC|j|jFd#�} tG H| ¡}!tI|tJ Kd$¡d%�}"g}#|"D]R}|jL}$z$tM|jL|!d&�}%|%�rÞ|$d'|%7}$WntNk �röYnX|# |$¡�q²d( <|#¡}&|&�r tOd)|&ƒWnŠtPk �r�}'zN|jQd*k}(tR|'|(|jƒ})t jS|)|(d+�tTWY¢W¢HW5QR£W5QR£Sd}'~'XYntUk �r¬d|_"‚YnXW5|j"�sÊ| *¡| +¡XW5QRXW5QRX|j�rú| V|j||j ¡tWS),NcSs ttdƒpttdƒotjtjkS)NZ real_prefixÚ base_prefix)ÚhasattrÚsysr]Úprefixr(r(r(r)Úis_venvs   þz#InstallCommand.run..is_venvrz __main__.pyz -m pipzgRunning pip install with root privileges is generally not a good idea. Try `%s install --user` instead.zto-satisfy-onlyT)Z check_targetzVCan 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.r>z --prefix=z=Target path exists but is not a directory, will not continue.Útarget)Úkindz--home=)ÚoptionsÚsessionÚ target_pythonrRzÝThe directory '%s' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.Zinstall)Údeleterc)rVZcheck_supported_wheels)Ztemp_build_dirrdÚ req_tracker) ÚpreparerÚfinderrerdÚ wheel_cacher?rHrRrGrEr0Zpip)Ú modifying_pip)Z build_optionsrTr5)r+r,r-zPCould not build wheels for {} which use PEP 517 and cannot be installed directlyz, css|] }|jVqdS©N)r1)Ú.0Úrr(r(r)Ú ½sz%InstallCommand.run..F)ÚrootÚhomer`Z pycompilerJr?)Úuserrrrqr`Úisolatedr1)Úkey)Ú working_setú-ú zSuccessfully installed %sé©Úexc_info)XrZcheck_install_build_globalÚosÚgetuidrÚbasenamer_ÚargvÚ executableÚloggerÚwarningrDrErPÚabspathZcheck_dist_restrictionZsrc_dirrSr?rCr rrÚappendr8rHÚexistsÚisdirrrTZget_default_sessionr Z_build_package_finderrRrUrÚ cache_dirr4rrrrVZ cleanup_filesZcleanupZpopulate_requirement_setZmake_requirement_preparerZ make_resolverrGr0ZresolveZget_requirementÚKeyErrorZ satisfied_byrr6rOÚvaluesrr/ÚformatÚjoinZget_installation_orderZignore_dependenciesrKÚ_warn_about_conflictsrJrrBrIÚget_lib_location_guessesZ isolated_moderZ WorkingSetÚsortedÚoperatorÚ attrgetterr1rÚ ExceptionrÚEnvironmentErrorÚ verbosityÚcreate_env_error_messageÚerrorr rÚ_handle_target_dirr )*rXrdrYraZcommandrErSÚtarget_temp_dirZtarget_temp_dir_pathrTrerfrjZ build_deleterkrhZ directoryZrequirement_setriZresolverZpip_reqrlr5r-r,r2Z wheel_builderr.Ú to_installZshould_warn_about_conflictsrJZ installedZ lib_locationsrvZreqsÚitemsÚitemZinstalled_versionZinstalled_descr•Úshow_tracebackÚmessager(r(r)Úrunsœ þÿ ÿÿ   ÿÿ   üú ÿþþýõ   ÿÿ ýýþÿÿ þ ÷ û ÿ ÿ ÿ4 ÿzInstallCommand.runc sft|ƒg}|��Jtd|jd�}|d}|d}|d}tj |¡rP| |¡tj |¡rn||krn| |¡tj |¡r„| |¡|D]Î} t | ¡D]¾} | |krÐtj || ¡‰t‡fdd„|dd…DƒƒrÐq–tj || ¡} tj | ¡�r>|sþt   d | ¡q–tj  | ¡�rt   d | ¡q–tj  | ¡�r4t  | ¡n t | ¡t  tj | | ¡| ¡q–qˆW5QRXdS) NÚ)rrÚpurelibÚplatlibÚdatac3s|]}| ˆ¡VqdSrm)Ú startswith)rnÚs©Úddirr(r)rp+sz4InstallCommand._handle_target_dir..éÿÿÿÿ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.)rrrr|r…r„Úlistdirr‹Úanyr�r‚Úislinkr†ÚshutilZrmtreeÚremoveZmove) rXr8r—rDZ lib_dir_listÚschemeZ purelib_dirZ platlib_dirZdata_dirZlib_dirršZtarget_item_dirr(r¤r)r–sP     ýû   þz!InstallCommand._handle_target_dirc Cs¸zt|ƒ\}}Wn$tk r4tjddd�YdSX|\}}|D]2}||d}||D]}t d|||d¡qZqB|D]8}||d}||D]\} } } t d||| | | ¡q’qzdS)NzError checking for conflicts.Trzrz*%s %s requires %s, which is not installed.ryzF%s %s has requirement %s, but you'll have %s %s which is incompatible.)rr‘r�r•Zcritical) rXr˜Z package_setZ _dep_infoZmissingZ conflictingZ project_nameÚversionZ dependencyZdep_nameZ dep_versionr2r(r(r)rŒIs4  þ ýz$InstallCommand._warn_about_conflicts) Ú__name__Ú __module__Ú __qualname__Ú__doc__ZusagerMr�r–rŒÚ __classcell__r(r(r[r)r7ss  w8r7cOstd|ž|Ž}|d|dgS)NržrŸr )ržr)rYÚkwargsr¬r(r(r)r�dsr�cCsšg}| d¡|s,| d¡| t|ƒ¡n | d¡|dd7<|jtjkrˆd}d}|st| |d| ¡g¡n | |¡| d ¡d  |¡ ¡dS) z{Format an error message for an EnvironmentError It may occur anytime during the execution of the install command. z5Could not install packages due to an EnvironmentErrorz: Ú.r¦Ú z"Consider using the `--user` optionzCheck the permissionsz or z. rž)r„ÚstrÚerrnoZEACCESÚextendÚlowerr‹Ústrip)r•r›Zusing_user_siteÚpartsZuser_option_partZpermissions_partr(r(r)r”is&    þ  r”)IZ __future__rr·Zloggingr�r|rªr_rZoptparserZ pip._vendorrZpip._vendor.packaging.utilsrZpip._internal.cacherZpip._internal.clirZpip._internal.cli.cmdoptionsr Zpip._internal.cli.req_commandr Zpip._internal.cli.status_codesr r Zpip._internal.exceptionsr rrZpip._internal.locationsrZpip._internal.operations.checkrZpip._internal.reqrrZpip._internal.req.req_trackerrZpip._internal.utils.filesystemrZpip._internal.utils.miscrrrrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrZpip._internal.wheelrrÚtypingr r!r"Z#pip._internal.models.format_controlr#Zpip._internal.req.req_installr$r%Z getLoggerr®r�r*r/r6r7r�r”r(r(r(r)ÚsT                        t