3

Q'íc†.ã@s,dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZmZmZmZmZdd	lmZdd
lmZmZddlmZmZddlmZm Z m!Z!m"Z"m#Z#dd
l$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+dgZ,ej-e.ƒZ/Gdd„de0ƒZ1Gdd„de1ƒZ2dS)z(Base Command class, and related routinesé)Úabsolute_importN)Ú
cmdoptions)Ú
PackageFinder)Úrunning_under_virtualenv)Ú
PipSession)Ú
BadCommandÚInstallationErrorÚUninstallationErrorÚCommandErrorÚPreviousBuildDirError)Úlogging_dictConfig)ÚConfigOptionParserÚUpdatingDefaultsHelpFormatter)ÚInstallRequirementÚparse_requirements)ÚSUCCESSÚERRORÚ
UNKNOWN_ERRORÚVIRTUALENV_NOT_FOUNDÚPREVIOUS_BUILD_DIR_ERROR)ÚdeprecationÚget_progÚnormalize_path)ÚIndentingFormatter)Úpip_version_checkÚCommandc@s@eZdZdZdZdZd
Zddd„Zddd„Zd	d
„Z	dd„Z
dS)rNFúext://sys.stdoutúext://sys.stderrcCsr|jdtƒ|jftƒd|j|j|dœ}tf|Ž|_d|jjƒ}tj	|j|ƒ|_
tjtj
|jƒ}|jj|ƒdS)Nz%s %sF)ÚusageÚprogÚ	formatterÚadd_help_optionÚnameÚdescriptionÚisolatedz
%s Options)rrr"rÚ__doc__r
ÚparserÚ
capitalizeÚoptparseÚOptionGroupÚcmd_optsrÚmake_option_groupÚ
general_groupÚadd_option_group)Úselfr$Ú	parser_kwÚ
optgroup_nameÚgen_opts©r2ú./tmp/pip-build-l_bcah40/pip/pip/basecommand.pyÚ__init__)szCommand.__init__cCs˜t|jrttjj|jdƒƒnd|dk	r*|n|j|jd}|jrF|j|_	|j
rT|j
|_|js^|rr|dk	rj|n|j|_|jrˆ|j|jdœ|_
|j|j_|S)NÚhttp)ÚcacheÚretriesÚinsecure_hosts)r5Úhttps)rÚ	cache_dirrÚosÚpathÚjoinr7Ú
trusted_hostsÚcertÚverifyÚclient_certÚtimeoutÚproxyÚproxiesÚno_inputÚauthÚ	prompting)r.Úoptionsr7rBÚsessionr2r2r3Ú_build_sessionAs

zCommand._build_sessioncCs|jj|ƒS)N)r&Ú
parse_args)r.Úargsr2r2r3rKeszCommand.parse_argscsÚ|j|ƒ\}}|jr8|jdkr"d‰|jdkr2d‰qHd‰n|jrDd‰nd‰ˆ}|jrVd}tddd	d
tjdœidtd
dœiˆd|jdd	gddœdd|jdddœdd|jpªddddœdœ|t	t
ddd|jrÌdndgƒƒdœt‡fdd„d2Dƒƒd"œƒtj
dd…d3krtjd$tjƒ|jr(d%tjd&<|jrBd'j|jƒtjd(<|jrftƒsftjd)ƒtjtƒz$y"|j||ƒ}t|tƒrˆ|SWnüt k
rÊ}z tjt!|ƒƒtj"d*dd+t#Sd}~XnÀt$t%t&fk
r}z tjt!|ƒƒtj"d*dd+t'Sd}~Xn~t(k
rF}ztjd,|ƒtj"d*dd+t'Sd}~XnDt)k
rrtjd-ƒtj"d*dd+t'Stjd.dd+t*SWd|j+rÔt,|d/dƒrÔ|j-|dt.d0|j/ƒd1}t0|ƒWdQRXXt1S)4NéÚWARNINGérÚCRITICALÚDEBUGÚINFOFÚexclude_warningsz pip.utils.logging.MaxLevelFilter)z()ÚlevelÚindentz%(message)s)z()Úformatz(pip.utils.logging.ColorizedStreamHandlerr)rTÚclassÚstreamÚfiltersr )rTrWrXr z+pip.utils.logging.BetterRotatingFileHandlerz	/dev/nullT)rTrWÚfilenameÚdelayr )ÚconsoleÚconsole_errorsÚuser_logr\r]r^)rTÚhandlersc3s&|]}|dˆdkrdndifVqdS)rTrRrrNrQN)rRrr2)Ú.0r")rTr2r3ú	<genexpr>¯s
zCommand.main.<locals>.<genexpr>úpip._vendorÚdistlibÚrequestsÚurllib3)ÚversionÚdisable_existing_loggersrYÚ
formattersr_ÚrootÚloggersézPython 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6Ú1ÚPIP_NO_INPUTú ÚPIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zException information:)Úexc_infoz	ERROR: %szOperation cancelled by userz
Exception:Úno_indexé)r7rB)rbrcrdre)rOrk)2rKÚquietÚverboseÚlogrÚloggingrNrÚlog_streamsÚlistÚfilterÚdictÚsysÚversion_infoÚwarningsÚwarnrÚPython26DeprecationWarningrEr;ÚenvironÚ
exists_actionr=Úrequire_venvrÚloggerÚcriticalÚexitrÚrunÚ
isinstanceÚintrÚstrÚdebugrrr	rrr
ÚKeyboardInterruptrÚdisable_pip_version_checkÚgetattrrJÚminrBrr)r.rLrHÚ
root_levelÚstatusÚexcrIr2)rTr3Úmainis°










zCommand.main)rr)F)NN)Ú__name__Ú
__module__Ú__qualname__r"rÚhiddenrwr4rJrKr’r2r2r2r3r#s

$c@s"eZdZedd„ƒZddd„ZdS)ÚRequirementCommandc	Cs"x6|jD],}x&t|d||||dD]}|j|ƒq"WqWx&|D]}|jtj|d|j|dƒq>Wx*|jD] }|jtj||j|j|dƒqhWd}	x8|j	D].}x(t|||||dD]}d}	|j|ƒq°Wq˜W|j
|_
|pÞ|jpÞ|	sd|i}
|jrd	t|
d
j
|jƒd}nd|
}tj|ƒdS)
z?
        Marshal cmd line args into a requirement set.
        T)Ú
constraintÚfinderrHrIÚwheel_cacheN)r$rš)Údefault_vcsr$ršF)r™rHrIršr"z^You must give at least one requirement to %(name)s (maybe you meant "pip %(name)s %(links)s"?)rn)ÚlinkszLYou must give at least one requirement to %(name)s (see "pip help %(name)s"))ÚconstraintsrÚadd_requirementrÚ	from_lineÚ
isolated_modeÚ	editablesÚ
from_editabler›ÚrequirementsÚrequire_hashesÚ
find_linksrzr=rƒÚwarning)Úrequirement_setrLrHr™rIr"ršrZÚreqÚfound_req_in_fileÚoptsÚmsgr2r2r3Úpopulate_requirement_setsF
z+RequirementCommand.populate_requirement_setNc
CsR|jg|j}|jr*tjddj|ƒƒg}t|j|j||j	|j
|j|||||dS)zR
        Create a package finder appropriate to this requirement command.
        zIgnoring indexes: %sú,)r¥Úformat_controlÚ
index_urlsr>Úallow_all_prereleasesÚprocess_dependency_linksrIÚplatformÚversionsÚabiÚimplementation)Ú	index_urlÚextra_index_urlsrqrƒrŠr=rr¥r®r>Úprer±)r.rHrIr²Úpython_versionsr´rµr¯r2r2r3Ú_build_package_finder:s z(RequirementCommand._build_package_finder)NNNN)r“r”r•Ústaticmethodr¬rºr2r2r2r3r—s8r—)3r%Ú
__future__rrvr;r{r(r}ÚpiprÚ	pip.indexrÚ
pip.locationsrÚpip.downloadrÚpip.exceptionsrrr	r
rÚ
pip.compatrÚpip.baseparserr
rÚpip.reqrrÚpip.status_codesrrrrrÚ	pip.utilsrrrÚpip.utils.loggingrÚpip.utils.outdatedrÚ__all__Ú	getLoggerr“rƒÚobjectrr—r2r2r2r3Ú<module>s.
_