3

Q'íc•Fã@s ddlmZddlZddlZddlZddlZddlZddlZyddlZWne	k
r`dZYnXddl
mZddlm
Z
ddlmZmZddlmZmZmZddlmZddlmZmZdd	lmZdd
lmZddlmZddl m!Z!m"Z"dd
lm#Z#ej$e%ƒZ&Gdd„de
ƒZ'dd„Z(dS)é)Úabsolute_importN)ÚRequirementSet)ÚRequirementCommand)Úvirtualenv_no_globalÚdistutils_scheme)ÚInstallationErrorÚCommandErrorÚPreviousBuildDirError)Ú
cmdoptions)Ú
ensure_dirÚget_installed_version)ÚBuildDirectory)ÚRemovedInPip10Warning)Úcheck_path_owner)Ú
WheelCacheÚWheelBuilder)Úrunning_under_virtualenvcs4eZdZdZdZdZdZ‡fdd„Zdd„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.
    Úinstalla%
      %prog [options] <requirement specifier> [package-index-options] ...
      %prog [options] -r <requirements file> [package-index-options] ...
      %prog [options] [-e] <vcs project url> ...
      %prog [options] [-e] <local project path> ...
      %prog [options] <archive url/path> ...zInstall packages.c
sPtt|ƒj||Žd}tƒr d}tjƒdkr0d}|j}|jtj	ƒƒ|jtj
ƒƒ|jtjƒƒ|jtjƒƒ|jddddddd	|jd
dd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ƒƒ|jtjƒƒtjtj|jƒ}|jjd|ƒ|jjd|ƒdS):NTFrz-tz--targetÚ
target_dirÚdirz¥Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions.)ÚdestÚmetavarÚdefaultÚhelpz-dz
--downloadz--download-dirz--download-directoryÚdownload_dirz`Download packages into <dir> instead of installing them, regardless of what's already installed.z-Uz	--upgradeÚupgradeÚ
store_truez‚Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.)rÚactionrz--upgrade-strategyÚupgrade_strategyÚeagerzonly-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).)rrÚchoicesrz--force-reinstallÚforce_reinstallzKWhen upgrading, reinstall all packages even if they are already up-to-date.z-Iz--ignore-installedÚignore_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--eggÚas_eggzâInstall 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	--compileÚcompilezCompile py files to pyc)rrrrz--no-compilezDo not compile py files to pyc)rrr)ÚsuperrÚ__init__rÚosÚgeteuidÚcmd_optsÚ
add_optionr
ÚconstraintsÚeditableÚrequirementsÚ	build_dirÚsrcÚignore_requires_pythonÚno_depsÚinstall_optionsÚglobal_optionsÚ	use_wheelÚno_use_wheelÚ	no_binaryÚonly_binaryÚpreÚno_cleanÚrequire_hashesÚmake_option_groupÚindex_groupÚparserÚinsert_option_group)ÚselfÚargsÚkwÚdefault_userr.Ú
index_opts)Ú	__class__©ú3/tmp/pip-build-l_bcah40/pip/pip/commands/install.pyr+7sÊzInstallCommand.__init__c&CsÜtj|ƒtj|ƒ|jr&tjdtƒ|jr8tjdtƒ|jrJtjdtƒ|j	r\tjdtƒ|j
rttjdtƒd|_|jrŠt
jj|jƒ|_t
jj|jƒ|_|jp¢g}|jrÚ|jr¸tdƒ‚tƒrÆtdƒ‚|jd	ƒ|jd
ƒd}|jr<d|_tjƒ}t
jj|jƒ|_t
jj|jƒr.t
jj|jƒr.tdƒ‚|jd|ƒ|jpFg}|j|ƒP}|j||ƒ}|j pn|j}t!|j"|j#ƒ}	|j"rªt$|j"ƒrªt%j&d
|j"ƒd|_"t'|j|dà}
t(|
|j|j
|j)|j*|j|j|j+|j,|j-|j|||j.|j/|	|j0d}|j1||||||j2|	ƒ|j3s$dSz\y6|j
sFt4sF|j"rR|j5|ƒnt6||ggd}|j7dd|j
s6|j8|||j9|jdt:|j||j9|j|j/d}
t;|j<t=j>dƒd}g}xX|D]P}|j2}y"t?|j2|
ƒ}|rî|d|7}Wnt@k
rYnX|j|ƒqÄWdjA|ƒ}|r^t%jBd|ƒn(djAdd„|jCDƒƒ}|r^t%jBd|ƒWntDk
r~d|_ ‚YnXWd|j s”|jEƒXWdQRXWdQRX|jrØtF|jƒg}tGd|dd}tGd|dd}t
jj|ƒrø|j|ƒt
jj|ƒr||kr|j|ƒx²|D]ª}x¢t
jH|ƒD]”}t
jjA|j|ƒ}t
jj|ƒr¬|j)sjt%j&d |ƒq0t
jjI|ƒrˆt%j&d!|ƒq0t
jj|ƒr¢tJjK|ƒn
t
jL|ƒtJjMt
jjA||ƒ|ƒq0Wq 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.z‰pip 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=zÝThe 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)r3Úsrc_dirrrrr&r#Úignore_dependenciesr5r"r$rÚsessionÚ	pycompileÚisolatedÚwheel_cacher?)Ú
build_optionsr8)Úautobuilding)ÚrootÚprefix)ÚuserÚhomerUrVrQÚname)Úkeyú-ú zSuccessfully installed %scSsg|]
}|j‘qSrJ)rY)Ú.0ÚreqrJrJrKú
<listcomp>†sz&InstallCommand.run.<locals>.<listcomp>zSuccessfully downloaded %sÚ)rXÚpurelibÚplatlibzKTarget directory %s already exists. Specify --upgrade to force replacement.z„Target 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_binaryÚcheck_install_build_globalr&ÚwarningsÚwarnrÚallow_externalÚallow_all_externalÚallow_unverifiedrr#r3r,ÚpathÚabspathrMr7r$r(rrrÚappendrÚtempfileÚmkdtempÚexistsÚisdirr8Ú_build_sessionÚ_build_package_finderr>rÚ	cache_dirÚformat_controlrÚloggerÚwarningr
rrrrNr5r"r)Ú
isolated_moder?Úpopulate_requirement_setrYÚhas_requirementsÚwheelÚ
prepare_filesrÚbuildrr'Úget_lib_location_guessesÚsortedÚsuccessfully_installedÚoperatorÚ
attrgetterrÚ	ExceptionÚjoinÚinfoÚsuccessfully_downloadedr	Ú
cleanup_filesrrÚlistdirÚislinkÚshutilÚrmtreeÚremoveÚmove)rDÚoptionsrEr7Útemp_target_dirr8rOÚfinderÚbuild_deleterRr3Úrequirement_setÚwbÚpossible_lib_locationsÚreqsÚitemsr^ÚitemÚinstalled_versionÚ	installedÚ
downloadedÚlib_dir_listÚpurelib_dirÚplatlib_dirÚlib_dirÚtarget_item_dirrJrJrKÚrunÒsD

















zInstallCommand.run)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__rYÚusageÚsummaryr+rŸÚ
__classcell__rJrJ)rIrKr srcOstd|ž|Ž}|d|dgS)Nr`rarb)r`)r)rEÚkwargsÚschemerJrJrKr}Åsr}))Ú
__future__rÚloggingr€r,rmr‰rerzÚImportErrorÚpip.reqrÚpip.basecommandrÚ
pip.locationsrrÚpip.exceptionsrrr	Úpipr
Ú	pip.utilsrrÚpip.utils.buildr
Zpip.utils.deprecationrÚpip.utils.filesystemrÚ	pip.wheelrrrÚ	getLoggerr rurr}rJrJrJrKÚ<module>s6

(