0005-Use-native-meson-python-module-for-python-install.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 1067f6138e947d18fd835e4a39f229ae2293f864 Mon Sep 17 00:00:00 2001
  2. From: James Hilliard <james.hilliard1@gmail.com>
  3. Date: Tue, 14 Sep 2021 23:37:03 -0600
  4. Subject: [PATCH] Use native meson python module for python install.
  5. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  6. [upstreeam: https://github.com/RidgeRun/gstd-1.x/pull/253]
  7. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
  8. ---
  9. libgstc/meson.build | 4 +++-
  10. libgstc/python/meson.build | 26 +++++++++++++++++++++++++-
  11. meson_options.txt | 2 ++
  12. 3 files changed, 30 insertions(+), 2 deletions(-)
  13. diff --git a/libgstc/meson.build b/libgstc/meson.build
  14. index e94dcd1..582cbb8 100644
  15. --- a/libgstc/meson.build
  16. +++ b/libgstc/meson.build
  17. @@ -1,2 +1,4 @@
  18. subdir('c')
  19. -subdir('python')
  20. +if not get_option('enable-python').disabled()
  21. + subdir('python')
  22. +endif
  23. diff --git a/libgstc/python/meson.build b/libgstc/python/meson.build
  24. index 057114b..24e3242 100644
  25. --- a/libgstc/python/meson.build
  26. +++ b/libgstc/python/meson.build
  27. @@ -1 +1,25 @@
  28. -run_command('pip3', 'install', '.')
  29. +pymod = import('python')
  30. +python = pymod.find_installation(
  31. + get_option('with-python-version'),
  32. + required : get_option('enable-python').enabled(),
  33. + disabler : true
  34. +)
  35. +
  36. +pythonver = python.language_version()
  37. +if pythonver.version_compare('<3.7')
  38. + error('Python @0@ is not supported anymore, please port your code to python3.7 or newer.'.format(python.language_version()))
  39. +endif
  40. +
  41. +pygstc_src_files = [
  42. + 'pygstc/__init__.py',
  43. + 'pygstc/gstc.py',
  44. + 'pygstc/gstcerror.py',
  45. + 'pygstc/logger.py',
  46. + 'pygstc/tcp.py'
  47. +]
  48. +
  49. +python.install_sources(
  50. + pygstc_src_files,
  51. + subdir : 'pygstc',
  52. + pure : true
  53. +)
  54. diff --git a/meson_options.txt b/meson_options.txt
  55. index f50e540..25292e6 100644
  56. --- a/meson_options.txt
  57. +++ b/meson_options.txt
  58. @@ -4,6 +4,7 @@ option('enable-examples', type : 'feature', value : 'auto', yield : true, descri
  59. option('enable-gtk-doc', type : 'boolean', value : false, description : 'Use gtk-doc to build documentation')
  60. option('enable-systemd', type : 'feature', value : 'auto', description : 'Enable systemd gstd.service install')
  61. option('enable-initd', type : 'feature', value : 'disabled', description : 'Enable init script install')
  62. +option('enable-python', type : 'feature', value : 'auto', description : 'Install the pygstc library')
  63. # String options
  64. option('with-gstd-runstatedir', type : 'string', value : '${prefix}/var/run/gstd', description : 'Specify the location of the gstd\'s PID file')
  65. @@ -11,6 +12,7 @@ option('with-gstd-logstatedir', type : 'string', value : '${prefix}/var/log/gstd
  66. option('with-gstd-systemddir', type : 'string', value : 'Systemd default systemduserunitdir', description : 'Specify the location of gstd.service file')
  67. option('with-gstd-initddir', type : 'string', value : '${sysconfdir}/init.d', description : 'Specify the location of gstd init script')
  68. option('with-statedir-owner', type : 'string', value : 'root', description : 'Specify the owner of gstd\'s run and log dirs created by the initd script')
  69. +option('with-python-version', type : 'string', value : 'python3', description : 'Specify the python version for pygstc installation')
  70. # Common options
  71. option('package-name', type : 'string', yield : true,
  72. --
  73. 2.25.1