Y.@s>dZddlmZddlZddlZddlZddlZddlZddlZddl 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/ej0ej1gZ2ej3ej4ej5gZ6dde6DZ7dddddddd Z8ddZ9ddddddddZ:ddZ;ddZ<ddZ=ddZ>ddZ?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 //tmp/pip-build-3puug3g5/pip/pip/req/req_file.py =s rFc cs|dkrtdt|d|d|\}}t||} xQ| D]I\} } t| || |||||d|} x| D] } | VqWqLWdS)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_numberlinereq_iterreqr r rr @s    cCsCt|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| _|r0|j| _t|\} } tjdkr`| jd} | jt j | | \} }d|rdnd||f}| rA|r|j nd }|rt j || i}x;tD]3}|| jkr| j|r| j|||szprocess_line..)r)r*r+)8 build_parserget_default_values index_urlformat_controlbreak_args_optionssys version_infoencode parse_argsshlexsplit isolated_moder check_install_build_globalSUPPORTED_OPTIONS_REQ_DEST__dict__r from_line editablesr. from_editable requirements constraints SCHEME_REsearch urllib_parseurljoinospathjoindirnamer require_hashesallow_externalwarningswarnrallow_all_externalallow_unverified index_urls use_wheelpipindexfmt_ctl_no_use_wheelno_indexextra_index_urlsextend find_linksabspathexistsappendpreallow_all_prereleasesprocess_dependency_links trusted_hostssecure_origins)rrrrrrrrrparserdefaultsargs_str options_stroptsrline_comes_fromr- req_optionsr r.req_pathnested_constraintr!valuereq_dirrelative_to_reqs_filer r rrns    !       !                  rcCs|jd}g}|dd}xJ|D]B}|jdsP|jdrTPq,|j||jdq,Wdj|dj|fS)zBreak 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.  N-z--r)r< startswithr_poprL)rtokensargsrtokenr r rr6s  r6cCs\tjdd}tt}x$|D]}|}|j|q#Wdd}||_|S)z7 Return a parser for parsing requirement lines add_help_optionFcSst|dS)N)r)selfmsgr r r parser_exitsz!build_parser..parser_exit)optparse OptionParserSUPPORTED_OPTIONSSUPPORTED_OPTIONS_REQ add_optionexit)reoption_factoriesoption_factoryoptionr{r r rr2s     r2ccsd}g}x|D]\}}|jd s>tj|rtj|rWd|}|r|j||dj|fVg}q||fVq|s|}|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\rq)endswith COMMENT_REmatchr_rLstrip)rprimary_line_numbernew_linerrr r rr&"s    r&ccsJxC|D];\}}tjd|}|j}|r||fVqWdS)z1 Strips comments and filter empty lines. rN)rsubr)rrrr r rr'?s  r'csI|r|jnd}|rEtj|tfdd|}|S)zs Skip lines that match '--skip-requirements-regex' pattern Note: the regex pattern is only built once Ncsj|dS)Nr#)rG)e)patternr rTszskip_regex..)skip_requirements_regexrecompiler)rrr(r )rrr(Js r()@__doc__ __future__rrJrr;r7r|rPZpip._vendor.six.moves.urllibrrHpip._vendor.six.movesrrV pip.downloadrZpip.req.req_installrpip.exceptionsrZpip.utils.deprecationrr __all__rIrFrrEeditablerDrYr4r\extra_index_urlrOrRno_allow_external allow_unsafeno_allow_unsaferU no_use_wheel always_unzip no_binary only_binaryr`rb trusted_hostrNr~install_optionsglobal_optionshashrr?r rrr6r2r&r'r(r r r rsl