blob: 41e64d7d805c0ac786ed63b3c145429ae1ed794b [file] [log] [blame]
Andrew Geissler89770b02020-06-13 10:40:47 -05001From 76c23503ed1002d3aad0118795006fe2128006ae Mon Sep 17 00:00:00 2001
2From: Ting-Wei Lan <lantw@src.gnome.org>
3Date: Sat, 21 Mar 2020 22:13:57 +0800
4Subject: [PATCH] generate-version-script: Don't hard-code the path of python3
5
6Python can be installed in different directories on different operating
7systems, so we can't hard-code the path of it. Instead, use meson to
8find it to avoid 'no such file or directory' error on the bad path.
9
10Upstream-Status: Backport [https://github.com/hughsie/libgusb/pull/36]
11Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
12---
13 contrib/generate-version-script.py | 1 -
14 gusb/meson.build | 4 ++++
15 2 files changed, 4 insertions(+), 1 deletion(-)
16 mode change 100755 => 100644 contrib/generate-version-script.py
17
18diff --git a/contrib/generate-version-script.py b/contrib/generate-version-script.py
19old mode 100755
20new mode 100644
21index c4ee238ab0ab..0fe2b24e47e3
22--- a/contrib/generate-version-script.py
23+++ b/contrib/generate-version-script.py
24@@ -1,4 +1,3 @@
25-#!/usr/bin/python3
26 # pylint: disable=invalid-name,missing-docstring
27 #
28 # Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
29diff --git a/gusb/meson.build b/gusb/meson.build
30index 10a6f537a642..28ca3c63e595 100644
31--- a/gusb/meson.build
32+++ b/gusb/meson.build
33@@ -142,6 +142,9 @@ libgusb_girtarget = gnome.generate_gir(gusb,
34 libgusb_gir = libgusb_girtarget[0]
35 libgusb_typelib = libgusb_girtarget[1]
36
37+pymod = import('python')
38+py_installation = pymod.find_installation('python3')
39+
40 # Verify the map file is correct -- note we can't actually use the generated
41 # file for two reasons:
42 #
43@@ -154,6 +157,7 @@ mapfile_target = custom_target('gusb_mapfile',
44 input: libgusb_girtarget[0],
45 output: 'libgusb.ver',
46 command: [
47+ py_installation,
48 join_paths(meson.source_root(), 'contrib', 'generate-version-script.py'),
49 'LIBGUSB',
50 '@INPUT@',
51--
522.17.1
53