Commit 83ae105c authored by Patrick Griffis's avatar Patrick Griffis

build: Rewrite post-install script in python

There is no reason to depend upon shell.

https://bugzilla.gnome.org/show_bug.cgi?id=783531
parent f7ab9420
#!/usr/bin/env python3
import sysconfig
from compileall import compile_dir
from os import environ, path
from subprocess import call
prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = path.join(prefix, 'share')
destdir = environ.get('DESTDIR', '')
# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
print('Compiling python bytecode...')
moduledir = sysconfig.get_path('purelib', vars={'base': str(prefix)})
compile_dir(destdir + path.join(moduledir, 'gtweak'), optimize=2)
#!/bin/sh
# Package managers set this so we don't need to run
if [ -z "$DESTDIR" ]; then
echo Updating desktop database...
update-desktop-database -q ${MESON_INSTALL_PREFIX}/share/applications
echo Updating icon cache...
gtk-update-icon-cache -q -t -f ${MESON_INSTALL_PREFIX}/share/icons/hicolor
fi
......@@ -30,4 +30,4 @@ subdir('gtweak')
subdir('data')
subdir('po')
meson.add_install_script('meson-postinstall.sh')
meson.add_install_script('meson-postinstall.py')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment