diff options
author | Wu Xiaotian <[email protected]> | 2019-05-11 00:42:21 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-05-21 09:16:57 +0200 |
commit | d98d60a74976e544c2a844f41dd00db9d9ac999a (patch) | |
tree | 8de0408116be4acb09c0769132c25c4c2c71aac2 /post_install.py | |
parent | 2beed2049f2822066eb2c571aa289f7a2a9f2dc5 (diff) | |
download | mozo-d98d60a74976e544c2a844f41dd00db9d9ac999a.tar.bz2 mozo-d98d60a74976e544c2a844f41dd00db9d9ac999a.tar.xz |
use meson to build
Diffstat (limited to 'post_install.py')
-rw-r--r-- | post_install.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/post_install.py b/post_install.py new file mode 100644 index 0000000..c9f4d9e --- /dev/null +++ b/post_install.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import os +import glob +import subprocess +import sysconfig +from compileall import compile_dir + +prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local') +datadir = os.path.join(prefix, 'share') +destdir = os.environ.get('DESTDIR', '') + +if __name__=="__main__": + print('Compiling python bytecode...') + puredir = sysconfig.get_path('purelib', vars={'base': str(prefix)}) + module_dir = os.path.join(destdir + os.path.join(puredir, 'Mozo')) + compile_dir(module_dir, optimize=2) + + if destdir == '': + print('Updating icon cache...') + icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor') + if not os.path.exists(icon_cache_dir): + os.makedirs(icon_cache_dir) + subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir]) + + print('Updating desktop database...') + desktop_database_dir = os.path.join(datadir, 'applications') + if not os.path.exists(desktop_database_dir): + os.makedirs(desktop_database_dir) + subprocess.call(['update-desktop-database', '-q', desktop_database_dir]) |