[pygobject] meson: support building pycairo as a subproject



commit beed17372f3dc09aa422ee8dff5ec3bb187b86c3
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sat Jun 23 22:27:58 2018 +0200

    meson: support building pycairo as a subproject

 meson.build              | 11 +++++++++--
 subprojects/pycairo.wrap |  4 ++++
 tests/meson.build        |  7 ++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 43b56cbf..70279b85 100644
--- a/meson.build
+++ b/meson.build
@@ -42,10 +42,17 @@ if with_pycairo
   cairo_gobject_dep = dependency('cairo-gobject')
 
   if python.language_version().version_compare('>= 3.0')
-    pycairo_dep = dependency('py3cairo', version : pycairo_version_req)
+    pycairo_name = 'py3cairo'
   else
-    pycairo_dep = dependency('pycairo', version : pycairo_version_req)
+    pycairo_name = 'pycairo'
   endif
+
+  pycairo_dep = dependency(
+    pycairo_name,
+    version: pycairo_version_req,
+    fallback: ['pycairo', 'pycairo_dep'],
+    default_options: ['python=' + get_option('python')],
+  )
 endif
 
 cc = meson.get_compiler('c')
diff --git a/subprojects/pycairo.wrap b/subprojects/pycairo.wrap
new file mode 100644
index 00000000..87eac571
--- /dev/null
+++ b/subprojects/pycairo.wrap
@@ -0,0 +1,4 @@
+[wrap-git]
+directory=pycairo
+url=https://github.com/pygobject/pycairo.git
+revision=master
diff --git a/tests/meson.build b/tests/meson.build
index 5933ddba..f72ead0f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -118,7 +118,12 @@ endif
 if host_machine.system() == 'windows'
     envdata.prepend('PATH', join_paths(get_option('prefix'), get_option('bindir')))
 endif
-envdata.append('PYTHONPATH', join_paths(meson.current_build_dir(), '..'))
+
+python_paths = [join_paths(meson.current_build_dir(), '..')]
+if with_pycairo and pycairo_dep.type_name() == 'internal'
+  python_paths += [join_paths(meson.build_root(), 'subprojects', 'pycairo')]
+endif
+envdata.append('PYTHONPATH', python_paths)
 envdata.append('TESTS_BUILDDIR', meson.current_build_dir())
 
 test('pygobject-test-suite', python,


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