Fix handling generated .desktop files. Closes #4304.

pull/4203/head
Jussi Pakkanen 6 years ago
parent 1c6b8b72cb
commit 2ff69b20df
  1. 22
      mesonbuild/modules/i18n.py
  2. 9
      test cases/frameworks/6 gettext/generated/desktopgenerator.py
  3. 14
      test cases/frameworks/6 gettext/generated/meson.build
  4. 15
      test cases/frameworks/6 gettext/generated/something.desktop.in.in
  5. 1
      test cases/frameworks/6 gettext/meson.build

@ -82,17 +82,19 @@ class I18nModule(ExtensionModule):
kwargs['command'] = command
inputfile = kwargs['input']
if isinstance(inputfile, str):
inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
if hasattr(inputfile, 'held_object'):
ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, state.subproject, kwargs)
else:
if isinstance(inputfile, str):
inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
state.subdir, inputfile)
output = kwargs['output']
ifile_abs = inputfile.absolute_path(state.environment.source_dir,
state.environment.build_dir)
values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
outputs = mesonlib.substitute_values([output], values)
output = outputs[0]
ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
output = kwargs['output']
ifile_abs = inputfile.absolute_path(state.environment.source_dir,
state.environment.build_dir)
values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
outputs = mesonlib.substitute_values([output], values)
output = outputs[0]
ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
return ModuleReturnValue(ct, [ct])
@FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset'])

@ -0,0 +1,9 @@
#!/usr/bin/env python3
import sys, shutil
ifile = sys.argv[1]
ofile = sys.argv[2]
os.unlink(ofile)
shutil.copy(ifile, ofile)

@ -0,0 +1,14 @@
dgen = find_program('desktopgenerator.py')
desktop_in_file = custom_target('something.desktop.in',
input : ['something.desktop.in.in'],
output : 'something.desktop.in',
command : [dgen, '@INPUT@', '@OUTPUT@'],
)
i18n.merge_file(
input : desktop_in_file,
output : 'something.desktop',
type : 'desktop',
po_dir : '../po',
)

@ -0,0 +1,15 @@
[Desktop Entry]
Name=Something doer
Comment=Do something
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=zip;tar;extract;unpack;
TryExec=file-roller
Exec=file-roller %U
StartupNotify=true
Terminal=false
Type=Application
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=something
Categories=GTK;GNOME;Utility
X-GNOME-DocPath=file-roller/file-roller.xml
X-GNOME-UsesNotifications=true

@ -15,3 +15,4 @@ subdir('po')
subdir('src')
subdir('data')
subdir('data2')
subdir('generated')

Loading…
Cancel
Save