Implement proper symlink support in `ReadTarFS` by althonos · Pull Request #426 · PyFilesystem/pyfilesystem2
Type of changes
- Bug fix
- New feature
Checklist
- I've run the latest black with default args on new code.
- I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- I've added tests for new code.
- I accept that @willmcgugan may be pedantic in the code review.
Description
The current version of ReadTarFS does not support symlinks properly where Tar files do. This PR changes the following:
OSFS like behaviour for Info
-
Info.is_dirisTruefor symlinks that map to existing directories. -
ReadTarFS.isdir(path)returns True ifpathis a symlink that maps to an existing directory. -
ReadTarFS.isfile(path)returns True if thepathis a symlink that maps to an existing file. -
ReadTarFs.islink(path)return True if thepathis a symlink (that can also be dangling).
Transparent handling of symlinks
-
ReadTarFS.openbin(path)also works ifpathis a symlink that maps to an existing file. -
ReadTarFS.listdir(path)also works ifpathis a symlink that maps to an existing file.