Skip to content

Commit

Permalink
Fix IndexError parsing comments from pip freeze
Browse files Browse the repository at this point in the history
Ref #2229. This change only fixes the issue seen when calling `pipenv
clean`. A future refactor should consolidate these behaviours (or use
the actual parsing of lines from pip, i.e. FrozenRequirement, if we can
rely on this API).
  • Loading branch information
nelfin authored and uranusjr committed May 31, 2018
1 parent eb839e5 commit 5788db3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2564,14 +2564,13 @@ def do_clean(
# Ensure that virtualenv is available.
ensure_project(three=three, python=python, validate=False)
ensure_lockfile()
installed_packages = filter(
None,
delegator.run('{0} freeze'.format(which_pip())).out.strip().split(
'\n'
),
)

installed_package_names = []
for installed in installed_packages:
pip_freeze_command = delegator.run('{0} freeze'.format(which_pip()))
for line in pip_freeze_command.out.split('\n'):
installed = line.strip()
if not installed or installed.startswith('#'): # Comment or empty.
continue
r = Requirement.from_line(installed).requirement
# Ignore editable installations.
if not r.editable:
Expand Down

0 comments on commit 5788db3

Please sign in to comment.