diff options
author | David Ward <david.ward@gatech.edu> | 2022-09-04 08:15:57 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-09-12 00:27:21 -0400 |
commit | 68add86f7b9b50e51e75447077f460bc2dc78e79 (patch) | |
tree | 9424e382be0ea3b173fabe55311a8c546158b2d0 /mesonbuild | |
parent | 7eb5709bd9105c3ab9eec935b4b2b14d2ca7940b (diff) | |
download | meson-68add86f7b9b50e51e75447077f460bc2dc78e79.zip meson-68add86f7b9b50e51e75447077f460bc2dc78e79.tar.gz meson-68add86f7b9b50e51e75447077f460bc2dc78e79.tar.bz2 |
i18n: Fix source root in Gettext targets for subprojects
Gettext should search for input files relative to the (sub)project
source root, not the global source root.
This change exposes a root_subdir member in ModuleState.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/modules/__init__.py | 1 | ||||
-rw-r--r-- | mesonbuild/modules/i18n.py | 15 |
2 files changed, 10 insertions, 6 deletions
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py index de1cd56..a83e9da 100644 --- a/mesonbuild/modules/__init__.py +++ b/mesonbuild/modules/__init__.py @@ -49,6 +49,7 @@ class ModuleState: interpreter.environment.get_build_dir()) self.subproject = interpreter.subproject self.subdir = interpreter.subdir + self.root_subdir = interpreter.root_subdir self.current_lineno = interpreter.current_lineno self.environment = interpreter.environment self.project_name = interpreter.build.project_name diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 2af1198..2a7a9ad 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -256,10 +256,13 @@ class I18nModule(ExtensionModule): extra_arg = '--extra-args=' + '@@'.join(extra_args) if extra_args else None + source_root = path.join(state.source_root, state.root_subdir) + subdir = path.relpath(state.subdir, start=state.root_subdir) if state.subdir else None + potargs = state.environment.get_build_command() + ['--internal', 'gettext', 'pot', pkg_arg] - potargs.append(f'--source-root={state.source_root}') - if state.subdir: - potargs.append(f'--subdir={state.subdir}') + potargs.append(f'--source-root={source_root}') + if subdir: + potargs.append(f'--subdir={subdir}') if datadirs: potargs.append(datadirs) if extra_arg: @@ -302,9 +305,9 @@ class I18nModule(ExtensionModule): targets.append(allgmotarget) updatepoargs = state.environment.get_build_command() + ['--internal', 'gettext', 'update_po', pkg_arg] - updatepoargs.append(f'--source-root={state.source_root}') - if state.subdir: - updatepoargs.append(f'--subdir={state.subdir}') + updatepoargs.append(f'--source-root={source_root}') + if subdir: + updatepoargs.append(f'--subdir={subdir}') if lang_arg: updatepoargs.append(lang_arg) if datadirs: |