[go: up one dir, main page]

File: meson.build

package info (click to toggle)
cozy 1.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,140 kB
  • sloc: python: 8,014; xml: 392; makefile: 2
file content (101 lines) | stat: -rw-r--r-- 2,850 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
project('com.github.geigi.cozy', version: '1.3.0', meson_version: '>= 0.59.0')

python = import('python')
i18n = import('i18n')
gnome = import('gnome')

message('Looking for dependencies')
python_bin = python.find_installation('python3')
if not python_bin.found()
    error('No valid python3 binary found')
else
    message('Found python3 binary')
endif

dependency('glib-2.0')
dependency('libadwaita-1', version: '>= 1.4.0')

# from https://github.com/AsavarTzeth/pulseeffects/blob/master/meson.build
# Support Debian non-standard python paths
# Fallback to Meson python module if command fails
message('Getting python install path')
py3_purelib = ''
r = run_command(
  python_bin.full_path(),
  '-c',
  'from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix=""))',
  check: false,
)

if r.returncode() != 0
  py3_purelib = python_bin.get_path('purelib')
  if not py3_purelib.endswith('site-packages')
    error('Cannot find python install path')
  endif
  python_dir = py3_purelib
else
  python_dir = r.stdout().strip()
endif

# Python 3 required modules
python3_required_modules = ['distro', 'peewee', 'mutagen', 'gi']

foreach p : python3_required_modules
  # Source: https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported
  script = 'import importlib.util; import sys; exit(1) if importlib.util.find_spec(\''+ p +'\') is None else exit(0)'
  if run_command(python_bin, '-c', script, check: false).returncode() != 0
    error('Required Python3 module \'' + p + '\' not found')
  endif
endforeach

LIBEXEC_DIR = join_paths(get_option('prefix'), 'libexec')
DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())

conf = configuration_data()
conf.set('PACKAGE_URL', 'https://github.com/geigi/cozy')
conf.set('DATA_DIR', DATA_DIR)
conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
conf.set('PYTHON_DIR', python_dir)
conf.set('PYTHON_EXEC_DIR', join_paths(get_option('prefix'), python_bin.get_path('stdlib')))
conf.set('libexecdir', LIBEXEC_DIR)
conf.set('VERSION', meson.project_version())
conf.set('PYTHON', python_bin.full_path())
conf.set('INSTALLED', 'true')

subdir('data')
subdir('po')

message('Compile gnome schemas')

message('Preparing init file')
configure_file(
  input: 'main.py',
  output: 'cozy',
  configuration: conf,
  install_dir: 'bin'
)

install_subdir(
  'cozy',
  install_dir: python_dir
)

configure_file(
  input: 'cozy/version.py',
  output: 'version.py',
  configuration: conf,
  install_dir: python_dir + '/cozy'
)

configure_file(
  input: 'cozy/report/report_to_loki.py',
  output: 'report_to_loki.py',
  configuration: conf,
  install_dir: python_dir + '/cozy/report'
)

gnome.post_install(
     glib_compile_schemas: true,
    gtk_update_icon_cache: true,
  update_desktop_database: true,
)