3 ].@s,dZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZdd lmZdd lmZmZdd lmZmZdd 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/Gddde0Z1Gddde1Z2dS)z(Base Command class, and related routines)absolute_importN) cmdoptions) PackageFinder)running_under_virtualenv) PipSession) BadCommandInstallationErrorUninstallationError CommandErrorPreviousBuildDirError)logging_dictConfig)ConfigOptionParserUpdatingDefaultsHelpFormatter)InstallRequirementparse_requirements)SUCCESSERROR UNKNOWN_ERRORVIRTUALENV_NOT_FOUNDPREVIOUS_BUILD_DIR_ERROR) deprecationget_prognormalize_path)IndentingFormatter)pip_version_checkCommandc@s@eZdZdZdZdZd ZdddZdddZd d Z d d Z dS)rNFext://sys.stdoutext://sys.stderrcCsr|jdt|jftd|j|j|d}tf||_d|jj}tj |j||_ t j t j |j}|jj|dS)Nz%s %sF)usageprog formatteradd_help_optionname descriptionisolatedz %s Options)rrr"r__doc__r parser capitalizeoptparse OptionGroupcmd_optsrmake_option_group general_groupadd_option_group)selfr$ parser_kw optgroup_namegen_optsr2./tmp/pip-build-8jg9gmni/pip/pip/basecommand.py__init__)s zCommand.__init__cCst|jrttjj|jdnd|dk r*|n|j|jd}|jrF|j|_ |j rT|j |_|j s^|rr|dk rj|n|j |_ |j r|j |j d|_ |j |j_|S)Nhttp)cacheretriesinsecure_hosts)r5https)r cache_dirrospathjoinr7 trusted_hostscertverify client_certtimeoutproxyproxiesno_inputauth prompting)r.optionsr7rBsessionr2r2r3_build_sessionAs    zCommand._build_sessioncCs |jj|S)N)r& parse_args)r.argsr2r2r3rKeszCommand.parse_argscs|j|\}}|jr8|jdkr"d|jdkr2dqHdn|jrDdnd}|jrVd}tddd d tjd id td did|jdd gd ddd|jdd ddd|jpddd dd|t t ddd|jrdndgdt fddd2Dd"t j ddd3krtjd$tj|jr(d%tjd&<|jrBd'j|jtjd(<|jrftsftjd)t jtz$y"|j||}t|tr|SWnt k r}z tjt!|tj"d*dd+t#Sd}~Xnt$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+ rt,|d/d r|j-|dt.d0|j/d1}t0|WdQRXXt1S)4NWARNINGrCRITICALDEBUGINFOFexclude_warningsz pip.utils.logging.MaxLevelFilter)z()levelindentz %(message)s)z()formatz(pip.utils.logging.ColorizedStreamHandlerr)rTclassstreamfiltersr )rTrWrXr z+pip.utils.logging.BetterRotatingFileHandlerz /dev/nullT)rTrWfilenamedelayr )consoleconsole_errorsuser_logr\r]r^)rThandlersc3s&|]}|ddkrdndifVqdS)rTrRrrNrQN)rRrr2).0r")rTr2r3 s zCommand.main.. pip._vendordistlibrequestsurllib3)versiondisable_existing_loggersrY formattersr_rootloggerszPython 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.61 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)2rKquietverboselogr loggingrNr log_streamslistfilterdictsys version_infowarningswarnrPython26DeprecationWarningrEr;environ exists_actionr= require_venvrloggercriticalexitrrun isinstanceintr strdebugrrr rrr KeyboardInterruptrdisable_pip_version_checkgetattrrJminrBrr)r.rLrH root_levelstatusexcrIr2)rTr3mainis             z Command.main)rr)F)NN) __name__ __module__ __qualname__r"rhiddenrwr4rJrKrr2r2r2r3r#s  $c@s"eZdZeddZdddZdS)RequirementCommandc Cs"x6|jD],}x&t|d||||dD]}|j|q"WqWx&|D]}|jtj|d|j|dq>Wx*|jD] }|jtj||j|j|dqhWd} x8|j D].}x(t|||||dD]}d} |j|qWqW|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) constraintfinderrHrI wheel_cacheN)r$r) default_vcsr$rF)rrHrIrr"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")) constraintsradd_requirementr from_line isolated_mode editables from_editabler requirementsrequire_hashes find_linksrzr=rwarning) requirement_setrLrHrrIr"rrZreqfound_req_in_fileoptsmsgr2r2r3populate_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,) rformat_control index_urlsr>allow_all_prereleasesprocess_dependency_linksrIplatformversionsabiimplementation) index_urlextra_index_urlsrqrrr=rrrr>prer)r.rHrIrpython_versionsrrrr2r2r3_build_package_finder:s z(RequirementCommand._build_package_finder)NNNN)rrr staticmethodrrr2r2r2r3rs 8r)3r% __future__rrvr;r{r(r}pipr pip.indexr pip.locationsr pip.downloadrpip.exceptionsrrr r r pip.compatr pip.baseparserr rpip.reqrrpip.status_codesrrrrr pip.utilsrrrpip.utils.loggingrpip.utils.outdatedr__all__ getLoggerrrobjectrrr2r2r2r3s.         _