mesonlib: add rsplit and and maxsplit
Since string has a maxsplit as well, we should implement that for
polymorphism
@@ -422,8 +422,11 @@ class File(HoldableObject):
def endswith(self, ending: str) -> bool:
return self.fname.endswith(ending)
- def split(self, s: str) -> T.List[str]:
- return self.fname.split(s)
+ def split(self, s: str, maxsplit: int = -1) -> T.List[str]:
+ return self.fname.split(s, maxsplit=maxsplit)
+
+ def rsplit(self, s: str, maxsplit: int = -1) -> T.List[str]:
+ return self.fname.rsplit(s, maxsplit=maxsplit)
def __eq__(self, other: object) -> bool:
if not isinstance(other, File):
