Skip to content

Commit 3b3978b

Browse files
committed
Merge pull request #3284 from ncoghlan/pep376-installer-file
Record pip in INSTALLER file
2 parents 6f5e46f + a925c88 commit 3b3978b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

pip/wheel.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,15 @@ def _get_script_text(entry):
497497
)
498498
)
499499

500+
# Record pip as the installer
501+
installer = os.path.join(info_dir[0], 'INSTALLER')
502+
temp_installer = os.path.join(info_dir[0], 'INSTALLER.pip')
503+
with open(temp_installer, 'wb') as installer_file:
504+
installer_file.write(b'pip\n')
505+
shutil.move(temp_installer, installer)
506+
generated.append(installer)
507+
508+
# Record details of all files installed
500509
record = os.path.join(info_dir[0], 'RECORD')
501510
temp_record = os.path.join(info_dir[0], 'RECORD.pip')
502511
with open_for_csv(record, 'r') as record_in:

tests/functional/test_install_wheel.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ def test_install_from_wheel_file(script, data):
8383
assert dist_info_folder in result.files_created, (dist_info_folder,
8484
result.files_created,
8585
result.stdout)
86+
installer = dist_info_folder / 'INSTALLER'
87+
assert installer in result.files_created, (dist_info_folder,
88+
result.files_created,
89+
result.stdout)
90+
with open(script.base_path / installer, 'rb') as installer_file:
91+
installer_details = installer_file.read()
92+
assert installer_details == b'pip\n'
93+
installer_temp = dist_info_folder / 'INSTALLER.pip'
94+
assert installer_temp not in result.files_created, (dist_info_folder,
95+
result.files_created,
96+
result.stdout)
8697

8798

8899
# header installs are broke in pypy virtualenvs

0 commit comments

Comments
 (0)