σ β\e[c@@sψdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl mZddlmZddlmZdd lmZd gZejd ejƒZejd ƒZejd ƒZejejejejejej ej!ej"ej#ej$ej%ej&ej'ej(gZ)ej*ej+ej,gZ-ge-D]Z.e.ƒj/^qgZ0dddde2dd„Z3d„Z4ddddde2d„Z5d„Z6d„Z7d„Z8d„Z9d„Z:d„Z;dS(s Requirements file parsing i(tabsolute_importN(t filterfalse(tparse(t cmdoptions(tget_file_content(tRequirementsFileParseError(tInstallRequirementtparse_requirementss^(http|https|file):s (^|\s)+#.*$s#(?P\$\{(?P[A-Z0-9_]+)\})c c@s |dkrtdƒ‚nt|d|d|ƒ\}}t||ƒ} xQ| D]I\} } t| || |||||d|ƒ} x| D] } | Vq‰WqOWdS(sχParse a requirements file and yield InstallRequirement instances. :param filename: Path or url of requirements file. :param finder: Instance of pip.index.PackageFinder. :param comes_from: Origin description of requirements. :param options: cli options. :param session: Instance of pip.download.PipSession. :param constraint: If true, parsing a constraint file rather than requirements file. :param wheel_cache: Instance of pip.wheel.WheelCache sCparse_requirements() missing 1 required keyword argument: 'session't comes_fromtsessiont constraintN(tNonet TypeErrorRt preprocesst process_line(tfilenametfinderRtoptionsR R t wheel_cachet_tcontentt lines_enumt line_numbertlinetreq_itertreq((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyR<s    cC@sOt|jƒddƒ}t|ƒ}t|ƒ}t||ƒ}t|ƒ}|S(s˜Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file :param options: cli options tstarti(t enumeratet splitlinest join_linestignore_commentst skip_regextexpand_env_variables(RRR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyR ]s    c  c@sΊt|ƒ} | jƒ} d| _|r6|j| _nt|ƒ\} } tjdkri| jdƒ} n| j t j | ƒ| ƒ\} }d|r™dnd||f}| rP|rΎ|j nt }|rέtj|| ƒni}x>tD]6}|| jkrκ| j|rκ| j|||ΫsN(iii(0t build_parsertget_default_valuesR t index_urltformat_controltbreak_args_optionstsyst version_infotencodet parse_argstshlextsplitt isolated_modetFalseRtcheck_install_build_globaltSUPPORTED_OPTIONS_REQ_DESTt__dict__Rt from_linet editablest from_editablet requirementst constraintstTruet SCHEME_REtsearcht urllib_parseturljointostpathtjointdirnameRtrequire_hashest index_urlstno_indextextra_index_urlstextendt find_linkstabspathtexiststappendtpretallow_all_prereleasestprocess_dependency_linkst trusted_hoststsecure_origins(RRRRRRR RR tparsertdefaultstargs_strt options_strtoptsRtline_comes_fromR"t req_optionstdesttreq_pathtnested_constraintRtvaluetreq_dirtrelative_to_reqs_file((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyRks‚   !      $               cC@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(R0t startswithRLtpopRB(RttokenstargsRttoken((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyR*ήs  c@s_tjdtƒ}tt}x$|D]}|ƒ}|j|ƒq#W‡fd†}||_|S(s7 Return a parser for parsing requirement lines tadd_help_optionc@s dˆ|f}t|ƒ‚dS(NsInvalid requirement: %s %s(R(tselftmsg(R(s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyt parser_exitόs(toptparset OptionParserR2tSUPPORTED_OPTIONStSUPPORTED_OPTIONS_REQt add_optiontexit(RRRtoption_factoriestoption_factorytoptionRi((Rs9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyR&οs    cc@sβd}g}x²|D]ͺ\}}|jdƒ s>tj|ƒr˜tj|ƒrZd|}n|rŠ|j|ƒ|dj|ƒfVg}q½||fVq|s§|}n|j|jdƒƒqW|rή|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_REtmatchRLRBtstrip(Rtprimary_line_numbertnew_lineRR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyRs     cc@sMxF|D]>\}}tjd|ƒ}|jƒ}|r||fVqqWdS(s1 Strips comments and filter empty lines. RsN(RutsubRw(RRR((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyR"s  c@sI|r|jnd}|rEtj|ƒ‰t‡fd†|ƒ}n|S(ss Skip lines that match '--skip-requirements-regex' pattern Note: the regex pattern is only built once c@sˆj|dƒS(Ni(R=(te(tpattern(s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyt6sN(tskip_requirements_regexR tretcompileR(RRR((R|s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyR-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 discusssion 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_REtfindallR@tgetenvtreplace(RRRtenv_vartvar_nameR\((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyR :s(<t__doc__t __future__RRjR@RR/R+tpip._vendor.six.movesRtpip._vendor.six.moves.urllibRR>t pip._internalRtpip._internal.downloadRtpip._internal.exceptionsRtpip._internal.req.req_installRt__all__R€tIR<RuRR:teditableR9RFR(RItextra_index_urlt always_unzipt no_binaryt only_binaryRMROt trusted_hostRDRltinstall_optionstglobal_optionsthashRmtoRYR4R R2RR RR*R&RRRR (((s9/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_file.pyts\            q