3 ]F @s ddlmZddlZddlZddlZddlZddlZddlZy ddlZWne k r`dZYnXddl m Z ddl m Z ddlmZmZddlmZmZmZddlmZddlmZmZdd lmZdd lmZdd lmZdd l m!Z!m"Z"dd lm#Z#ej$e%Z&Gddde Z'ddZ(dS))absolute_importN)RequirementSet)RequirementCommand)virtualenv_no_globaldistutils_scheme)InstallationError CommandErrorPreviousBuildDirError) cmdoptions) ensure_dirget_installed_version)BuildDirectory)RemovedInPip10Warning)check_path_owner) WheelCache WheelBuilder)running_under_virtualenvcs4eZdZdZdZdZdZfddZddZZ 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. installa% %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...zInstall packages.c sPtt|j||d}tr d}tjdkr0d}|j}|jtj |jtj |jtj |jtj |jddddddd |jd d d d ddddd |jtj |jdddddd|jdddddgdd|jddddd|jdd d!d|d"d#|jtj|jtj|jtj|jtj|jd$d%d|d&d#|jd'd%d(d)d|jd*d+dd,d|jd-d.ddd/d |jd0d1ddd2d |jd3dd4dd5d6|jd7d(d4d8d9|jtj|jtj|jtj|jtj|jtj|jtj|jtjtjtj|j}|jjd||jjd|dS):NTFrz-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-dz --downloadz--download-dirz--download-directory download_dirz`Download packages into instead of installing them, regardless of what's already installed.z-Uz --upgradeupgrade store_truezUpgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.)ractionrz--upgrade-strategyupgrade_strategyeagerzonly-if-neededa3Determines how dependency upgrading should be handled. "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).)rrchoicesrz--force-reinstallforce_reinstallzKWhen upgrading, reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedignore_installedz5Ignore the installed packages (reinstalling instead).)rrrrz--user use_user_siteaInstall 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.) On Debian systems, this is the default when running outside of a virtual environment and not as root.z--system store_falsezDInstall using the system scheme (overrides --user on Debian systems)z--eggas_eggzInstall packages as eggs, not 'flat', like pip normally does. This option is not about installing *from* eggs. (WARNING: Because this option overrides pip's normal install logic, requirements files may not behave as expected.)z--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 --compilecompilezCompile py files to pyc)rrrrz --no-compilezDo not compile py files to pyc)rrr)superr__init__rosgeteuidcmd_opts add_optionr constraintseditable requirements build_dirsrcignore_requires_pythonno_depsinstall_optionsglobal_options use_wheel no_use_wheel no_binary only_binarypreno_cleanrequire_hashesmake_option_group index_groupparserinsert_option_group)selfargskw default_userr. index_opts) __class__3/tmp/pip-build-8jg9gmni/pip/pip/commands/install.pyr+7s zInstallCommand.__init__c&Cstj|tj||jr&tjdt|jr8tjdt|jrJtjdt|j r\tjdt|j rttjdtd|_ |j rt jj|j |_ t jj|j|_|jpg}|jr|jrtdtrtd|jd |jd d}|jrdd}g}xX|D]P}|j2}y"t?|j2| }|r|d|7}Wnt@k rYnX|j|qWdjA|}|r^t%jBd|n(djAdd| jCD}|r^t%jBd|WntDk r~d|_ YnXWd|j s| jEXWdQRXWdQRX|jrtF|jg}tGd|dd}tGd|dd}t jj|r|j|t jj|r||kr|j|x|D]}xt jH|D]}t jjA|j|}t jj|r|j)sjt%j&d |q0t jjI|rt%j&d!|q0t jj|rtJjK|n t jL|tJjMt jjA|||q0Wq WtJjK|| S)"Nz--egg has been deprecated and will be removed in the future. This flag is mutually exclusive with large parts of pip, and actually using it invalidates pip's ability to manage the installation process.z--allow-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-all-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-unverified has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.zpip install --download has been deprecated and will be removed in the future. Pip now has a download command that should be used instead.TzVCan 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--userz --prefix=z=Target path exists but is not a directory, will not continue.z--home=zThe 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.)delete)r3src_dirrrrr&r#ignore_dependenciesr5r"r$rsession pycompileisolated wheel_cacher?) build_optionsr8) autobuilding)rootprefix)userhomerUrVrQname)key- zSuccessfully installed %scSsg|] }|jqSrJ)rY).0reqrJrJrK sz&InstallCommand.run..zSuccessfully downloaded %s)rXpurelibplatlibzKTarget 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.)Nr resolve_wheel_no_use_binarycheck_install_build_globalr&warningswarnrallow_externalallow_all_externalallow_unverifiedrr#r3r,pathabspathrMr7r$r(rrrappendrtempfilemkdtempexistsisdirr8_build_session_build_package_finderr>r cache_dirformat_controlrloggerwarningr rrrrNr5r"r) isolated_moder?populate_requirement_setrYhas_requirementswheel prepare_filesrbuildrr'get_lib_location_guessessortedsuccessfully_installedoperator attrgetterr Exceptionjoininfosuccessfully_downloadedr cleanup_filesr rlistdirislinkshutilrmtreeremovemove)rDoptionsrEr7temp_target_dirr8rOfinder build_deleterRr3requirement_setwbpossible_lib_locationsreqsitemsr^iteminstalled_version installed downloaded lib_dir_list purelib_dir platlib_dirlib_dirtarget_item_dirrJrJrKrunsD                            zInstallCommand.run) __name__ __module__ __qualname____doc__rYusagesummaryr+r __classcell__rJrJ)rIrKr s  rcOstd||}|d|dgS)Nr`rarb)r`)r)rEkwargsschemerJrJrKr}sr})) __future__rloggingrr,rmrrerz ImportErrorpip.reqrpip.basecommandr pip.locationsrrpip.exceptionsrrr pipr pip.utilsr r pip.utils.buildr Zpip.utils.deprecationrpip.utils.filesystemr pip.wheelrrr getLoggerrrurr}rJrJrJrKs6           (