mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Support magic PIP_SKIP_REQUIREMENTS_REGEX in pip freeze
This commit is contained in:
parent
14fcda6977
commit
5827857072
6
pip.py
6
pip.py
|
@ -577,6 +577,9 @@ class FreezeCommand(Command):
|
|||
find_links = options.find_links or []
|
||||
## FIXME: Obviously this should be settable:
|
||||
find_tags = False
|
||||
skip_match = None
|
||||
if os.environ.get('PIP_SKIP_REQUIREMENTS_REGEX'):
|
||||
skip_match = re.compile(os.environ['PIP_SKIP_REQUIREMENTS_REGEX'])
|
||||
|
||||
if filename == '-':
|
||||
logger.move_stdout_to_stderr()
|
||||
|
@ -608,6 +611,9 @@ class FreezeCommand(Command):
|
|||
if not line.strip() or line.strip().startswith('#'):
|
||||
f.write(line)
|
||||
continue
|
||||
if skip_match and skip_match.search(line):
|
||||
f.write(line)
|
||||
continue
|
||||
elif line.startswith('-e') or line.startswith('--editable'):
|
||||
if line.startswith('-e'):
|
||||
line = line[2:].strip()
|
||||
|
|
Loading…
Reference in a new issue