a *egr@s"ddlZddlZddlZddlZddlZddlZddlmZmZddl m Z m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZmZdd lmZmZdd lmZmZdd lm Z dd l!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(m)Z)ddl*m+Z+ddl,m-Z-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;ddlm?Z?m@Z@ddlAmBZBmCZCe4eDZEGdddeZFd)eGe eHe eHeGe eHe eHdddZIe eHeGeGd d!d"ZJd*e eGe eHe eHe eHeGeGd#d$d%ZKeLeGeGeHd&d'd(ZMdS)+N) SUPPRESS_HELPValues)ListOptional)canonicalize_name) print_json) WheelCache) cmdoptions)make_target_python)RequirementCommand with_cleanup)ERRORSUCCESS) CommandErrorInstallationError) get_scheme)get_environment)InstallationReport)get_build_tracker)ConflictDetailscheck_install_conflicts)install_given_reqs)InstallRequirementcheck_legacy_setup_py_options)WINDOWStest_writable_dir) getLogger)check_externally_managed ensure_dirget_pip_version(protect_pip_from_modification_on_windowswarn_if_run_as_root write_output) TempDirectory)running_under_virtualenvvirtualenv_no_global)build should_build_for_install_commandc@szeZdZdZdZddddZeeee e ddd Z e e e dd d d Zeeeed ddZee ddddZdS)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] ...N)returncCs|jt|jt|jt|jt|jt|jjdddddd|jjddd d dd d t|j|jjd dddd|jjdddt d|jjddd ddd |jjddd ddd |jt |jjdddddd|jjddddd gd!d"|jjd#d$dd%d|jjd&d'd(dd)d|jt |jt |jt |jt|jt|jt|jt|jt|jjd*dd+d,d-d|jjd.dd+d/d0|jjd1dd2d,d3d|jjd4dd5d,d6d|jt|jt|jt|jt|jt|jtttj|j}|jd7||jd7|j|jjd8d9d:dd;d dS). By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in with new versions.)r.metavarr/r0z--user use_user_sitezInstall 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.r-r0z --no-user store_falsez--root root_pathz=Install everything relative to this alternate root directory.z--prefix prefix_patha[Installation prefix where lib, bin and other top-level folders are placed. Note that the resulting installation may contain scripts and other resources which reference the Python interpreter of pip, and not that of ``--prefix``. See also the ``--python`` option if the intention is to install packages into another (possibly pip-free) environment.z-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-neededeageraGDetermines 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/choicesr0z--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 bytecode)r-r.r0z--no-warn-script-locationwarn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflictswarn_about_conflictsz%Do not warn about broken dependenciesrz--reportjson_report_filefileaWGenerate 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 constraintsno_depspreeditableadd_target_python_optionsrsrcignore_requires_pythonno_build_isolation use_pep517 no_use_pep517Zcheck_build_depsoverride_externally_managedconfig_settingsglobal_options no_binary only_binary prefer_binaryrequire_hashes progress_barroot_user_actionmake_option_group index_groupparserinsert_option_group)self index_optsr_H/usr/local/lib/python3.9/site-packages/pip/_internal/commands/install.py add_optionsIs     zInstallCommand.add_options)optionsargsr*c. Cs |jr|jdurtd|jo"|j oB|jduoB|jduoB|jdu}|rT|jsTtd}|j rd|j }t j |ddt dtt|j|j|j|j|jd|_d}d}|jrd|_tj|j|_tj|jrtj|jstdtdd }|j}|||jp g}||}t|} |j||| |jd } |t} t|j d dd } z,|!||| |} t"|| t#|j$}| D] }d|_%q~|j&| || || |j|j'd }|j(|| |||j|j|j|j)||j*|j+d }|,| |j-| |j d}|jrft.|j/}|jdkrt0|1dnHt2|jddd&}t3j4|1|dddWdn1s\0Y|jrt5dd|j/D}|rt6dd7dd|Dt8WSz|9d}Wnt:yd}Yn0|j;du}|rddl<}t=|dd d!|j>?D}t@||dg|d"\}}|r@tAd#Bd$7d%d|D|C|}d}|jD o\|jE}|rn|F|}|jG}|js|jrd}tH|||j||j||j|jId&} tJ|j||j|j|jd'}!tK|!}"| jLtMNd(d)g}#i}$|"OD]}%|%jP|$|%jQ<q| D]@}&|&jR}'|$StT|'d}(|(r4|'d|(})n|'})|#U|)q|durd|jV||W|d*d7|#}*|*r~t6d+|*WnPtXy}+z6|j'd,k},tY|+|,|j}-t jZ|-|,d-t[WYd}+~+Sd}+~+00|jr|sJ|\|j||j |j]d.krt^t8S)/Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT) check_targetzUsing %s)r7r1r6 isolated_modez=Target path exists but is not a directory, will not continue.target)kind)rbsession target_pythonrLinstall)deletergglobally_managed)temp_build_dirrb build_trackerrhfinderr4 verbosity) preparerrorb wheel_cacher4r=rLr<r9rNpy_version_info)check_supported_wheels-)datawzutf-8)encodingF)indent ensure_asciicss"|]}|jd|jdfVqdS)nameversionN)metadata.0rr_r_r` sz%InstallCommand.run..zWould install %s css|]}d|VqdS)ruN)join)ritemr_r_r`rpipr) modifying_pipcSsg|]}t|r|qSr_)r(rr_r_r` sz&InstallCommand.run..)rrverify build_optionsrRzUERROR: Failed to build installable wheels for some pyproject.toml based projects ({})z, css|] }|jVqdSN)r|rr_r_r`rr)roothomeprefixr?r4 pycompile)userrrrisolatedr|)key)resolver_variantzSuccessfully installed %s)exc_infowarn)_r4r1rr,rAr6r7rPrr8r9r check_dist_restrictionloggerverboser decide_user_installrer=ospathabspathexistsisdirr$ enter_contextrRget_default_sessionr _build_package_finderrLrno_cleanget_requirementsrr cache_dirZpermit_editable_wheelsmake_requirement_preparerrp make_resolverr<rNpython_versiontrace_basic_inforesolverZrequirements_to_installrto_dictopenjsondumpsortedr#rrget_requirementKeyError satisfied_by!pip._internal.self_outdated_checkr!rEvaluesr'rformatget_installation_orderignore_dependenciesr@_determine_conflictsr?rr>get_lib_location_guessesrsortoperator attrgetterZiter_all_distributionsr}canonical_namer|getrappend_warn_about_conflictsdetermine_resolver_variantOSErrorcreate_os_error_messageerrorr _handle_target_dirrXr").r]rbrcZ#installing_into_current_environmentr9target_temp_dirtarget_temp_dir_pathrRrhrirorn directoryreqsrrreqrqresolverrequirement_setreportfZwould_install_itemspip_reqrr reqs_to_build_build_failures to_install conflictsshould_warn_about_conflictsr? installed lib_locationsenvsummaryZinstalled_versions distributionpackageZ display_namer}textinstalled_descrshow_tracebackmessager_r_r`run s              6              zInstallCommand.run)r1rr8r*c sNt|g}td|jd}|j}|j}|j}tj|rB||tj|r`||kr`||tj|rv|||D]} t | D]} | |krtj || t fdd|ddDrqtj || } tj| r0|st d| qtj| r t d| qtj| r&t| n t| ttj | | | qqzdS)N)rc3s|]}|VqdSr) startswith)rsddirr_r`r)rz4InstallCommand._handle_target_dir..zKTarget 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.)rrrpurelibplatlibrvrrrlistdirranyrwarningislinkrshutilrmtreeremovemove) r]r1rr8 lib_dir_listscheme purelib_dir platlib_dirdata_dirlib_dirrtarget_item_dirr_rr`rsH       z!InstallCommand._handle_target_dir)rr*cCs.z t|WSty(tdYdS0dS)NzwError while checking for conflicts. Please file an issue on pip's issue tracker: https://github.com/pypa/pip/issues/new)r Exceptionr exception)r]rr_r_r`rDs  z#InstallCommand._determine_conflicts)conflict_detailsrr*c Cs|\}\}}|s|sdSg}|dkr0|dn|dks.rr)allsetrrr_r_r`site_packages_writablesr)r4r7r1r6rer*cCs|dur|stddS|rF|r*tdtr8tdtddS|dusRJ|sZ|rhtddStjs|td dSt||d rtd dStd 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) rdebugrr&rsiteENABLE_USER_SITErinfo)r4r7r1r6rer_r_r`rs8        r)rrusing_user_siter*cCsg}|d|s,|d|t|n |d|dd7<|jtjkrd}d}tsz|sz||d|gn |||d tr|jtjkr|j rt |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: .rrz"Consider using the `--user` optionzCheck the permissionsz or z. izHINT: 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) rrerrnoEACCESr%extendlowerrENOENTfilenamelenrstrip)rrrruser_option_partpermissions_partr_r_r`rs>         r)FNNFN)NNNF)Nrrrrrroptparserrtypingrrpip._vendor.packaging.utilsrZpip._vendor.richrpip._internal.cacherZpip._internal.clir Zpip._internal.cli.cmdoptionsr pip._internal.cli.req_commandr r pip._internal.cli.status_codesr rpip._internal.exceptionsrrpip._internal.locationsrpip._internal.metadatarZ(pip._internal.models.installation_reportrZ,pip._internal.operations.build.build_trackerrpip._internal.operations.checkrrpip._internal.reqrZpip._internal.req.req_installrrpip._internal.utils.compatrpip._internal.utils.filesystemrpip._internal.utils.loggingrpip._internal.utils.miscrrr r!r"r#pip._internal.utils.temp_dirr$pip._internal.utils.virtualenvr%r&pip._internal.wheel_builderr'r(r rr)rrrrrrrr_r_r_r`s               S   >