74) -> str:
75 """Convert a legacy installed-files.txt path into modern RECORD path.
76
77 The legacy format stores paths relative to the info directory, while the
78 modern format stores paths relative to the package root, e.g. the
79 site-packages directory.
80
81 :param entry: Path parts of the installed-files.txt entry.
82 :param info: Path parts of the egg-info directory relative to package root.
83 :returns: The converted entry.
84
85 For best compatibility with symlinks, this does not use ``abspath()`` or
86 ``Path.resolve()``, but tries to work with path parts:
87
88 1. While ``entry`` starts with ``..``, remove the equal amounts of parts
89 from ``info``; if ``info`` is empty, start appending ``..`` instead.
90 2. Join the two directly.
91 """
92 while entry and entry[0] == "..":
93 if not info or info[-1] == "..":
94 info += ("..",)
95 else:
96 info = info[:-1]
97 entry = entry[1:]
99
100