File: meson_post_install.py

package info (click to toggle)
gnome-documents 3.31.92-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,208 kB
  • sloc: ansic: 11,329; makefile: 201; xml: 147; python: 29
file content (43 lines) | stat: -rw-r--r-- 1,224 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3

import glob
import os
import re
import subprocess
import sys

datadir = sys.argv[1]

destdir = os.environ.get('DESTDIR', '')
bindir = os.path.normpath(destdir + os.sep + sys.argv[2])

# FIXME: meson will not track the creation of these files
#        https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
apps = [
  ['org.gnome.Documents', 'gnome-documents']
]

if not os.path.exists(bindir):
  os.makedirs(bindir)

for app in apps:
  src = os.path.join(datadir, 'gnome-documents', app[0])
  dest = os.path.join(bindir, app[1])
  subprocess.call(['ln', '-s', '-f', src, dest])

if not os.environ.get('DESTDIR'):
  icondir = os.path.join(datadir, 'icons', 'hicolor')

  print('Update icon cache...')
  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])

  schemadir = os.path.join(datadir, 'glib-2.0', 'schemas')
  print('Compiling gsettings schemas...')
  subprocess.call(['glib-compile-schemas', schemadir])

  search_pattern = '/*.desktop'

  desktopdir = os.path.join(datadir, 'applications')
  print('Validate desktop files...')
  [subprocess.call(['desktop-file-validate', file])
   for file in glob.glob(desktopdir + search_pattern, recursive=False)]