kumquat-buildroot/package/gstreamer1/gstd/0005-Use-native-meson-python-module-for-python-install.patch
James Hilliard 02ea01ea22 package/gstreamer1/gstd: new package
We need to backport a few upstream still-pending PRs, to fix
cross-compilation, out-of-tree installation, and to relax requirements
on some tools.

The python support PR is backported too, but because python support was
not tested, it is forcibly disabled.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[yann.morin.1998@free.fr:
  - expand commit log with explanations
  - backport upstream 253 (python) too
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-09-19 09:54:09 +02:00

79 lines
3.2 KiB
Diff

From 1067f6138e947d18fd835e4a39f229ae2293f864 Mon Sep 17 00:00:00 2001
From: James Hilliard <james.hilliard1@gmail.com>
Date: Tue, 14 Sep 2021 23:37:03 -0600
Subject: [PATCH] Use native meson python module for python install.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[upstreeam: https://github.com/RidgeRun/gstd-1.x/pull/253]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
libgstc/meson.build | 4 +++-
libgstc/python/meson.build | 26 +++++++++++++++++++++++++-
meson_options.txt | 2 ++
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/libgstc/meson.build b/libgstc/meson.build
index e94dcd1..582cbb8 100644
--- a/libgstc/meson.build
+++ b/libgstc/meson.build
@@ -1,2 +1,4 @@
subdir('c')
-subdir('python')
+if not get_option('enable-python').disabled()
+ subdir('python')
+endif
diff --git a/libgstc/python/meson.build b/libgstc/python/meson.build
index 057114b..24e3242 100644
--- a/libgstc/python/meson.build
+++ b/libgstc/python/meson.build
@@ -1 +1,25 @@
-run_command('pip3', 'install', '.')
+pymod = import('python')
+python = pymod.find_installation(
+ get_option('with-python-version'),
+ required : get_option('enable-python').enabled(),
+ disabler : true
+)
+
+pythonver = python.language_version()
+if pythonver.version_compare('<3.7')
+ error('Python @0@ is not supported anymore, please port your code to python3.7 or newer.'.format(python.language_version()))
+endif
+
+pygstc_src_files = [
+ 'pygstc/__init__.py',
+ 'pygstc/gstc.py',
+ 'pygstc/gstcerror.py',
+ 'pygstc/logger.py',
+ 'pygstc/tcp.py'
+]
+
+python.install_sources(
+ pygstc_src_files,
+ subdir : 'pygstc',
+ pure : true
+)
diff --git a/meson_options.txt b/meson_options.txt
index f50e540..25292e6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,6 +4,7 @@ option('enable-examples', type : 'feature', value : 'auto', yield : true, descri
option('enable-gtk-doc', type : 'boolean', value : false, description : 'Use gtk-doc to build documentation')
option('enable-systemd', type : 'feature', value : 'auto', description : 'Enable systemd gstd.service install')
option('enable-initd', type : 'feature', value : 'disabled', description : 'Enable init script install')
+option('enable-python', type : 'feature', value : 'auto', description : 'Install the pygstc library')
# String options
option('with-gstd-runstatedir', type : 'string', value : '${prefix}/var/run/gstd', description : 'Specify the location of the gstd\'s PID file')
@@ -11,6 +12,7 @@ option('with-gstd-logstatedir', type : 'string', value : '${prefix}/var/log/gstd
option('with-gstd-systemddir', type : 'string', value : 'Systemd default systemduserunitdir', description : 'Specify the location of gstd.service file')
option('with-gstd-initddir', type : 'string', value : '${sysconfdir}/init.d', description : 'Specify the location of gstd init script')
option('with-statedir-owner', type : 'string', value : 'root', description : 'Specify the owner of gstd\'s run and log dirs created by the initd script')
+option('with-python-version', type : 'string', value : 'python3', description : 'Specify the python version for pygstc installation')
# Common options
option('package-name', type : 'string', yield : true,
--
2.25.1