B š•Re7pã@sddlmZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZddlmZdd lmZdd lmZmZdd lmZmZdd lmZmZdd lm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:m;Z;e6rÂddl mZ>m?Z?m@Z@ddlAmBZBddl!mCZCddlDmEZEddl9mFZFe GeH¡ZIdd „ZJGd!d"„d"eƒZKd.d$d%„ZLd&d'„ZMd/d(d)„ZNd*d+„ZOd,d-„ZPdS)0é)Úabsolute_importN)Úpath)Ú SUPPRESS_HELP)Ú pkg_resources)Úcanonicalize_name)Ú WheelCache)Ú cmdoptions)Úmake_target_python)ÚRequirementCommandÚ with_cleanup)ÚERRORÚSUCCESS)Ú CommandErrorÚInstallationError)Údistutils_scheme)Úcheck_install_conflicts)Úinstall_given_reqs)Úget_requirement_tracker)Útoday_is_later_than)Úparse_distutils_args)Útest_writable_dir)Ú ensure_dirÚget_installed_versionÚget_pip_versionÚ(protect_pip_from_modification_on_windowsÚ write_output)Ú TempDirectory)ÚMYPY_CHECK_RUNNING)Úvirtualenv_no_global)ÚbuildÚ should_build_for_install_command)ÚValues)ÚIterableÚListÚOptional)Ú FormatControl)ÚConflictDetails)ÚInstallRequirement)ÚBinaryAllowedPredicatecs‡fdd„}|S)Ncs&|jr dSt|jƒ}ˆ |¡}d|kS)NTÚbinary)Ú use_pep517rÚnameÚget_allowed_formats)ÚreqÚcanonical_nameÚallowed_formats)Úformat_control©ú/builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_internal/commands/install.pyÚcheck_binary_allowed8s   z6get_check_binary_allowed..check_binary_allowedr1)r0r3r1)r0r2Úget_check_binary_allowed6s r4c@s@eZdZdZdZdd„Zedd„ƒZdd„Zd d „Z 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] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...cCsz|j t ¡¡|j t ¡¡|j t ¡¡|j t ¡¡|j t ¡¡|jjdddddddt |j¡|jjddd d d |jjd dd t d |jjdddddd|jjdddddd|j t  ¡¡|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 . By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in 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.))r8Ú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).)r8r:Ú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)r>r8r:r;z --no-compilez.Do not compile Python source files to bytecode)r>r8r;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Ú build_dirÚsrcÚignore_requires_pythonÚno_build_isolationr*Ú 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_optsr1r1r2Ú add_optionsWsÀ  zInstallCommand.add_optionsc+ s~|jr|jdk rtdƒ‚t |¡dd„}t ¡dkrx|ƒsx|jsxt  t j d¡}|dkrjt  t j ¡d}t  d|¡d}|jrˆ|j}tj|d d |jpžg}t  d tƒ¡t|j|j|j|j|jd |_d}d}|jr4d |_tj |j¡|_tj |j¡rtj |j¡std ƒ‚tdd}|j}| |¡|jp>g} | |¡} t |ƒ} |j!|| | |j"d} |j#pr|j$ } t%|j&|j'ƒ}| t(ƒ¡}t|j$| dd d}yf| )||| | ¡}t*||jƒ|j+|||| | |jd}|j,|| |||j|j|j"|j-||j.d }| /| ¡|j0||j d}y| 1d¡}Wnt2k rFd}Yn X|j3dk}t4|dt5| j'ƒ‰‡fdd„|j6 7¡Dƒ}t8||ggd\}}dd„|Dƒ}|rºt9d :d ;|¡¡ƒ‚x|D]}|j.sÀd|_<qÀW| =|¡}d}|j> oô|j?}|r| @|¡}|jA}|jrd}tB||| |j||j||j|jCd } tD|j||j|j|jd!}!tE F|!¡}"| jGtH Id"¡d#g}#xZ| D]R}$|$jJ}%y$tK|$jJ|"d$}&|&r¦|%d%|&7}%WntLk r¾YnX|# M|%¡qzW|dk rî|jN|d&|jOkd'd( ;|#¡}'|'rtPd)|'ƒWnJtQk rT}(z*|jRd*k})tS|(|)|jƒ}*t jT|*|)d+tUSd}(~(XYnX|jrz|shtV‚| W|j||j¡tXS),Nz'Can not combine '--user' and '--target'cSs ttdƒpttdƒotjtjkS)NÚ real_prefixÚ base_prefix)ÚhasattrÚsysrgÚprefixr1r1r1r2Úis_venvïs  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)Ú check_targetzUsing %s)rAr6r@Ú isolated_modez=Target path exists but is not a directory, will not continue.Útarget)Úkind)ÚoptionsÚsessionÚ target_pythonrUÚinstall)ÚdeleteroÚglobally_managed)Útemp_build_dirrpÚ req_trackerrqÚfinderr<) ÚpreparerrxrpÚ wheel_cacher<rGrUrFrCr*)Úcheck_supported_wheelsÚpipF)Ú modifying_pipcsg|]}t|ˆƒr|‘qSr1)r )Ú.0Úr)r3r1r2ú ksz&InstallCommand.run..)rzÚ build_optionsrYcSsg|]}|jr|j‘qSr1)r*r+)r~rr1r1r2r€{szPCould not build wheels for {} which use PEP 517 and cannot be installed directlyz, i° )ÚrootÚhomerjrIr<Ú pycompile)Úuserrƒr‚rjÚisolatedr+)Úkey)Ú working_setú-z 2020-resolver)Ú new_resolverú zSuccessfully installed %sé)Úexc_info)Yr<r6rrÚcheck_install_build_globalÚosÚgetuidr@rÚbasenameriÚargvÚ executableÚloggerÚwarningrBrCÚcheck_dist_restrictionrXÚdebugrÚdecide_user_installrArmrGÚabspathÚexistsÚisdirrÚ enter_contextrYÚget_default_sessionr Ú_build_package_finderrUÚno_cleanrSrÚ cache_dirr0rÚget_requirementsÚ'reject_location_related_install_optionsÚmake_requirement_preparerÚ make_resolverrFr*Útrace_basic_infoÚresolveÚget_requirementÚKeyErrorÚ satisfied_byrr4rMÚvaluesrrÚformatÚjoinÚlegacy_install_reasonÚget_installation_orderÚignore_dependenciesrJÚ_determine_conflictsrIrrHÚget_lib_location_guessesrÚ WorkingSetÚsortÚoperatorÚ attrgetterr+rÚ ExceptionÚappendÚ_warn_about_conflictsÚfeatures_enabledrÚEnvironmentErrorÚ verbosityÚcreate_env_error_messageÚerrorr ÚAssertionErrorÚ_handle_target_dirr )+rcrpÚargsrkÚcommandrCrXÚtarget_temp_dirÚtarget_temp_dir_pathrYrqrrrxÚ build_deleterzrwÚ directoryÚreqsryÚresolverÚrequirement_setÚpip_reqr}Ú reqs_to_buildÚ_Úbuild_failuresÚpep517_build_failure_namesrÚ to_installÚ conflictsÚshould_warn_about_conflictsrIÚ installedÚ lib_locationsrˆÚitemsÚresultÚitemÚinstalled_versionÚinstalled_descr½Úshow_tracebackÚmessager1)r3r2Úrunçs<                               zInstallCommand.runc s\t|ƒg}td|jd}|d}|d}|d}tj |¡rH| |¡tj |¡rf||krf| |¡tj |¡r|| |¡xÚ|D]Ò} xÌt | ¡D]¾} | |krÌtj || ¡‰t‡fdd„|dd…DƒƒrÌq’tj || ¡} tj | ¡r:|sút   d | ¡q’tj  | ¡rt   d | ¡q’tj  | ¡r0t  | ¡n t | ¡t  tj | | ¡| ¡q’Wq‚WdS) NÚ)rƒÚpurelibÚplatlibÚdatac3s|]}| ˆ¡VqdS)N)Ú startswith)r~Ús)Úddirr1r2ú ú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.)rrrrršr·Úlistdirr¬Úanyr”r•Úislinkr›ÚshutilÚrmtreeÚremoveÚmove) rcr6rÂrBÚ lib_dir_listÚschemeÚ purelib_dirÚ platlib_dirÚdata_dirÚlib_dirrÕÚtarget_item_dirr1)rár2r¿àsH         z!InstallCommand._handle_target_dircCs,yt|ƒStk r&t d¡dSXdS)NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)rr¶r”Ú exception)rcrÎr1r1r2r°s z#InstallCommand._determine_conflictsc Cs|\}\}}|s|sdSg}|s6| d¡| d¡n,tddddsb| d¡d}| d  |¡¡xH|D]@}||d } x.||D]"} d j|| | d d } | | ¡q‚WqhWxN|D]F}||d } x4||D](\} } }dj|| || | d} | | ¡qÌWq²Wt d |¡¡dS)Nz¢After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. z|We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. iäéé)ÚyearÚmonthÚdayz¸Pip will install or upgrade your package(s) and its dependencies without taking into account other packages you already have installed. This may cause an uncaught dependency conflict. z#https://forms.gle/cWKMoDs8sUVE29hz9zXIf you would like pip to take your other packages into account, please tell us here: {} rz@{name} {version} requires {requirement}, which is not installed.rŒ)r+ÚversionÚ requirementzh{name} {version} requires {requirement}, but you'll have {dep_name} {dep_version} which is incompatible.)r+rørùÚdep_nameÚ dep_versionÚ )r·rr«r”Úcriticalr¬)rcÚconflict_detailsrŠÚ package_setÚmissingÚ conflictingÚpartsÚ form_linkÚ project_namerøÚ dependencyrÙrúrûr-r1r1r2r¸#sF      z$InstallCommand._warn_about_conflictsN) Ú__name__Ú __module__Ú __qualname__Ú__doc__Úusagerer rÚr¿r°r¸r1r1r1r2r5Cs  z8 r5FcCs$td|||||d}|d|dgS)NrÛ)r…rƒr‚r†rjrÜrÝ)r)r…rƒr‚r†rjrìr1r1r2r±cs  r±cCstdd„tt||dƒDƒƒS)Ncss|]}t|ƒVqdS)N)r)r~Údr1r1r2râssz)site_packages_writable..)r‚r†)ÚallÚsetr±)r‚r†r1r1r2Úsite_packages_writablepsrcCs¤|dk r|st d¡dS|rF|r*tdƒ‚tƒr8tdƒ‚t d¡dS|dksRt‚|sZ|rht d¡dStjs|t d ¡dSt||d r–t 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 disabled)r‚r†z0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable) r”r—rrrr¾ÚsiteÚENABLE_USER_SITErÚinfo)r<rAr6r@rmr1r1r2r˜xs0         r˜cCsŽdd„}g}x8|D]0}|j}t|ƒ}|r| d || ¡ƒ|¡¡qW|rnt|ƒ}|rn| d || ¡ƒ¡¡|svdStd d |¡¡ƒ‚dS)z’If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. cSsdd„|DƒS)NcSsg|]}d | dd¡¡‘qS)z--{}rËr‰)r«Úreplace)r~r+r1r1r2r€»szSreject_location_related_install_options..format_options..r1)Ú option_namesr1r1r2Úformat_options¹sz?reject_location_related_install_options..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; )rXrr·r«Úkeysrr¬)rMrprÚ offendersrùrXÚlocation_optionsr1r1r2r¢´s( r¢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ãrüz"Consider using the `--user` optionzCheck the permissionsz or z. rÛ)r·ÚstrÚerrnoÚEACCESÚextendÚlowerr¬Ústrip)r½rØÚusing_user_siterÚuser_option_partÚpermissions_partr1r1r2r¼Þs"      r¼)FNNFN)NNNF)QÚ __future__rrÚloggingr´rrçrrirÚoptparserÚ pip._vendorrZpip._vendor.packaging.utilsrÚpip._internal.cacherZpip._internal.clirZpip._internal.cli.cmdoptionsr Úpip._internal.cli.req_commandr r Úpip._internal.cli.status_codesr r Úpip._internal.exceptionsrrÚpip._internal.locationsrÚpip._internal.operations.checkrZpip._internal.reqrÚpip._internal.req.req_trackerrÚpip._internal.utils.datetimerÚ"pip._internal.utils.distutils_argsrÚpip._internal.utils.filesystemrÚpip._internal.utils.miscrrrrrÚpip._internal.utils.temp_dirrÚpip._internal.utils.typingrÚpip._internal.utils.virtualenvrÚpip._internal.wheel_builderrr r!Útypingr"r#r$Ú#pip._internal.models.format_controlr%r&Zpip._internal.req.req_installr'r(Ú getLoggerrr”r4r5r±rr˜r¢r¼r1r1r1r2Úsn                         %   7*