jaraco / zipp

MIT License
61 stars 53 forks source link

Teach zipp.Path some additional pathlib.Path methods. #85

Closed Julian closed 1 year ago

Julian commented 2 years ago

Covers:

* Path.match
* Path.glob
* Path.rglob
* Path.relative_to
* Path.is_symlink (with trivial implementation given the lack of
  symlink support currently)

along with an implementation of Path.eq for testing/comparison purposes.

Part of the implementation here makes use of CPython internals (from the pathlib module) but it seems to handle fixing that requires some refactoring upstream.

jaraco commented 1 year ago

Tests are failing on Windows, I suspect because relative_to is failing to match the descendants.

jaraco commented 1 year ago

Tests are failing on Windows, I suspect because relative_to is failing to match the descendants.

The issue is that str() of a Path forces separators to os.sep.

(Pdb) cand.relative_to(self)
WindowsPath('b/c.txt')
(Pdb) str(cand.relative_to(self))
'b\\c.txt'