2017-10-02 14:01:18 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
if not os.environ.get('DESTDIR'):
|
2020-07-12 12:35:56 +00:00
|
|
|
gitg_name = sys.argv[1]
|
|
|
|
datadir = sys.argv[2]
|
|
|
|
icondir = os.path.join(datadir, 'icons', 'hicolor')
|
2017-10-02 14:01:18 +00:00
|
|
|
|
|
|
|
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])
|
|
|
|
|
2020-07-12 12:35:56 +00:00
|
|
|
icondir = os.path.join(datadir, gitg_name, 'icons', 'hicolor')
|
2017-10-02 14:01:18 +00:00
|
|
|
subprocess.call(['gtk-update-icon-cache', '-f', '-t', '-q', icondir])
|
|
|
|
|
2020-07-12 12:35:56 +00:00
|
|
|
schemadir = os.path.join(datadir, 'glib-2.0', 'schemas')
|
2017-10-02 14:01:18 +00:00
|
|
|
print('Compiling gsettings schemas...')
|
|
|
|
subprocess.call(['glib-compile-schemas', schemadir])
|
|
|
|
|
2017-11-15 10:00:01 +00:00
|
|
|
if sys.argv[2] == 'python':
|
2017-10-02 14:01:18 +00:00
|
|
|
print('Byte-compiling python modules...')
|
2019-06-28 17:42:58 +00:00
|
|
|
subprocess.call(['python3', '-m', 'compileall', '-f', '-q', sys.argv[3]])
|
2017-10-02 14:01:18 +00:00
|
|
|
|
|
|
|
print('Byte-compiling python modules (optimized versions) ...')
|
2019-06-28 17:42:58 +00:00
|
|
|
subprocess.call(['python3', '-O', '-m', 'compileall', '-f', '-q', sys.argv[3]])
|