File tree 2 files changed +33
-12
lines changed
2 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -156,18 +156,7 @@ To interpret the requirements file in UTF-8 format add a comment
156
156
157
157
The following options are supported:
158
158
159
- * :ref: `-i, --index-url <install_--index-url >`
160
- * :ref: `--extra-index-url <install_--extra-index-url >`
161
- * :ref: `--no-index <install_--no-index >`
162
- * :ref: `-c, --constraint <install_--constraint >`
163
- * :ref: `-r, --requirement <install_--requirement >`
164
- * :ref: `-e, --editable <install_--editable >`
165
- * :ref: `-f, --find-links <install_--find-links >`
166
- * :ref: `--no-binary <install_--no-binary >`
167
- * :ref: `--only-binary <install_--only-binary >`
168
- * :ref: `--require-hashes <install_--require-hashes >`
169
- * :ref: `--pre <install_--pre >`
170
- * :ref: `--trusted-host <--trusted-host >`
159
+ .. pip-reqfile-options-ref ::
171
160
172
161
For example, to specify :ref: `--no-index <install_--no-index >` and two
173
162
:ref: `--find-links <install_--find-links >` locations:
Original file line number Diff line number Diff line change 10
10
11
11
from pip ._internal .cli import cmdoptions
12
12
from pip ._internal .commands import create_command
13
+ from pip ._internal .req .req_file import SUPPORTED_OPTIONS
13
14
14
15
15
16
class PipCommandUsage (rst .Directive ):
@@ -108,9 +109,40 @@ def process_options(self):
108
109
)
109
110
110
111
112
+ class PipReqFileOptionsReference (PipOptions ):
113
+
114
+ def process_options (self ):
115
+ for option in SUPPORTED_OPTIONS :
116
+ if getattr (option , 'deprecated' , False ):
117
+ continue
118
+
119
+ opt = option ()
120
+ opt_name = opt ._long_opts [0 ]
121
+ if opt ._short_opts :
122
+ short_opt_name = '{}, ' .format (opt ._short_opts [0 ])
123
+ else :
124
+ short_opt_name = ''
125
+
126
+ from_install = (
127
+ 'install_'
128
+ if option not in cmdoptions .general_group ['options' ] else
129
+ ''
130
+ )
131
+ self .view_list .append (
132
+ ' * :ref:`{short}{long}<{prefix}{opt_name}>`' .format (
133
+ short = short_opt_name ,
134
+ long = opt_name ,
135
+ prefix = from_install ,
136
+ opt_name = opt_name
137
+ ),
138
+ "\n "
139
+ )
140
+
141
+
111
142
def setup (app ):
112
143
app .add_directive ('pip-command-usage' , PipCommandUsage )
113
144
app .add_directive ('pip-command-description' , PipCommandDescription )
114
145
app .add_directive ('pip-command-options' , PipCommandOptions )
115
146
app .add_directive ('pip-general-options' , PipGeneralOptions )
116
147
app .add_directive ('pip-index-options' , PipIndexOptions )
148
+ app .add_directive ('pip-reqfile-options-ref' , PipReqFileOptionsReference )
You can’t perform that action at this time.
0 commit comments