File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change
1
+ Warn if ``--hash `` is used on a line without requirement in a requirements file.
Original file line number Diff line number Diff line change 2
2
Requirements file parsing
3
3
"""
4
4
5
+ import logging
5
6
import optparse
6
7
import os
7
8
import re
77
78
# the 'dest' string values
78
79
SUPPORTED_OPTIONS_REQ_DEST = [str (o ().dest ) for o in SUPPORTED_OPTIONS_REQ ]
79
80
81
+ logger = logging .getLogger (__name__ )
82
+
80
83
81
84
class ParsedRequirement :
82
85
def __init__ (
@@ -210,6 +213,13 @@ def handle_option_line(
210
213
options : Optional [optparse .Values ] = None ,
211
214
session : Optional [PipSession ] = None ,
212
215
) -> None :
216
+ if opts .hashes :
217
+ logger .warning (
218
+ "%s line %s has --hash but no requirement, and will be ignored." ,
219
+ filename ,
220
+ lineno ,
221
+ )
222
+
213
223
if options :
214
224
# percolate options upward
215
225
if opts .require_hashes :
You can’t perform that action at this time.
0 commit comments