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;e6rfddl m<Z<ddl=m>Z>m?Z?m@Z@ddlAmBZBddl!mCZCddlDmEZEddl9mFZFejGeHZIdd ZJGd!d"d"eZKd#ddd#dd$d%ZLd&d'ZMdddd#d(d)ZNd*d+ZOd,d-ZPdS).)absolute_importN)path) SUPPRESS_HELP) pkg_resources)canonicalize_name) WheelCache) cmdoptions)make_target_python)RequirementCommand with_cleanup)ERRORSUCCESS) CommandErrorInstallationError)distutils_scheme)check_install_conflicts)install_given_reqs)get_requirement_tracker)today_is_later_than)parse_distutils_args)test_writable_dir) ensure_dirget_installed_versionget_pip_version(protect_pip_from_modification_on_windows write_output) TempDirectory)MYPY_CHECK_RUNNING)virtualenv_no_global)build should_build_for_install_command)Values)IterableListOptional) FormatControl)ConflictDetails)InstallRequirement)BinaryAllowedPredicatecsfdd}|S)Ncs5|jr dSt|j}j|}d|kS)NTbinary) use_pep517rnameget_allowed_formats)reqcanonical_nameallowed_formats)format_control/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/install.pycheck_binary_allowed8s  z6get_check_binary_allowed..check_binary_allowedr1)r0r3r1)r0r2get_check_binary_allowed6sr4c@s^eZdZdZdZddZeddZddZd 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] ...c Cs|jjtj|jjtj|jjtj|jjtj|jjtj|jjdddddddddd tj|j|jjd dd d d dd|jjddd d ddt |jjddddddddd|jjddddddddd|jjtj |jjtj |jjddddd d dd|jjddddddddgdd |jjd!dd"d d dd#|jjd$d%dd&d d dd'|jjtj |jjtj |jjtj|jjtj|jjtj|jjtj|jjd(d d dd)dd*dd+|jjd,d ddd)dd-|jjd.d ddd/dd*dd0|jjd1d ddd2dd*dd3|jjtj|jjtj|jjtj|jjtj|jjtjtjtj|j}|jjd4||jjd4|jdS)5Nz-tz--targetdest target_dirmetavardirdefaulthelpzInstall packages into . By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in with new versions.z--user use_user_siteaction store_truezInstall 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.)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 --upgradeupgradezUpgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.z--upgrade-strategyupgrade_strategyzonly-if-neededchoiceseageraGDetermines 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).z--force-reinstallforce_reinstallz;Reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedignore_installedzIgnore 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 --compilecompileTz'Compile Python source files to bytecodez --no-compilez.Do not compile Python source files to bytecodez--no-warn-script-locationwarn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflictswarn_about_conflictsz%Do not warn about broken dependenciesr)cmd_opts add_optionr requirements constraintsno_depspreeditableadd_target_python_optionsr build_dirsrcignore_requires_pythonno_build_isolationr* no_use_pep517install_optionsglobal_options no_binary only_binary prefer_binaryrequire_hashes progress_barmake_option_group index_groupparserinsert_option_group)self index_optsr1r1r2 add_optionsWs                  zInstallCommand.add_optionsc+s|jr$|jdk r$tdtj|dd}tjdkr| r|j rtj t j d}|dkrtj t j d}t jd|d}|jr|j}tj|d d |jpg}t jd tt|jd |jd |jd|jd|j|_d}d}|jrd |_tjj|j|_tjj|jrtjj|j rtdtdd}|j}|j||jpg} |j|} t |} |j!d|d| d| d|j"} |j#p!|j$ } t%|j&|j'}|jt(}t|j$d| dddd }y|j)||| | }t*||j|j+d|d|d|d| d| d|j}|j,d|d| d|d|d|jd |jd|j"d!|j-d"|d#|j. }|j/| |j0|d$|j }y|j1d%}Wnt2k rud&}YnX|j3dk}t4d'|t5| j'fd(d)|j6j7D}t8|d|d*gd+g\}}d,d)|D}|rt9d-j:d.j;|x |D]}|j.s%d/|_<q%W|j=|}d}|j> of|j?}|r~|j@|}|jA}|jrd&}tB||| d0|jd1|d2|jd3|d|jd4|jC} tDd5|jd1|d0|jd2|jd6|j}!tEjF|!}"| jGd7tHjId8g}#xf| D]^}$|$jJ}%y-tK|$jJd9|"}&|&r{|%d:|&7}%WntLk rYnX|#jM|%q@W|dk r|jN|d;d<|jOkd=j;|#}'|'rtPd>|'Wn`tQk rO}(z@|jRd?k})tS|(|)|j}*t jT|*d@|)tUSWYdd}(~(XnX|jr~|setV|jW|j||jtXS)ANz'Can not combine '--user' and '--target'cSs.ttdp-ttdo-tjtjkS)N real_prefix base_prefix)hasattrsysrgprefixr1r1r1r2is_venvsz#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-only check_targetTzUsing %srAr7r@ isolated_modez=Target path exists but is not a directory, will not continue.kindtargetoptionssession target_pythonrUdeleteinstallglobally_managedtemp_build_dir req_trackerfinderr<preparer wheel_cacherGrFrCr*check_supported_wheelspipF modifying_pipcs%g|]}t|r|qSr1)r ).0r)r3r1r2 ks z&InstallCommand.run.. build_optionsrYcSs"g|]}|jr|jqSr1)r*r+)r~rr1r1r2r{s zPCould not build wheels for {} which use PEP 517 and cannot be installed directlyz, i roothomerjrI pycompileuserisolatedkeyr+ working_set- new_resolverz 2020-resolver zSuccessfully installed %sexc_info)Yr<r7rrcheck_install_build_globalosgetuidr@rbasenameriargv executableloggerwarningrBrCcheck_dist_restrictionrXdebugrdecide_user_installrArmrGabspathexistsisdirr enter_contextrYget_default_sessionr _build_package_finderrUno_cleanrSr cache_dirr0rget_requirements'reject_location_related_install_optionsmake_requirement_preparer make_resolverrFr*trace_basic_inforesolveget_requirementKeyError satisfied_byrr4rMvaluesrrformatjoinlegacy_install_reasonget_installation_orderignore_dependenciesrJ_determine_conflictsrIrrHget_lib_location_guessesr WorkingSetsortoperator attrgetterr+r Exceptionappend_warn_about_conflictsfeatures_enabledrEnvironmentError verbositycreate_env_error_messageerrorr AssertionError_handle_target_dirr )+rcrpargsrkcommandrCrXtarget_temp_dirtarget_temp_dir_pathrYrqrrrx build_deleterzrw directoryreqsryresolverrequirement_setpip_reqr} reqs_to_build_build_failurespep517_build_failure_namesr to_install conflictsshould_warn_about_conflictsrI installed lib_locationsritemsresultiteminstalled_versioninstalled_descrshow_tracebackmessager1)r3r2runs<   &                              "                        zInstallCommand.runc st|g}tdd|j}|d}|d}|d}tjj|rb|j|tjj|r||kr|j|tjj|r|j|x(|D] } xtj| D]} | |krtjj|| tfdd|dd Drqtjj|| } tjj| r|s\t j d | qtjj | rt j d | qtjj | rt j| n tj| t jtjj| | | qWqWdS) Nrpurelibplatlibdatac3s|]}|jVqdS)N) startswith)r~s)ddirr1r2 sz4InstallCommand._handle_target_dir..rzKTarget directory %s already exists. Specify --upgrade to force replacement.zTarget directory %s already exists and is a link. pip will not automatically replace links, please remove if replacement is desired.)rrrrrrlistdirranyrrislinkrshutilrmtreeremovemove) rcr7rrB lib_dir_listscheme purelib_dir platlib_dirdata_dirlib_dirrtarget_item_dirr1)rr2rsH         ) z!InstallCommand._handle_target_dirc Cs8yt|SWn#tk r3tjddSYnXdS)NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)rrr exception)rcrr1r1r2rs  z#InstallCommand._determine_conflictsc Cs|\}\}}| r$| r$dSg}|sM|jd|jdnDtdddddds|jd d }|jd j|x`|D]X}||d } xA||D]5} d jd|d| d| d} |j| qWqWxq|D]i}||d } xR||D]F\} } }djd|d| d|d| d| } |j| qWqWtjdj|dS)NzAfter 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. yearimonthdayzPip 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+version requirementrzh{name} {version} requires {requirement}, but you'll have {dep_name} {dep_version} which is incompatible.dep_name dep_version )rrrrcriticalr)rcconflict_detailsr package_setmissing conflictingparts form_link project_namer dependencyrrrr-r1r1r2r#sF        z$InstallCommand._warn_about_conflictsN) __name__ __module__ __qualname____doc__usagerer rrrrr1r1r1r2r5Cs   8 r5Fc Cs<tdd|d|d|d|d|}|d|dgS) Nrrrrrrjrr)r)rrrrrjrr1r1r2rcsrcCs,tddttd|d|DS)Ncss|]}t|VqdS)N)r)r~dr1r1r2rssz)site_packages_writable..rr)allsetr)rrr1r1r2site_packages_writableps rcCs|dk r$| r$tjddS|rb|r<tdtrQtdtjddS|dkstt|s|rtjddStjstjd dStd |d |rtjd dStj 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 disabledrrz0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable) rrrrrrsiteENABLE_USER_SITErinfo)r<rAr7r@rmr1r1r2rxs0           rcCsdd}g}xN|D]F}|j}t|}|r|jdj||j|qW|rt|}|r|jdj||j|sdStdjdj|dS)zIf any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. cSsdd|DS)NcSs+g|]!}dj|jddqS)z--{}rr)rreplace)r~r+r1r1r2rs zSreject_location_related_install_options..format_options..r1) option_namesr1r1r2format_optionssz?reject_location_related_install_options..format_optionsz {!r} from {}z{!r} from command lineNzLocation-changing options found in --install-option: {}. This is unsupported, use pip-level options like --user, --prefix, --root, and --target instead.z; )rXrrrkeysrr)rMrpr offendersrrXlocation_optionsr1r1r2rs(     rcCsg}|jd|s<|jd|jt|n |jd|d d7<|jtjkrd}d}|s|j|d|jgn |j||jd d j|jdS) 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: .rrz"Consider using the `--user` optionzCheck the permissionsz or z. rr)rstrerrnoEACCESextendlowerrstrip)rrusing_user_siteruser_option_partpermissions_partr1r1r2rs"     r)Q __future__rrloggingrrrrriroptparser pip._vendorrZpip._vendor.packaging.utilsrpip._internal.cacherZpip._internal.clirZpip._internal.cli.cmdoptionsr pip._internal.cli.req_commandr r pip._internal.cli.status_codesr r pip._internal.exceptionsrrpip._internal.locationsrpip._internal.operations.checkrZpip._internal.reqrpip._internal.req.req_trackerrpip._internal.utils.datetimer"pip._internal.utils.distutils_argsrpip._internal.utils.filesystemrpip._internal.utils.miscrrrrrpip._internal.utils.temp_dirrpip._internal.utils.typingrpip._internal.utils.virtualenvrpip._internal.wheel_builderrr r!typingr"r#r$#pip._internal.models.format_controlr%r&Zpip._internal.req.req_installr'r( getLoggerrrr4r5rrrrrr1r1r1r2sj       ( # 7 *