aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/fs.py
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-12-20 06:10:25 -0500
committerMichael Hirsch, Ph.D <10931741+scivision@users.noreply.github.com>2020-02-06 12:54:38 -0500
commit5bbeab8ed461bc2464d9b590b2faf758aa854362 (patch)
treea04df538dbca87a223dc0d0aee95aaa20bfa0163 /mesonbuild/modules/fs.py
parent92534855cc11e0939f769e19d995be0605be2fb2 (diff)
downloadmeson-5bbeab8ed461bc2464d9b590b2faf758aa854362.zip
meson-5bbeab8ed461bc2464d9b590b2faf758aa854362.tar.gz
meson-5bbeab8ed461bc2464d9b590b2faf758aa854362.tar.bz2
add fs.stem()
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)