Repository navigation
v0.9.10
Added
Path._same_filesystem(other), an override hook answering whether two
paths of one type resolve their segments in the same place. Path equality
ignores that, andcopy(),move()andPathSyncernow ask it before
calling two paths the same file, nested, or overlapping. A path type whose
instances can front different hosts or stores should override it; the
default keeps the previous behaviour.pathlib_next.testing.PathContract
gains two tests: a file copied onto a separately built spelling of itself
is refused with its content intact, and paths under one root share a
filesystem.
Changed
- The built-in
Base*Backendclasses (s3,gs,az,ftp,sftp,
github/gitlab) are weakly referenceable, which is how aUriPath
tells a backend it derived for itself from one it was given. A custom
backend class using__slots__without"__weakref__"still works; it is
simply always read as supplied.
Fixed
- A path type that fronts several hosts can transfer between them again.
Since 0.9.4,copy()/move()raisedOSError(EINVAL)"Source and target
are the same file" andPathSyncerraised "source and target overlap" for
/app.confon one host onto/app.confon another, whenever the type kept
its connection under any attribute other than the private_backendthe
guards looked for. Such a type now overrides_same_filesystem(). - Two separately built URIs to the same URL are recognised as the same
file. Each derived its own backend on first use, which the guards read as
two hosts:UriPath(url).copy(UriPath(url), overwrite=True)was not
refused on any scheme withoutst_dev/st_ino(S3 and WebDAV among
them), and neither was a sync of a URL onto itself. Only two backends the
caller supplied now tell equal URIs apart. One consequence: a path given a
backend and a bare path to the same URL are now the same file for
copy()/move(), as they already were forPathSyncer. copy(recursive=True)'s "into itself" check now honours two supplied
backends, like the other two guards; it refused a copy between two hosts
whose URIs nested.
Full Changelog: v0.9.9...v0.9.10