Skip to content

Commit

Permalink
Reimplement relative_to using posixpath primitives.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Nov 25, 2022
1 parent e7f4ace commit 25739bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions zipp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,8 @@ def glob(self, pattern):
def rglob(self, pattern):
return self.glob(f'**/{pattern}')

def relative_to(self, *other, **kwargs):
other = (pathlib.PurePosixPath(each.at) for each in other)
return pathlib.PurePosixPath(self.at).relative_to(*other, **kwargs)
def relative_to(self, other, *extra):
return posixpath.relpath(str(self), str(other.joinpath(*extra)))

def __str__(self):
return posixpath.join(self.root.filename, self.at)
Expand Down

0 comments on commit 25739bc

Please sign in to comment.