2016-12-13 16:12:03 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
import subprocess
|
2026-02-18 13:04:26 -07:00
|
|
|
import shutil
|
2016-12-13 16:12:03 -05:00
|
|
|
|
|
|
|
|
prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
|
|
|
|
|
datadir = os.path.join(prefix, 'share')
|
|
|
|
|
|
|
|
|
|
# Packaging tools define DESTDIR and this isn't needed for them
|
|
|
|
|
if 'DESTDIR' not in os.environ:
|
2026-02-18 13:04:26 -07:00
|
|
|
def run_if_available(command, *args):
|
|
|
|
|
if shutil.which(command) is None:
|
|
|
|
|
print(f'Skipping {command}: command not found')
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
subprocess.call([command, *args])
|
|
|
|
|
|
2016-12-13 16:12:03 -05:00
|
|
|
print('Updating icon cache...')
|
2026-02-18 13:04:26 -07:00
|
|
|
run_if_available('gtk-update-icon-cache', '-qtf',
|
|
|
|
|
os.path.join(datadir, 'icons', 'hicolor'))
|
2016-12-13 16:12:03 -05:00
|
|
|
|
|
|
|
|
print('Updating desktop database...')
|
2026-02-18 13:04:26 -07:00
|
|
|
run_if_available('update-desktop-database', '-q',
|
|
|
|
|
os.path.join(datadir, 'applications'))
|