capybara/virtualenv/lib/python2.7/site-packages/pip/req/req_file.py
def process_line(line, filename, line_number, finder=None, comes_from=None,
                 options=None, session=None, wheel_cache=None):
    """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.

    """

    parser = build_parser()
    defaults = parser.get_default_values()
    defaults.index_url = None
    if finder:
        # `finder.format_control` will be updated during parsing
        defaults.format_control = finder.format_control
    args_str, options_str = break_args_options(line)
    opts, _ = parser.parse_args(shlex.split(options_str), defaults)

    # yield a line requirement
    if args_str:
        comes_from = '-r %s (line %s)' % (filename, line_number)
        isolated = options.isolated_mode if options else False
        if options:
            cmdoptions.check_install_build_global(options, opts)
        # get the options that apply to requirements
        req_options = {}
        for dest in SUPPORTED_OPTIONS_REQ_DEST:
            if dest in opts.__dict__ and opts.__dict__[dest]:
                req_options[dest] = opts.__dict__[dest]
        yield InstallRequirement.from_line(
            args_str, comes_from, isolated=isolated, options=req_options,
            wheel_cache=wheel_cache
        )

    # yield an editable requirement
    elif opts.editables:
        comes_from = '-r %s (line %s)' % (filename, line_number)
        isolated = options.isolated_mode if options else False
        default_vcs = options.default_vcs if options else None
        yield InstallRequirement.from_editable(
            opts.editables[0], comes_from=comes_from,
            default_vcs=default_vcs, isolated=isolated,
            wheel_cache=wheel_cache
        )

    # parse a nested requirements file
    elif opts.requirements:
        req_path = opts.requirements[0]
        # original file is over http
        if SCHEME_RE.search(filename):
            # do a url join so relative paths work
            req_path = urllib_parse.urljoin(filename, req_path)
        # original file and nested file are paths
        elif not SCHEME_RE.search(req_path):
            # do a join so relative paths work
            req_dir = os.path.dirname(filename)
            req_path = os.path.join(os.path.dirname(filename), req_path)
        # TODO: Why not use `comes_from='-r {} (line {})'` here as well?
        parser = parse_requirements(
            req_path, finder, comes_from, options, session,
            wheel_cache=wheel_cache
        )
        for req in parser:
            yield req

    # set finder options
    elif finder:
        if opts.index_url:
            finder.index_urls = [opts.index_url]
        if opts.use_wheel is False:
            finder.use_wheel = False
            pip.index.fmt_ctl_no_use_wheel(finder.format_control)
        if opts.no_index is True:
            finder.index_urls = []
        if opts.allow_all_external:
            finder.allow_all_external = opts.allow_all_external
        if opts.extra_index_urls:
            finder.index_urls.extend(opts.extra_index_urls)
        if opts.allow_external:
            finder.allow_external |= set(
                [normalize_name(v).lower() for v in opts.allow_external])
        if opts.allow_unverified:
            # Remove after 7.0
            finder.allow_unverified |= set(
                [normalize_name(v).lower() for v in opts.allow_unverified])
        if opts.find_links:
            # FIXME: it would be nice to keep track of the source
            # of the find_links: support a find-links local path
            # relative to a requirements file.
            value = opts.find_links[0]
            req_dir = os.path.dirname(os.path.abspath(filename))
            relative_to_reqs_file = os.path.join(req_dir, value)
            if os.path.exists(relative_to_reqs_file):
                value = relative_to_reqs_file
            finder.find_links.append(value)
def process_line(line, filename, line_number, finder=None, comes_from=None,
                 options=None, session=None, wheel_cache=None):
    """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.

    """

    parser = build_parser()
    defaults = parser.get_default_values()
    defaults.index_url = None
    if finder:
        # `finder.format_control` will be updated during parsing
        defaults.format_control = finder.format_control
    args_str, options_str = break_args_options(line)
    opts, _ = parser.parse_args(shlex.split(options_str), defaults)

    # yield a line requirement
    if args_str:
        comes_from = '-r %s (line %s)' % (filename, line_number)
        isolated = options.isolated_mode if options else False
        if options:
            cmdoptions.check_install_build_global(options, opts)
        # get the options that apply to requirements
        req_options = {}
        for dest in SUPPORTED_OPTIONS_REQ_DEST:
            if dest in opts.__dict__ and opts.__dict__[dest]:
                req_options[dest] = opts.__dict__[dest]
        yield InstallRequirement.from_line(
            args_str, comes_from, isolated=isolated, options=req_options,
            wheel_cache=wheel_cache
        )

    # yield an editable requirement
    elif opts.editables:
        comes_from = '-r %s (line %s)' % (filename, line_number)
        isolated = options.isolated_mode if options else False
        default_vcs = options.default_vcs if options else None
        yield InstallRequirement.from_editable(
            opts.editables[0], comes_from=comes_from,
            default_vcs=default_vcs, isolated=isolated,
            wheel_cache=wheel_cache
        )

    # parse a nested requirements file
    elif opts.requirements:
        req_path = opts.requirements[0]
        # original file is over http
        if SCHEME_RE.search(filename):
            # do a url join so relative paths work
            req_path = urllib_parse.urljoin(filename, req_path)
        # original file and nested file are paths
        elif not SCHEME_RE.search(req_path):
            # do a join so relative paths work
            req_dir = os.path.dirname(filename)
            req_path = os.path.join(os.path.dirname(filename), req_path)
        # TODO: Why not use `comes_from='-r {} (line {})'` here as well?
        parser = parse_requirements(
            req_path, finder, comes_from, options, session,
            wheel_cache=wheel_cache
        )
        for req in parser:
            yield req

    # set finder options
    elif finder:
        if opts.index_url:
            finder.index_urls = [opts.index_url]
        if opts.use_wheel is False:
            finder.use_wheel = False
            pip.index.fmt_ctl_no_use_wheel(finder.format_control)
        if opts.no_index is True:
            finder.index_urls = []
        if opts.allow_all_external:
            finder.allow_all_external = opts.allow_all_external
        if opts.extra_index_urls:
            finder.index_urls.extend(opts.extra_index_urls)
        if opts.allow_external:
            finder.allow_external |= set(
                [normalize_name(v).lower() for v in opts.allow_external])
        if opts.allow_unverified:
            # Remove after 7.0
            finder.allow_unverified |= set(
                [normalize_name(v).lower() for v in opts.allow_unverified])
        if opts.find_links:
            # FIXME: it would be nice to keep track of the source
            # of the find_links: support a find-links local path
            # relative to a requirements file.
            value = opts.find_links[0]
            req_dir = os.path.dirname(os.path.abspath(filename))
            relative_to_reqs_file = os.path.join(req_dir, value)
            if os.path.exists(relative_to_reqs_file):
                value = relative_to_reqs_file
            finder.find_links.append(value)
def process_line ( line , filename , line_number , finder = None , comes_from = None , options = None , session = None , wheel_cache = None ) : parser = build_parser ( ) defaults = parser . get_default_values ( ) defaults . index_url = None if finder : # `finder.format_control` will be updated during parsing defaults . format_control = finder . format_control args_str , options_str = break_args_options ( line ) opts , _ = parser . parse_args ( shlex . split ( options_str ) , defaults ) # yield a line requirement if args_str : comes_from = '-r %s (line %s)' % ( filename , line_number ) isolated = options . isolated_mode if options else False if options : cmdoptions . check_install_build_global ( options , opts ) # get the options that apply to requirements req_options = { } for dest in SUPPORTED_OPTIONS_REQ_DEST : if dest in opts . __dict__ and opts . __dict__ [ dest ] : req_options [ dest ] = opts . __dict__ [ dest ] yield InstallRequirement . from_line ( args_str , comes_from , isolated = isolated , options = req_options , wheel_cache = wheel_cache ) # yield an editable requirement elif opts . editables : comes_from = '-r %s (line %s)' % ( filename , line_number ) isolated = options . isolated_mode if options else False default_vcs = options . default_vcs if options else None yield InstallRequirement . from_editable ( opts . editables [ 0 ] , comes_from = comes_from , default_vcs = default_vcs , isolated = isolated , wheel_cache = wheel_cache ) # parse a nested requirements file elif opts . requirements : req_path = opts . requirements [ 0 ] # original file is over http if SCHEME_RE . search ( filename ) : # do a url join so relative paths work req_path = urllib_parse . urljoin ( filename , req_path ) # original file and nested file are paths elif not SCHEME_RE . search ( req_path ) : # do a join so relative paths work req_dir = os . path . dirname ( filename ) req_path = os . path . join ( os . path . dirname ( filename ) , req_path ) # TODO: Why not use `comes_from='-r {} (line {})'` here as well? parser = parse_requirements ( req_path , finder , comes_from , options , session , wheel_cache = wheel_cache ) for req in parser : yield req # set finder options elif finder : if opts . index_url : finder . index_urls = [ opts . index_url ] if opts . use_wheel is False : finder . use_wheel = False pip . index . fmt_ctl_no_use_wheel ( finder . format_control ) if opts . no_index is True : finder . index_urls = [ ] if opts . allow_all_external : finder . allow_all_external = opts . allow_all_external if opts . extra_index_urls : finder . index_urls . extend ( opts . extra_index_urls ) if opts . allow_external : finder . allow_external |= set ( [ normalize_name ( v ) . lower ( ) for v in opts . allow_external ] ) if opts . allow_unverified : # Remove after 7.0 finder . allow_unverified |= set ( [ normalize_name ( v ) . lower ( ) for v in opts . allow_unverified ] ) if opts . find_links : # FIXME: it would be nice to keep track of the source # of the find_links: support a find-links local path # relative to a requirements file. value = opts . find_links [ 0 ] req_dir = os . path . dirname ( os . path . abspath ( filename ) ) relative_to_reqs_file = os . path . join ( req_dir , value ) if os . path . exists ( relative_to_reqs_file ) : value = relative_to_reqs_file finder . find_links . append ( value )
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.
Process a single requirements line ; This can result in creating / yielding requirements or updating the finder .