aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/fs.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/modules/fs.py')
-rw-r--r--mesonbuild/modules/fs.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py
index f006500..f4fe06f 100644
--- a/mesonbuild/modules/fs.py
+++ b/mesonbuild/modules/fs.py
@@ -165,7 +165,7 @@ class FSModule(ExtensionModule):
@noKwargs
def parent(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
if len(args) != 1:
- raise MesonException('method takes exactly one argument.')
+ raise MesonException('fs.parent takes exactly one argument.')
original = PurePath(args[0])
new = original.parent
return ModuleReturnValue(str(new), [])
@@ -174,10 +174,19 @@ class FSModule(ExtensionModule):
@noKwargs
def name(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
if len(args) != 1:
- raise MesonException('method takes exactly one argument.')
+ raise MesonException('fs.name takes exactly one argument.')
original = PurePath(args[0])
new = original.name
return ModuleReturnValue(str(new), [])
+ @stringArgs
+ @noKwargs
+ def stem(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
+ if len(args) != 1:
+ raise MesonException('fs.stem takes exactly one argument.')
+ original = PurePath(args[0])
+ new = original.stem
+ return ModuleReturnValue(str(new), [])
+
def initialize(*args, **kwargs) -> FSModule:
return FSModule(*args, **kwargs)