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
|
return
|
||||||
self.install_succeeded = True
|
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):
|
def prepend_root(path):
|
||||||
# type: (str) -> str
|
# type: (str) -> str
|
||||||
if root is None or not os.path.isabs(path):
|
if root is None or not os.path.isabs(path):
|
||||||
|
@ -830,11 +836,7 @@ class InstallRequirement(object):
|
||||||
else:
|
else:
|
||||||
return change_root(root, path)
|
return change_root(root, path)
|
||||||
|
|
||||||
# We intentionally do not use any encoding to read the file because
|
for line in record_lines:
|
||||||
# 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:
|
|
||||||
directory = os.path.dirname(line)
|
directory = os.path.dirname(line)
|
||||||
if directory.endswith('.egg-info'):
|
if directory.endswith('.egg-info'):
|
||||||
egg_info_dir = prepend_root(directory)
|
egg_info_dir = prepend_root(directory)
|
||||||
|
@ -859,8 +861,7 @@ class InstallRequirement(object):
|
||||||
# FIXME: put the record somewhere
|
# FIXME: put the record somewhere
|
||||||
return
|
return
|
||||||
new_lines = []
|
new_lines = []
|
||||||
with open(record_filename) as f:
|
for line in record_lines:
|
||||||
for line in f:
|
|
||||||
filename = line.strip()
|
filename = line.strip()
|
||||||
if os.path.isdir(filename):
|
if os.path.isdir(filename):
|
||||||
filename += os.path.sep
|
filename += os.path.sep
|
||||||
|
|
Loading…
Reference in a new issue