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
76
77
# the 'dest' string values
77
78
SUPPORTED_OPTIONS_REQ_DEST = [str (o ().dest ) for o in SUPPORTED_OPTIONS_REQ ]
78
79
80
+ logger = logging .getLogger (__name__ )
81
+
79
82
80
83
class ParsedRequirement :
81
84
def __init__ (
@@ -209,6 +212,13 @@ def handle_option_line(
209
212
options : Optional [optparse .Values ] = None ,
210
213
session : Optional [PipSession ] = None ,
211
214
) -> None :
215
+ if opts .hashes :
216
+ logger .warning (
217
+ "%s line %s has --hash but no requirement, and will be ignored." ,
218
+ filename ,
219
+ lineno ,
220
+ )
221
+
212
222
if options :
213
223
# percolate options upward
214
224
if opts .require_hashes :
You can’t perform that action at this time.
0 commit comments