YD @svddlmZddlZddlZddlZddlZddlZddlZyddlZWne k rdZYnXddl m Z ddl m Z ddlmZmZddlmZmZmZddlmZddlmZmZdd lmZdd lmZdd lmZdd l m!Z!m"Z"ej#e$Z%Gd dde Z&ddZ'dS))absolute_importN)RequirementSet)RequirementCommand)virtualenv_no_globaldistutils_scheme)InstallationError CommandErrorPreviousBuildDirError) cmdoptions) ensure_dirget_installed_version)BuildDirectory)RemovedInPip10Warning)check_path_owner) WheelCache WheelBuildercsFeZdZdZdZdZdZfddZddZS) 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 sDtt|j|||j}|jtj|jtj|jtj|jtj |jdddddddddd |jd d d d dddddddd|jtj |jdddddddd|jddddddddgdd|jddddddd|jdd dd!dddd"|jtj |jtj |jtj |jtj|jd#dd$dddd%|jd&dd'dddd(|jd)dd*dddddd+|jd,dd-dddddd.|jd/dddd0dd1dd2|jd3dd4dd0dd5|jtj|jtj|jtj|jtj|jtj|jtj|jtjtjtj|j}|jjd6||jjd6|dS)7Nz-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-dz --downloadz--download-dirz--download-directory download_dirz`Download packages into instead of installing them, regardless of what's already installed.z-Uz --upgradeupgradeaction store_truezUpgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.z--upgrade-strategyupgrade_strategyeagerchoiceszonly-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).z--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).z--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.)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 --compilecompileTzCompile py files to pycz --no-compile store_falsezDo not compile py files to pycr)superr__init__cmd_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)selfargskwr+ index_opts) __class__3/tmp/pip-build-3puug3g5/pip/pip/commands/install.pyr*6s      zInstallCommand.__init__c1Cstj|tj||jr3tjdt|jrLtjdt|jretjdt|j r~tjdt|j rtjdtd|_ |j rt jj|j |_ t jj|j|_|jpg}|jr5|jrtdtrtd|jd |jd d}|jrd|_ tj}t jj|j|_t jj|jrt jj|j rtd |jd ||jpg}|j|4}|j||}|j p|j }t!|j"|j#} |j"rIt$|j" rIt%j&d |j"d|_"t'|j d|} t(d| d|jd|j d|j)d|j*d|jd|j d|j+d|j,d|j-d|jd|d|d|j.d|j/d| d|j0} |j1| |||||j2| | j3s&dSzy|j sFt4 sF|j" rV| j5|n+t6| |d gd!g} | j7d"d|j s| j8||d#|j9d$|jt:d%|jd&|d#|j9d$|jd|j/} t;| j<d't=j>d(}g}xc|D][}|j2}y*t?|j2| }|rB|d)|7}Wnt@k rWYnX|j|q Wd*jA|}|rt%jBd+|n5d*jAd,d-| jCD}|rt%jBd.|WntDk rd|_ YnXWd|j s| jEXWdQRXWdQRX|jrtF|jg}tGd/d&|d0}tGd/d&|d1}t jj|ru|j|t jj|r||kr|j|x|D]}xt jH|D]}t jjA|j|}t jj|r]|j)s t%j&d2|qt jjI|r.t%j&d3|qt jj|rPtJjK|n t jL|tJjMt jjA|||qWqWtJjK|| S)4Nz--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.deleter0src_dirrrrr$r"ignore_dependenciesr2r!r#rsession pycompileisolated wheel_cacher< build_optionsr5 autobuildingrootprefixuserhomekeyname- zSuccessfully installed %scSsg|]}|jqSrF)rV).0reqrFrFrG ts z&InstallCommand.run..zSuccessfully downloaded %spurelibplatlibzKTarget 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"r0ospathabspathrIr4r#r&rrrappendrtempfilemkdtempexistsisdirr5_build_session_build_package_finderr;r cache_dirformat_controlrloggerwarningr rrrrJr2r!r' isolated_moder<populate_requirement_setrVhas_requirementswheel prepare_filesrbuildrr%get_lib_location_guessessortedsuccessfully_installedoperator attrgetterr Exceptionjoininfosuccessfully_downloadedr cleanup_filesr rlistdirislinkshutilrmtreeremovemove)rAoptionsrBr4temp_target_dirr5rKfinder build_deleterNr0requirement_setwbpossible_lib_locationsreqsitemsrZiteminstalled_version installed downloaded lib_dir_list purelib_dir platlib_dirlib_dirtarget_item_dirrFrFrGrunsD                                                                zInstallCommand.run) __name__ __module__ __qualname____doc__rVusagesummaryr*rrFrF)rErGrs rcOs$td||}|d|dgS)Nr\r]r^)r)rBkwargsschemerFrFrGrzsrz)( __future__rloggingr}rfrjrrarw ImportErrorpip.reqrpip.basecommandr pip.locationsrrpip.exceptionsrrr pipr pip.utilsr r pip.utils.buildr Zpip.utils.deprecationrpip.utils.filesystemr pip.wheelrr getLoggerrrrrrzrFrFrFrGs0