U n aVc@sddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZddlmZdd lmZmZdd lmZmZdd lmZmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,m-Z-m.Z.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7m8Z8e3rddlm9Z9ddl:m;Z;mZ>ddl?m@Z@ddlAmBZBddl6mCZCeDeEZFddZGGdd d eZHd!d"ZId#d$ZJd,d&d'ZKd(d)ZLd*d+ZMdS)-)absolute_importN) SUPPRESS_HELP) pkg_resources)canonicalize_name) WheelCache) cmdoptions)make_target_python)RequirementCommand with_cleanup)ERRORSUCCESS) CommandErrorInstallationErrordistutils_scheme)check_install_conflicts)install_given_reqs)get_requirement_tracker) deprecated)parse_distutils_argstest_writable_dir) ensure_dirget_installed_version(protect_pip_from_modification_on_windows write_output) TempDirectory)MYPY_CHECK_RUNNING)virtualenv_no_global)build should_build_for_install_command)Values)AnyIterableListOptional) FormatControl)InstallRequirement)BinaryAllowedPredicatecsfdd}|S)Ncs&|jr dSt|j}|}d|kS)NTbinary) use_pep517rnameget_allowed_formats)reqcanonical_nameallowed_formatsformat_control_C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\commands\install.pycheck_binary_allowed;s   z6get_check_binary_allowed..check_binary_allowedr2)r1r4r2r0r3get_check_binary_allowed9s r5cs@eZdZdZdZfddZeddZddZd 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] ...csPtt|j|||j}|t|t|t|t |t |jdddddddt ||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|tttj|j}|jd3||jd3|dS)4Nz-tz--target target_dirdirzInstall packages into . By default this will not replace existing files/folders in . Use --upgrade to replace existing packages in with new versions.)destmetavardefaulthelpz--user use_user_site 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.))r9actionr<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-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).)r9r;choicesr<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 bytecode)r?r9r;r<z --no-compilez.Do not compile Python source files to bytecode)r?r9r<z--no-warn-script-locationwarn_script_locationz0Do not warn when installing scripts outside PATHz--no-warn-conflictswarn_about_conflictsz%Do not warn about broken dependenciesr)superr6__init__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)selfargskwrN index_opts __class__r2r3rMZs   zInstallCommand.__init__c' s|jr|jdk rtdt|d}|jr2|j}tj|dd|jpHg}t |j|j |j|j |j d|_d}d}|jrd|_ tj|j|_tj|jrtj|jstdtdd}|j}|jpg}||}t|} |j||| |jd } |jp|j } t|j|j} |t} t|j| d dd }z4|j ||| ||j d }t!||j|j"||| || |jd }|j#|| || |j|j |j|j$||j%d }|&| |j'||j d }z|(d}Wnt)k rd}Yn X|j*dk}t+|dt,| jfdd|j-.D}t/|| ggd\}}dd|D}|rTt0d1d2dd|D|3|}|j4 ol|j5}|r~|6||j7}|jrd}t8||||j ||j |j9||jd }t:|j||j |j |j d}t;<|}|j=t>?ddg}|D]R} | j@}!z$tA| j@|d}"|"r|!d|"7}!WntBk r4YnX|C|!qd 2|}#|#r^tDd!|#WnRtEk r}$z2|jFd"k}%tG|$|%|j}&tHjI|&|%d#tJWYSd}$~$XYnX|jr|K|j||jtLS)$Nz'Can not combine '--user' and '--target'zto-satisfy-onlyT) check_target)rBr7rA isolated_modez=Target path exists but is not a directory, will not continue.target)kind)optionssession target_pythonrXinstall)deleteroglobally_managed)check_supported_wheels)temp_build_dirrp req_trackerrqfinderr=) preparerryrp wheel_cacher=rHrXrGrDr*pip) modifying_pipcsg|]}t|r|qSr2)r .0rr4r2r3 `s z&InstallCommand.run..)r{ build_optionsr\cSsg|]}|jr|qSr2)r*r~r2r2r3rsszPCould not build wheels for {} which use PEP 517 and cannot be installed directlyz, css|] }|jVqdSN)r+r~r2r2r3 zsz%InstallCommand.run..F)roothomeprefix pycompilerJr=)userrrrisolatedr+)key) working_set- zSuccessfully installed %sexc_info)Mr=r7r rcheck_install_build_globalrCrDcheck_dist_restrictionr[decide_user_installrBrArmrHospathabspathexistsisdirrr\get_default_sessionr_build_package_finderrXno_cleanrVr cache_dirr1 enter_contextrget_requirementswarn_deprecated_install_optionsmake_requirement_preparer make_resolverrGr*trace_basic_inforesolveget_requirementKeyError satisfied_byrr5rPvaluesrrformatjoinget_installation_orderignore_dependenciesrK_warn_about_conflictsrJrrIget_lib_location_guessesr WorkingSetsortoperator attrgetterr+r ExceptionappendrEnvironmentError verbositycreate_env_error_messageloggererrorr _handle_target_dirr )'rfrprgrDr[target_temp_dirtarget_temp_dir_pathr\rqrrry build_deleter{rx directoryreqsrzresolverrequirement_setpip_reqr} reqs_to_build_build_failurespep517_build_failures to_installshould_warn_about_conflictsrJ installed lib_locationsritemsresultiteminstalled_versioninstalled_descrshow_tracebackmessager2rr3runsd                  zInstallCommand.runc sft|g}|Jtd|jd}|d}|d}|d}tj|rP||tj|rn||krn||tj|r|||D]} t| D]} | |krtj|| tfdd|ddDrqtj|| } tj| r>|st d | qtj | rt d | qtj | r4t | n t| t tj| | | qqW5QRXdS) N)rpurelibplatlibdatac3s|]}|VqdSr) startswith)rsddirr2r3rsz4InstallCommand._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.)rrrrrrlistdirranyrwarningislinkrshutilrmtreeremovemove) rfr7rrC lib_dir_listscheme purelib_dir platlib_dirdata_dirlib_dirrtarget_item_dirr2rr3rsP        z!InstallCommand._handle_target_dirc Cszt|\}}Wn$tk r4tjdddYdSX|\}}|D]2}||d}||D]}td|||dqZqB|D]8}||d}||D]\} } } td||| | | qqzdS)NzError checking for conflicts.Trrz*%s %s requires %s, which is not installed.rzF%s %s has requirement %s, but you'll have %s %s which is incompatible.)rrrrcritical) rfr package_set _dep_infomissing conflicting project_nameversion dependencydep_name dep_versionr-r2r2r3rs4   z$InstallCommand._warn_about_conflicts) __name__ __module__ __qualname____doc__usagerMr rrr __classcell__r2r2rjr3r6Fs   Y8r6cOstd||}|d|dgS)Nrrr)rr)rgkwargsrr2r2r3rsrcKstddttf|DS)Ncss|]}t|VqdSrr)rdr2r2r3rsz)site_packages_writable..)allsetr)rr2r2r3site_packages_writables rFcCs|dk r|stddS|rF|r*tdtr8tdtddS|dksRt|sZ|rhtddStjs|td dSt||d rtd 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)rrz0Non-user install because site-packages writeablezMDefaulting to user installation because normal site-packages is not writeable) rdebugr rrAssertionErrorsiteENABLE_USER_SITErinfo)r=rBr7rArmr2r2r3r$s4         rcCsdd}g}|D]0}|j}t|}|r|d|||q|rjt|}|rj|d|||srdStdd|dd d d dS) zIf any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. cSsdd|DS)NcSsg|]}d|ddqS)z--{}rr)rreplace)rr+r2r2r3rgszKwarn_deprecated_install_options..format_options..r2) option_namesr2r2r3format_optionsesz7warn_deprecated_install_options..format_optionsz {!r} from {}z{!r} from command lineNz}Location-changing options found in --install-option: {}. This configuration may cause unexpected behavior and is unsupported.z; zCusing pip-level options like --user, --prefix, --root, and --targetz20.2i)reason replacementgone_inissue)r[rrrkeysrr)rPrpr offenders requirementr[location_optionsr2r2r3r`s<  rcCsg}|d|s,|d|t|n |d|dd7<|jtjkrd}d}|st||d|gn |||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)rstrerrnoEACCESextendlowerrstrip)rrusing_user_sitepartsuser_option_partpermissions_partr2r2r3rs&      r)NNNF)N __future__rrloggingrrrroptparser pip._vendorrpip._vendor.packaging.utilsrpip._internal.cacherZpip._internal.clirZpip._internal.cli.cmdoptionsrpip._internal.cli.req_commandr r pip._internal.cli.status_codesr r pip._internal.exceptionsr rpip._internal.locationsrpip._internal.operations.checkrZpip._internal.reqrpip._internal.req.req_trackerrpip._internal.utils.deprecationr"pip._internal.utils.distutils_argsrpip._internal.utils.filesystemrpip._internal.utils.miscrrrrpip._internal.utils.temp_dirrpip._internal.utils.typingrpip._internal.utils.virtualenvrpip._internal.wheel_builderrr r!typingr"r#r$r%#pip._internal.models.format_controlr&Zpip._internal.req.req_installr'r( getLoggerrrr5r6rrrrrr2r2r2r3s`                       V <2