From 50af09de031c8d003cd9e6afb44b774620b45696 Mon Sep 17 00:00:00 2001 From: Jason Woodward Date: Sun, 21 Feb 2021 23:46:20 -0500 Subject: install_man locale support Rather than having to manually build the locale aware man paths with `install_data('foo.fr.1', install_dir: join_paths(get_option('mandir'), 'fr', 'man1'), rename: 'foo.1')` Support doing `install_man('foo.fr.1', locale: 'fr')` --- mesonbuild/interpreter.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mesonbuild/interpreter.py') diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 0225de4..5642242 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -778,6 +778,9 @@ class ManHolder(InterpreterObject, ObjectHolder[build.Man]): def get_custom_install_mode(self) -> T.Optional[FileMode]: return self.held_object.custom_install_mode + def locale(self) -> T.Optional[str]: + return self.held_object.locale + def get_sources(self) -> T.List[mesonlib.File]: return self.held_object.sources @@ -2371,7 +2374,7 @@ permitted_kwargs = {'add_global_arguments': {'language', 'native'}, 'include_directories': {'is_system'}, 'install_data': {'install_dir', 'install_mode', 'rename', 'sources'}, 'install_headers': {'install_dir', 'install_mode', 'subdir'}, - 'install_man': {'install_dir', 'install_mode'}, + 'install_man': {'install_dir', 'install_mode', 'locale'}, 'install_subdir': {'exclude_files', 'exclude_directories', 'install_dir', 'install_mode', 'strip_directory'}, 'jar': build.known_jar_kwargs, 'project': {'version', 'meson_version', 'default_options', 'license', 'subproject_dir'}, @@ -4225,6 +4228,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self return HeadersHolder(h) @FeatureNewKwargs('install_man', '0.47.0', ['install_mode']) + @FeatureNewKwargs('install_man', '0.58.0', ['locale']) @permittedKwargs(permitted_kwargs['install_man']) def func_install_man(self, node, args, kwargs): sources = self.source_strings_to_files(args) @@ -4237,10 +4241,11 @@ This will become a hard error in the future.''' % kwargs['input'], location=self raise InvalidArguments('Man file must have a file extension of a number between 1 and 8') custom_install_mode = self._get_kwarg_install_mode(kwargs) custom_install_dir = kwargs.get('install_dir', None) + locale = kwargs.get('locale') if custom_install_dir is not None and not isinstance(custom_install_dir, str): raise InterpreterException('install_dir must be a string.') - m = build.Man(sources, custom_install_dir, custom_install_mode, self.subproject) + m = build.Man(sources, custom_install_dir, custom_install_mode, self.subproject, locale) self.build.man.append(m) return ManHolder(m) -- cgit v1.1