Y.@sdZddlmZddlZddlZddlZddlZddlZddlm 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@saeZdZdZdZdZd ZdddZddddZd d Z d d Z dS)rNFext://sys.stdoutext://sys.stderrcCsd|jddt|jfdtddd|jd|jd |i}t||_d |jj}tj |j||_ t j t j |j}|jj|dS) Nusageprogz%s %s formatteradd_help_optionFname 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-3puug3g5/pip/pip/basecommand.py__init__)s      zCommand.__init__cCstd|jr-ttjj|jdndd|dk rE|n|jd|j}|jro|j|_ |j r|j |_|j s|r|dk r|n|j |_ |j rd|j d|j i|_ |j |j_|S)Ncachehttpretriesinsecure_hostshttps)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|\}}|jrT|jdkr3d|jdkrKdqldn|jrfdnd}|jrd}tddd d d d d ddtjiiddd tddiidddddd|jdd d gddidddddd|jdddidddddd|jp7dd d!ddiid"d|dt t ddd|jrsdndgid#t fd$d%d&d'd(d)gDit j ddd:krtjd+tj|jrd,tjd-<|jrd.j|jtjd/<|jrDtsDtjd0t jtzty)|j||}t|tro|SWnDt k r}z/tjt!|tj"d1d2d!t#SWYdd}~Xnt$t%t&fk r}z/tjt!|tj"d1d2d!t'SWYdd}~Xnt(k rc}z,tjd3|tj"d1d2d!t'SWYdd}~XnTt)k rtjd4tj"d1d2d!t'SYntjd5d2d!t*SYnXWd|j+ rt,|d6d  r|j-|d7dd8t.d9|j/}t0|WdQRXXt1S);NWARNINGrCRITICALDEBUGINFOversiondisable_existing_loggersFfiltersexclude_warningsz()z pip.utils.logging.MaxLevelFilterlevel formattersindentformatz %(message)shandlersconsoleclassz(pip.utils.logging.ColorizedStreamHandlerstreamrr console_errorsuser_logz+pip.utils.logging.BetterRotatingFileHandlerfilenamez /dev/nulldelayTrootloggersc3s3|])}|ddkr!dndifVqdS)rWrRrrNrQN)zINFOzERRORr2).0r")rWr2r3 s zCommand.main..z pip._vendordistlibrequestsurllib3zPython 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_indexr7rB)rOrj)2rKquietverboselogr loggingrNr log_streamslistfilterdictsys version_infowarningswarnrPython26DeprecationWarningrEr;environ exists_actionr= require_venvrloggercriticalexitrrun isinstanceintr strdebugrrr rrr KeyboardInterruptrdisable_pip_version_checkgetattrrJminrBrr)r.rLrH root_levelstatusexcrIr2)rWr3mainis                          z Command.main)rr) __name__ __module__ __qualname__r"rhiddenrvr4rJrKrr2r2r2r3r#s $ c@s:eZdZeddZddddddZdS)RequirementCommandc CsxS|jD]H}x?t|ddd|d|d|d|D]}|j|q;Wq Wx6|D].}|jtj|dd|jd|q]Wx?|jD]4}|jtj|d |jd|jd|qWd } xS|j D]H}x?t|d|d|d|d|D]}d} |j|q WqW|j |_ |pK|jpK| sd |i} |j rd t | d dj |j } n d| } tj| dS)z? Marshal cmd line args into a requirement set. constraintTfinderrHrI wheel_cacheNr$ default_vcsFr"z^You must give at least one requirement to %(name)s (maybe you meant "pip %(name)s %(links)s"?)linksrmzLYou 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_linksryr=rwarning) requirement_setrLrHrrIr"rrareqfound_req_in_fileoptsmsgr2r2r3populate_requirement_setsF       "z+RequirementCommand.populate_requirement_setNcCs|jg|j}|jr;tjddj|g}td|jd|jd|d|j d|j d|j d |d |d |d |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_urlsrprrr=rrrr>prer)r.rHrIrpython_versionsrrrr2r2r3_build_package_finder:s       z(RequirementCommand._build_package_finder)rrr staticmethodrrr2r2r2r3rs 8r)3r% __future__rrur;rzr(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,     ((