Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expect a plain list in get_csv_rows_for_installed #8533

Merged
merged 1 commit into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/pip/_internal/operations/install/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def _parse_record_path(record_column):


def get_csv_rows_for_installed(
old_csv_rows, # type: Iterable[List[str]]
old_csv_rows, # type: List[List[str]]
installed, # type: Dict[RecordPath, RecordPath]
changed, # type: Set[RecordPath]
generated, # type: List[str]
Expand Down Expand Up @@ -642,12 +642,15 @@ def _generate_file(path, **kwargs):
# Record details of all files installed
record_path = os.path.join(dest_info_dir, 'RECORD')
with open(record_path, **csv_io_kwargs('r')) as record_file:
rows = get_csv_rows_for_installed(
csv.reader(record_file),
installed=installed,
changed=changed,
generated=generated,
lib_dir=lib_dir)
record_rows = list(csv.reader(record_file))

rows = get_csv_rows_for_installed(
record_rows,
installed=installed,
changed=changed,
generated=generated,
lib_dir=lib_dir)

with _generate_file(record_path, **csv_io_kwargs('w')) as record_file:
# The type mypy infers for record_file is different for Python 3
# (typing.IO[Any]) and Python 2 (typing.BinaryIO). We explicitly
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ def call_get_csv_rows_for_installed(tmpdir, text):
lib_dir = '/lib/dir'

with open(path, **wheel.csv_io_kwargs('r')) as f:
reader = csv.reader(f)
outrows = wheel.get_csv_rows_for_installed(
reader, installed=installed, changed=changed,
generated=generated, lib_dir=lib_dir,
)
record_rows = list(csv.reader(f))
outrows = wheel.get_csv_rows_for_installed(
record_rows, installed=installed, changed=changed,
generated=generated, lib_dir=lib_dir,
)
return outrows


Expand Down