diff --git a/src/pip/_internal/operations/install/wheel.py b/src/pip/_internal/operations/install/wheel.py index 0adeb3229b0..99edfa08187 100644 --- a/src/pip/_internal/operations/install/wheel.py +++ b/src/pip/_internal/operations/install/wheel.py @@ -644,10 +644,8 @@ def _generate_file(path, **kwargs): pass generated.append(requested_path) - # 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: - record_rows = list(csv.reader(record_file)) + record_text = distribution.get_metadata('RECORD') + record_rows = list(csv.reader(record_text.splitlines())) rows = get_csv_rows_for_installed( record_rows, @@ -656,6 +654,9 @@ def _generate_file(path, **kwargs): generated=generated, lib_dir=lib_dir) + # Record details of all files installed + record_path = os.path.join(dest_info_dir, 'RECORD') + 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