pyfilesystem2
pyfilesystem2 copied to clipboard
Implement proper symlink support in `ReadTarFS`
Type of changes
- Bug fix
- New feature
Checklist
- [x] I've run the latest black with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] 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
- [x]
Info.is_dirisTruefor symlinks that map to existing directories. - [x]
ReadTarFS.isdir(path)returns True ifpathis a symlink that maps to an existing directory. - [x]
ReadTarFS.isfile(path)returns True if thepathis a symlink that maps to an existing file. - [x]
ReadTarFs.islink(path)return True if thepathis a symlink (that can also be dangling).
Transparent handling of symlinks
- [x]
ReadTarFS.openbin(path)also works ifpathis a symlink that maps to an existing file. - [x]
ReadTarFS.listdir(path)also works ifpathis a symlink that maps to an existing file.
Closes #409 and partially addresses #425.
Moving this to milestone v2.5.0 because this is a fundamental change.