mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Read record file once during legacy install (#7452)
This commit is contained in:
parent
a1b0b9274f
commit
2013753525
|
@ -823,6 +823,12 @@ class InstallRequirement(object):
|
|||
return
|
||||
self.install_succeeded = True
|
||||
|
||||
# We intentionally do not use any encoding to read the file because
|
||||
# setuptools writes the file using distutils.file_util.write_file,
|
||||
# which does not specify an encoding.
|
||||
with open(record_filename) as f:
|
||||
record_lines = f.read().splitlines()
|
||||
|
||||
def prepend_root(path):
|
||||
# type: (str) -> str
|
||||
if root is None or not os.path.isabs(path):
|
||||
|
@ -830,11 +836,7 @@ class InstallRequirement(object):
|
|||
else:
|
||||
return change_root(root, path)
|
||||
|
||||
# We intentionally do not use any encoding to read the file because
|
||||
# setuptools writes the file using distutils.file_util.write_file,
|
||||
# which does not specify an encoding.
|
||||
with open(record_filename) as f:
|
||||
for line in f:
|
||||
for line in record_lines:
|
||||
directory = os.path.dirname(line)
|
||||
if directory.endswith('.egg-info'):
|
||||
egg_info_dir = prepend_root(directory)
|
||||
|
@ -859,8 +861,7 @@ class InstallRequirement(object):
|
|||
# FIXME: put the record somewhere
|
||||
return
|
||||
new_lines = []
|
||||
with open(record_filename) as f:
|
||||
for line in f:
|
||||
for line in record_lines:
|
||||
filename = line.strip()
|
||||
if os.path.isdir(filename):
|
||||
filename += os.path.sep
|
||||
|
|
Loading…
Reference in a new issue