def package_finder(argv):
 try:
  command = InstallCommand()
 except TypeError:
  from pip.baseparser import create_main_parser
  command = InstallCommand(create_main_parser())
 (options, _) = loads(dumps(command.parser)).parse_args(argv)
 possible_options = ['find_links', FORMAT_CONTROL_ARG, 'allow_external', 'allow_unverified', 'allow_all_external', ('allow_all_prereleases', 'pre'), 'process_dependency_links']
 kwargs = {}
 for option in possible_options:
  (kw, attr) = (option if isinstance(option, tuple) else (option, option))
  value = getattr(options, attr, MARKER)
  if (value is not MARKER):
   kwargs[kw] = value
 index_urls = ([options.index_url] + options.extra_index_urls)
 if options.no_index:
  index_urls = []
 index_urls += getattr(options, 'mirrors', [])
 if hasattr(command, '_build_session'):
  kwargs['session'] = command._build_session(options)
 return PackageFinder(index_urls=index_urls, **kwargs)

def package_finder ( argv ) : try : command = InstallCommand ( ) except TypeError : from pip . baseparser import create_main_parser command = InstallCommand ( create_main_parser ( ) ) ( options , _ ) = loads ( dumps ( command . parser ) ) . parse_args ( argv ) possible_options = [ 'find_links' , FORMAT_CONTROL_ARG , 'allow_external' , 'allow_unverified' , 'allow_all_external' , ( 'allow_all_prereleases' , 'pre' ) , 'process_dependency_links' ] kwargs = { } for option in possible_options : ( kw , attr ) = ( option if isinstance ( option , tuple ) else ( option , option ) ) value = getattr ( options , attr , MARKER ) if ( value is not MARKER ) : kwargs [ kw ] = value index_urls = ( [ options . index_url ] + options . extra_index_urls ) if options . no_index : index_urls = [ ] index_urls += getattr ( options , 'mirrors' , [ ] ) if hasattr ( command , '_build_session' ) : kwargs [ 'session' ] = command . _build_session ( options ) return PackageFinder ( index_urls = index_urls , ** kwargs )
return a packagefinder respecting command-line options .