diff --git a/libgstc/meson.build b/libgstc/meson.build index e94dcd19..582cbb8f 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 057114ba..8e039b50 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.5') + error('Python @0@ is not supported anymore, please port your code to python3.5 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 f50e540c..25292e6b 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,