diff options
author | Michael Catanzaro <mcatanzaro@igalia.com> | 2017-05-02 12:54:00 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@igalia.com> | 2017-05-02 12:54:00 -0500 |
commit | c53ee063460520091adfc4688cd768146ab351ba (patch) | |
tree | b652f9411fbc4f2059bc6f7fdaa3a6fc166739db /post_install.py | |
parent | d5b3f2a2a5ac0bb9966bf2f94044f12499d31f14 (diff) | |
download | epiphany-c53ee063460520091adfc4688cd768146ab351ba.tar.gz |
Update to csoriano's latest version of post_install.py
Diffstat (limited to 'post_install.py')
-rw-r--r-- | post_install.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/post_install.py b/post_install.py index c1faf093b..81afb18b7 100644 --- a/post_install.py +++ b/post_install.py @@ -1,19 +1,27 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 import os -import pathlib import subprocess -prefix = pathlib.Path(os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')) -datadir = prefix / 'share' -destdir = os.environ.get('DESTDIR', '') - -if not destdir: - print('Compiling gsettings schemas...') - subprocess.call(['glib-compile-schemas', str(datadir / 'glib-2.0' / 'schemas')]) +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: print('Updating icon cache...') - subprocess.call(['gtk-update-icon-cache', '-qtf', str(datadir / 'icons' / 'hicolor')]) + 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...') - subprocess.call(['update-desktop-database', '-q', str(datadir / 'applications')]) + 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]) + + print('Compiling GSettings schemas...') + schemas_dir = os.path.join(datadir, 'glib-2.0', 'schemas') + if not os.path.exists(schemas_dir): + os.makedirs(schemas_dir) + subprocess.call(['glib-compile-schemas', schemas_dir]) |