3
3
import logging
4
4
import sys
5
5
import textwrap
6
+ import warnings
6
7
8
+ from pip import cmdoptions
7
9
from pip .basecommand import Command , SUCCESS
8
10
from pip .download import PipXmlrpcTransport
9
- from pip .index import PyPI
10
11
from pip .utils import get_terminal_size
12
+ from pip .utils .deprecation import RemovedInPip10Warning
11
13
from pip .utils .logging import indent_log
12
14
from pip .exceptions import CommandError
13
15
from pip .status_codes import NO_MATCHES_FOUND
@@ -31,8 +33,8 @@ def __init__(self, *args, **kw):
31
33
'--index' ,
32
34
dest = 'index' ,
33
35
metavar = 'URL' ,
34
- default = PyPI .pypi_url ,
35
36
help = 'Base URL of Python Package Index (default %default)' )
37
+ self .cmd_opts .add_option (cmdoptions .index_url ())
36
38
37
39
self .parser .insert_option_group (0 , self .cmd_opts )
38
40
@@ -53,7 +55,14 @@ def run(self, options, args):
53
55
return NO_MATCHES_FOUND
54
56
55
57
def search (self , query , options ):
56
- index_url = options .index
58
+ if options .index is not None :
59
+ warnings .warn (
60
+ "--index has been deprecated in favor of --index-url." ,
61
+ RemovedInPip10Warning ,
62
+ )
63
+ index_url = options .index
64
+ else :
65
+ index_url = options .index_url
57
66
with self ._build_session (options ) as session :
58
67
transport = PipXmlrpcTransport (index_url , session )
59
68
pypi = xmlrpc_client .ServerProxy (index_url , transport )
0 commit comments