gitg/meson_post_install.py
Iñigo Martínez d56af4d802 build: Follow the new meson porting guidelines
Following the new meson porting guidelines, this patch renames the
build options. The list of changes is as follows:

- Remove the enable prefix from boolean options.
- The character separator from multi-word options has been changed
  to underscore.

The warning compiler options are also removed because meson's
compiler related options should be used.

https://bugzilla.gnome.org/show_bug.cgi?id=788796
2017-11-15 11:19:53 +01:00

34 lines
1.1 KiB
Python

#!/usr/bin/env python3
import glob
import os
import re
import subprocess
import sys
if not os.environ.get('DESTDIR'):
icondir = os.path.join(sys.argv[1], 'icons', 'hicolor')
name_pattern = re.compile('hicolor_(?:apps)_(?:\d+x\d+|scalable)_(.*)')
search_pattern = '/**/hicolor_*'
[os.rename(file, os.path.join(os.path.dirname(file), name_pattern.search(file).group(1)))
for file in glob.glob(icondir + search_pattern, recursive=True)]
print('Update icon cache...')
subprocess.call(['gtk-update-icon-cache', '-f', '-t', '-q', icondir])
icondir = os.path.join(sys.argv[1], 'gitg', 'icons', 'hicolor')
subprocess.call(['gtk-update-icon-cache', '-f', '-t', '-q', icondir])
schemadir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
print('Compiling gsettings schemas...')
subprocess.call(['glib-compile-schemas', schemadir])
if sys.argv[2] == 'python':
print('Byte-compiling python modules...')
subprocess.call(['python', '-m', 'compileall', '-f', '-q', sys.argv[3]])
print('Byte-compiling python modules (optimized versions) ...')
subprocess.call(['python', '-O', '-m', 'compileall', '-f', '-q', sys.argv[3]])