[gom] build: Add option to specify pygobject override dir



commit 3dcc5959315530b717f79a98a4315b646b52e616
Author: worldofpeace <worldofpeace users noreply github com>
Date:   Thu Apr 11 03:02:47 2019 -0400

    build: Add option to specify pygobject override dir
    
    Closes: #3

 bindings/python/meson.build | 17 +++++++++++------
 meson_options.txt           |  1 +
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/bindings/python/meson.build b/bindings/python/meson.build
index 37ea47a..53a48db 100644
--- a/bindings/python/meson.build
+++ b/bindings/python/meson.build
@@ -1,4 +1,4 @@
-python3 = import('python3').find_python()
+pygobject_override_dir = get_option('pygobject-override-dir')
 
 get_overridedir = '''
 import os
@@ -22,12 +22,17 @@ if overridedir.startswith(libdir): # Should always be True..
 print(overridedir)
 '''
 
-ret = run_command([python3, '-c', get_overridedir])
+if pygobject_override_dir == ''
+    python3 = import('python3').find_python()
+
+    ret = run_command([python3, '-c', get_overridedir])
+
+    if ret.returncode() != 0
+        error('Failed to determine pygobject override directory')
+    else
+        pygobject_override_dir = join_paths(get_option('libdir'), ret.stdout().strip())
+    endif
 
-if ret.returncode() != 0
-  error('Failed to determine pygobject overridedir')
-else
-  pygobject_override_dir = join_paths(get_option('libdir'), ret.stdout().strip())
 endif
 
 install_data('gi/overrides/Gom.py', install_dir: pygobject_override_dir)
diff --git a/meson_options.txt b/meson_options.txt
index 506ef16..9d31ab4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
 option('enable-gtk-doc', type: 'boolean', value: false, description: 'Enable generating the API reference')
 option('enable-introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection')
+option('pygobject-override-dir', type : 'string', value : '', description: 'Path to pygobject overrides 
directory')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]