summaryrefslogtreecommitdiff
blob: 2501bc7c4d128dd985874aa857b9d0a9c33083a2 (plain)
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
From 0ec042734f63a3a870920b1e71f07851d335ea45 Mon Sep 17 00:00:00 2001
From: Mart Raudsepp <leio@gentoo.org>
Date: Sun, 29 Mar 2020 16:05:36 +0300
Subject: [PATCH] build: Fix python files installation handling

The deprecated meson python3 module tends to end up installing only
to a python version that meson is installed for too, possibly
breaking some expectations downstream that want it installed to
a specific python3 version, that might not match what the build
machine uses for meson.
Fix it by using the non-deprecated python module and methods from it.

The python module exists since 0.46, which should be safe to require
by now. There were meson 0.50 features used already, but unnecessarily,
as the configure_file install parameter was added then, but all versions
default to `true` anyhow. However in practice this only emitted a
warning with newer meson versions and was able to build fine with older
versions too. However fix it too, so that we are now warning-free for
meson features after raising of the meson version dep.
---
 gtweak/meson.build |  5 ++---
 meson.build        | 12 ++++++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/gtweak/meson.build b/gtweak/meson.build
index 3d9a743..4e558b4 100644
--- a/gtweak/meson.build
+++ b/gtweak/meson.build
@@ -11,7 +11,6 @@ configure_file(
   input: 'defs.py.in',
   output: 'defs.py',
   configuration: defs_conf,
-  install: true,
   install_dir: gtweakdir
 )
 
@@ -46,5 +45,5 @@ tweak_sources = [
   'tweaks/tweak_wacom.py',
 ]
 
-install_data(shell_sources, install_dir: gtweakdir)
-install_data(tweak_sources, install_dir: gtweakdir + '/tweaks')
+python3.install_sources(shell_sources, subdir: 'gtweak')
+python3.install_sources(tweak_sources, subdir: join_paths('gtweak', 'tweaks'))
diff --git a/meson.build b/meson.build
index b7da518..df49ae3 100644
--- a/meson.build
+++ b/meson.build
@@ -1,11 +1,16 @@
 project('gnome-tweaks',
   version: '3.34.0',
-  meson_version: '>= 0.40.0'
+  meson_version: '>= 0.46.0'
 )
 
 gnome = import('gnome')
 i18n = import('i18n')
-python3 = import('python3')
+pymod = import('python')
+python3 = pymod.find_installation('python3')
+
+if not python3.found()
+    error('No valid python3 installation found')
+endif
 
 prefix = get_option('prefix')
 
@@ -13,13 +18,12 @@ bindir = join_paths(prefix, get_option('bindir'))
 datadir = join_paths(prefix, get_option('datadir'))
 libexecdir = join_paths(prefix, get_option('libexecdir'))
 localedir = join_paths(prefix, get_option('localedir'))
-pythondir = join_paths(prefix, python3.sysconfig_path('purelib'))
 
 pkgdatadir = join_paths(datadir, meson.project_name())
 
 appdatadir = join_paths(datadir, 'metainfo')
 desktopdir = join_paths(datadir, 'applications')
-gtweakdir = join_paths(pythondir, 'gtweak')
+gtweakdir = python3.get_install_dir(subdir: 'gtweak')
 icondir = join_paths(datadir, 'icons', 'hicolor')
 schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
 
-- 
2.20.1