diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-11-08 03:14:08 -0500 |
---|---|---|
committer | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-11-17 00:17:01 -0500 |
commit | 9fc76b032348a71353555ab8d02f35415c0521bc (patch) | |
tree | 1e5a54cd6aadd7c5577edd2a750e2302392eb30c /mesonbuild/modules/fs.py | |
parent | 3bbd06557686424d04859973fde21f69a85b47e6 (diff) | |
download | meson-9fc76b032348a71353555ab8d02f35415c0521bc.zip meson-9fc76b032348a71353555ab8d02f35415c0521bc.tar.gz meson-9fc76b032348a71353555ab8d02f35415c0521bc.tar.bz2 |
fs: deduplicate functions
Diffstat (limited to 'mesonbuild/modules/fs.py')
-rw-r--r-- | mesonbuild/modules/fs.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py index f4b8080..254749d 100644 --- a/mesonbuild/modules/fs.py +++ b/mesonbuild/modules/fs.py @@ -29,14 +29,6 @@ class FSModule(ExtensionModule): super().__init__(interpreter) self.snippets.add('generate_dub_file') - @stringArgs - @noKwargs - def exists(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: - if len(args) != 1: - MesonException('method takes exactly one argument.') - test_file = Path(state.source_root) / state.subdir / args[0] - return ModuleReturnValue(test_file.exists(), []) - def _check(self, check: str, state: 'ModuleState', args: typing.Sequence[str]) -> ModuleReturnValue: if len(args) != 1: MesonException('method takes exactly one argument.') @@ -45,6 +37,11 @@ class FSModule(ExtensionModule): @stringArgs @noKwargs + def exists(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + return self._check('exists', state, args) + + @stringArgs + @noKwargs def is_symlink(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: return self._check('is_symlink', state, args) |