MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _find_link_target

Method _find_link_target

tools/python-3.11.9-amd64/Lib/tarfile.py:2707–2724  ·  view source on GitHub ↗

Find the target member of a symlink or hardlink member in the archive.

(self, tarinfo)

Source from the content-addressed store, hash-verified

2705 raise OSError("bad operation for mode %r" % self.mode)
2706
2707 def _find_link_target(self, tarinfo):
2708 """Find the target member of a symlink or hardlink member in the
2709 archive.
2710 """
2711 if tarinfo.issym():
2712 # Always search the entire archive.
2713 linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
2714 limit = None
2715 else:
2716 # Search the archive before the link, because a hard link is
2717 # just a reference to an already archived file.
2718 linkname = tarinfo.linkname
2719 limit = tarinfo
2720
2721 member = self._getmember(linkname, tarinfo=limit, normalize=True)
2722 if member is None:
2723 raise KeyError("linkname %r not found" % linkname)
2724 return member
2725
2726 def __iter__(self):
2727 """Provide an iterator object.

Callers 2

extractfileMethod · 0.95
makelinkMethod · 0.95

Calls 4

_getmemberMethod · 0.95
issymMethod · 0.80
filterFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected