1#!/usr/local/bin/python3.8
2
3import sysconfig
4from compileall import compile_dir
5from os import environ, path
6from subprocess import call
7
8prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
9datadir = path.join(prefix, 'share')
10destdir = environ.get('DESTDIR', '')
11
12# Package managers set this so we don't need to run
13if not destdir:
14    print("Installing new Schemas")
15    call(['glib-compile-schemas', path.join(datadir, 'glib-2.0/schemas')])
16    print('Updating icon cache...')
17    call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
18
19print('Compiling python bytecode...')
20moduledir = sysconfig.get_path('purelib', vars={'base': str(prefix)})
21compile_dir(destdir + path.join(moduledir, 'gtweak'), optimize=2)
22