ó vÆ_c@@sVdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZmZddlmZddlmZdd lmZdd lmZdd lmZer‚dd lmZdd lmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ee$e)e#fZ*ee#ge$e+effZ,ndgZ-ej.dej/ƒZ0ej.dƒZ1ej.dƒZ2e j3e j4e j5e j6e j7e j8e j9e j:e j;e j<e j=e j>e j?e j@gZAe jBe jCe jDgZEgeED]ZFe+eFƒjGƒ^q7ZHdeIfd„ƒYZJdeIfd„ƒYZKdddeMd„ZNd„ZOdd„ZPdddd„ZQdddd„ZRdeIfd„ƒYZSd„ZTd „ZUd!eVfd"„ƒYZWd#„ZXd$„ZYd%„ZZd&„Z[dd'„Z\ej.d(ej/ƒZ]dS()s Requirements file parsing i(tabsolute_importN(tparse(t cmdoptions(tInstallationErrortRequirementsFileParseError(t SearchScope(traise_for_status(t auto_decode(tMYPY_CHECK_RUNNING(tget_url_scheme(tValues( tAnytCallabletDicttIteratortListtNoReturntOptionaltTexttTuple(t PackageFinder(t PipSessiontparse_requirementss^(http|https|file):s (^|\s+)#.*$s#(?P\$\{(?P[A-Z0-9_]+)\})tParsedRequirementcB@seZddd„ZRS(cC@s:||_||_||_||_||_||_dS(N(t requirementt is_editablet comes_fromtoptionst constraintt line_source(tselfRRRRRR((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyt__init__Ps     N(t__name__t __module__tNoneR(((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyROst ParsedLinecB@seZd„ZRS(cC@sŒ||_||_||_||_||_|rQt|_t|_||_ n7|j rt|_t|_|j d|_ n t|_dS(Ni( tfilenametlinenoRtoptsRtTruetis_requirementtFalseRRt editables(RR$R%RtargsR&R((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyRcs           (R R!R(((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR#bsc c@sqt|ƒ}t|||ƒ}xL|j||ƒD]8}t|d|d|d|ƒ} | dk r1| Vq1q1WdS(s­Parse a requirements file and yield ParsedRequirement instances. :param filename: Path or url of requirements file. :param session: PipSession instance. :param finder: Instance of pip.index.PackageFinder. :param comes_from: Origin description of requirements. :param options: cli options. :param constraint: If true, parsing a constraint file rather than requirements file. RtfindertsessionN(tget_line_parsertRequirementsFileParserRt handle_lineR"( R$R-R,RRRt line_parsertparsert parsed_linet parsed_req((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR€s   cC@s@t|jƒddƒ}t|ƒ}t|ƒ}t|ƒ}|S(sxSplit, filter, and join lines, and return a line iterator :param content: the content of the requirements file tstarti(t enumeratet splitlinest join_linestignore_commentstexpand_env_variables(tcontentt lines_enum((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyt preprocess¡s    c C@s&dj|jrdnd|j|jƒ}|js9t‚|jrjtd|jd|jd|d|jƒS|r†t j ||j ƒni}xGt D]?}||j j kr“|j j |r“|j j |||êsit find_linkst index_urlss line {} of {}tsource(trequire_hashesRHtextendRKRLt index_urltno_indexR'textra_index_urlstostpathtdirnametabspathtjointexiststappendRt search_scopetpretset_allow_all_prereleasest prefer_binarytset_prefer_binaryt trusted_hostsR>tadd_trusted_host(R&R$R%R,RR-RKRLtvaluetreq_dirtrelative_to_reqs_fileRZthostRM((RsK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pythandle_option_lineÚsD                   cC@sF|jrt||ƒ}|St|j|j|j|||ƒdSdS(sHandle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder. :param line: The parsed line to be processed. :param options: CLI options. :param finder: The finder - updated by non-requirement lines. :param session: The session - updated by non-requirement lines. Returns a ParsedRequirement object if the line is a requirement line, otherwise returns None. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be present, but are ignored. For lines that do not contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may be present, but are ignored. These lines may contain multiple options (although our docs imply only one is supported), and all our parsed and affect the finder. N(R(RGReR&R$R%R"(RCRR,R-R4((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR0s R/cB@s,eZd„Zd„Zd„Zd„ZRS(cC@s||_||_||_dS(N(t_sessiont _line_parsert _comes_from(RR-R1R((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyRCs  cc@s&x|j||ƒD] }|VqWdS(s3Parse a given file, yielding parsed lines. N(t_parse_and_recurse(RR$RRC((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyRNscc@sÿxø|j||ƒD]ä}|j rò|jjs;|jjrò|jjr`|jjd}t}n|jjd}t}tj|ƒršt j ||ƒ}n3tj|ƒsÍt j j t j j|ƒ|ƒ}nx'|j||ƒD] }|VqàWq|VqWdS(Ni(t _parse_fileR(R&t requirementst constraintsR)R't SCHEME_REtsearcht urllib_parseturljoinRSRTRWRURi(RR$RRCtreq_pathtnested_constraintt inner_line((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyRiUs"      c c@sµt||jd|jƒ\}}t|ƒ}x|D]y\}}y|j|ƒ\}} Wn4tk r} dj|| jƒ} t| ƒ‚nXt |||j|| |ƒVq4WdS(NRsInvalid requirement: {} {}( tget_file_contentRfRhR=RgtOptionParsingErrorR>tmsgRR#( RR$Rt_R;R<t line_numberRCtargs_strR&teRv((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyRjvs  (R R!RRRiRj(((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR/Bs  !c@s‡fd†}|S(Nc@s‘tƒ}|jƒ}d|_ˆr3ˆj|_nt|ƒ\}}tjdkrf|jdƒ}n|j t j |ƒ|ƒ\}}||fS(Niiitutf8(iii( t build_parsertget_default_valuesR"RPtformat_controltbreak_args_optionstsyst version_infotencodet parse_argstshlextsplit(RCR2tdefaultsRyt options_strR&Rw(R,(sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyt parse_line’s   ((R,Rˆ((R,sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR.scC@s…|jdƒ}g}|}xJ|D]B}|jdƒsG|jdƒrKPq#|j|ƒ|jdƒq#Wdj|ƒdj|ƒfS(s½Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex. t t-s--i(R…t startswithRYtpopRW(RCttokensR+Rttoken((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR«s  RucB@seZd„ZRS(cC@s ||_dS(N(Rv(RRv((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR¾s(R R!R(((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyRu½scC@sYtjdtƒ}tt}x$|D]}|ƒ}|j|ƒq#Wd„}||_|S(s7 Return a parser for parsing requirement lines tadd_help_optioncS@st|ƒ‚dS(N(Ru(RRv((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyt parser_exitÑs(toptparset OptionParserR)tSUPPORTED_OPTIONStSUPPORTED_OPTIONS_REQt add_optiontexit(R2toption_factoriestoption_factorytoptionR((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR|Ãs     cc@sd}g}xÄ|D]¼\}}|jdƒ s>tj|ƒrªtj|ƒrZd|}n|rœ|j|ƒ|dk st‚|dj|ƒfVg}qÏ||fVq|s¹|}n|j|jdƒƒqW|r|dk sët‚|dj|ƒfVndS(s’Joins a line ending in '' with the previous line (except when following comments). The joined line takes on the index of the first line. s\R‰tN(R"tendswitht COMMENT_REtmatchRYR?RWtstrip(R<tprimary_line_numbertnew_lineRxRC((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR8Ûs$    cc@sMxF|D]>\}}tjd|ƒ}|jƒ}|r||fVqqWdS(s1 Strips comments and filter empty lines. RšN(RœtsubRž(R<RxRC((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR9ûs  cc@ssxl|D]d\}}xJtj|ƒD]9\}}tj|ƒ}|sJq#n|j||ƒ}q#W||fVqWdS(s«Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across platforms for requirement files. These points are the result of a discussion on the `github pull request #3514 `_. Valid characters in variable names follow the `POSIX standard `_ and are limited to uppercase letter, digits and the `_` (underscore). N(t ENV_VAR_REtfindallRStgetenvtreplace(R<RxRCtenv_vartvar_nameRa((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyR:sc C@s„t|ƒ}|d krA|j|ƒ}t|ƒ|j|jfS|dkr!|r}|jdƒr}tdj||ƒƒ‚n|jddƒd}|j ddƒ}t j |ƒ}|rä|j dƒd|jd dƒd}nt j|ƒ}|jdƒrd|jdƒ}n|}ny.t|d ƒ}t|jƒƒ}Wd QXWn(tk ry} td j| ƒƒ‚nX||fS(sZGets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. :param url: File path or url. :param session: PipSession instance. :param comes_from: Origin description of requirements. thttpthttpstfiles6Requirements file {} references URL {}, which is localt:is\t/t|trbNs$Could not open requirements file: {}(R¨R©(R tgetRturlttextR‹RR>R…R¥t_url_slash_drive_reRtgroupRotunquotetlstriptopenRtreadtIOError( R°R-RtschemetrespRTRRJR;texc((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyRt#s4    * s /*([a-z])\|(^t__doc__t __future__RR‘RStreR„R€tpip._vendor.six.moves.urllibRRotpip._internal.cliRtpip._internal.exceptionsRRt!pip._internal.models.search_scopeRtpip._internal.network.utilsRtpip._internal.utils.encodingRtpip._internal.utils.typingRtpip._internal.utils.urlsR R ttypingR R R RRRRRRt"pip._internal.index.package_finderRtpip._internal.network.sessionRtintt ReqFileLineststrt LineParsert__all__tcompiletIRmRœR¢RPtextra_index_urlRQRlRkteditableRKt no_binaryt only_binaryR]RNR[t trusted_hosttuse_new_featureR“tinstall_optionstglobal_optionsthashR”toRFRAtobjectRR#R"R)RR=RGReR0R/R.Rt ExceptionRuR|R8R9R:RtR²(((sK/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/req/req_file.pyts†     @    %!   . 7 )N     -