3 Pf.@sxdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddlZddlmZddlmZddlmZdd lmZdd lmZd gZejd ejZejd Zejejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1gZ2ej3ej4ej5gZ6dde6DZ7d dd Z8ddZ9d!ddZ:ddZ;ddZddZ?dS)"z Requirements file parsing )absolute_importN)parse) filterfalse)get_file_content)InstallRequirement)RequirementsFileParseError)RemovedInPip10Warning) cmdoptionsparse_requirementsz^(http|https|file):z (^|\s)+#.*$cCsg|] }|jqS)dest).0or r /usr/lib/python3.6/req_file.py =srFc csp|dkrtdt|||d\}}t||} x>| D]6\} } t| || ||||||d } x| D] } | VqZWq2WdS)aParse 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 NzCparse_requirements() missing 1 required keyword argument: 'session') comes_fromsession) constraint) TypeErrorr preprocess process_line)filenamefinderroptionsrr wheel_cache_content lines_enum line_numberlineZreq_iterreqr r rr @s    cCs.t|jdd}t|}t|}t||}|S)zSplit, filter, and join lines, and return a line iterator :param content: the content of the requirements file :param options: cli options )start) enumerate splitlines join_linesignore_comments skip_regex)rrrr r rras  rc  cs t} | j} d| _|r |j| _t|\} } tjdkr@| jd} | jt j | | \} }d|r`dnd||f}| r|rz|j nd }|rt j || i}x.tD]&}|| jkr| j|r| j|||<qWtj| |||||d Vn(| jr&|r|j nd }|r|jnd}tj| jd |||||d Vn| js6| jr| jrN| jd }d }n| jd }d }tj|rvtj||}n"tj|stjjtjj||}t|||||||d} x| D] }|VqWn>| j r| j |_ n*|r| j!rt"j#dt$| j%r t"j#dt$| j&rt"j#dt$| jr0| jg|_'| j(d krPd |_(t)j*j+|j| j,d krbg|_'| j-rx|j'j.| j-| j/r| j/d }tjjtjj0|}tjj||}tjj1|r|}|j/j2|| j3rd |_4| j5rd |_5| j6r|j7j.dd| j6DdS)a#Process a single requirements line; This can result in creating/yielding requirements, or updating the finder. 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. :param constraint: If True, parsing a constraints file. :param options: OptionParser options that we may update Nutf8z%s %s (line %s)z-cz-rF)risolatedrrr)rr default_vcsr,rT)rrz--allow-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-all-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.z--allow-unverified has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.css|]}d|dfVqdS)*Nr )r hostr r r szprocess_line..)r(r)r*)8 build_parserZget_default_values index_urlZformat_controlbreak_args_optionssys version_infoencode parse_argsshlexsplitZ isolated_moder Zcheck_install_build_globalSUPPORTED_OPTIONS_REQ_DEST__dict__rZ from_lineZ editablesr-Z from_editable requirements constraints SCHEME_REsearch urllib_parseZurljoinospathjoindirnamer require_hashesallow_externalwarningswarnrallow_all_externalZallow_unverifiedZ index_urls use_wheelpipindexZfmt_ctl_no_use_wheelno_indexZextra_index_urlsextend find_linksabspathexistsappendpreZallow_all_prereleasesprocess_dependency_linksZ trusted_hostsZsecure_origins)rrrrrrrrrparserZdefaultsZargs_strZ options_strZoptsrZline_comes_fromr,Z req_optionsr r-Zreq_pathZnested_constraintr valueZreq_dirZrelative_to_reqs_filer r rrns                   rcCsh|jd}g}|dd}x8|D]0}|jds8|jdr.parser_exit)optparseZ OptionParserSUPPORTED_OPTIONSSUPPORTED_OPTIONS_REQZ add_optionexit)rUZoption_factoriesZoption_factoryZoptionr`r r rr1s  r1ccsd}g}x|D]x\}}|jd s,tj|rntj|r>d|}|rb|j||dj|fVg}q||fVq|sv|}|j|jdqW|r|dj|fVdS)zJoins a line ending in '' with the previous line (except when following comments). The joined line takes on the index of the first line. N\rW)endswith COMMENT_REmatchrRrCstrip)rZprimary_line_numberZnew_linerrr r rr%"s    r%ccs8x2|D]*\}}tjd|}|j}|r||fVqWdS)z1 Strips comments and filter empty lines. rfN)rhsubrj)rrrr r rr&?s  r&cs2|r |jnd}|r.tj|tfdd|}|S)zs Skip lines that match '--skip-requirements-regex' pattern Note: the regex pattern is only built once Ncsj|dS)Nr!)r?)e)patternr rTszskip_regex..)Zskip_requirements_regexrecompiler)rrr'r )rmrr'Js  r')NNNNFN)NNNNNF)@__doc__Z __future__rrAror8r4rarGZpip._vendor.six.moves.urllibrr@Zpip._vendor.six.movesrrKZ pip.downloadrZpip.req.req_installrZpip.exceptionsrZpip.utils.deprecationrr __all__rpIr>rhr=Zeditabler<rMr2rOZextra_index_urlrFrIZno_allow_externalZ allow_unsafeZno_allow_unsaferJZ no_use_wheelZ always_unzipZ no_binaryZ only_binaryrSrTZ trusted_hostrErbZinstall_optionsZglobal_optionshashrcr:r rrr3r1r%r&r'r r r rsn