|
|
6c9d0f |
From b9f2ea423526735f7fe7371fb1339eae91a618c2 Mon Sep 17 00:00:00 2001
|
|
|
6c9d0f |
From: Nirbheek Chauhan <nirbheek@centricular.com>
|
|
|
6c9d0f |
Date: Tue, 12 Sep 2017 15:46:57 +0530
|
|
|
6c9d0f |
Subject: [PATCH] gdbus-codegen: Don't assume bindir and datadir share prefix
|
|
|
6c9d0f |
|
|
|
6c9d0f |
This assumption breaks when, for instance:
|
|
|
6c9d0f |
|
|
|
6c9d0f |
* Called as /bin/gdbus-codegen
|
|
|
6c9d0f |
* Installed on Windows in a directory that is not `bin/`
|
|
|
6c9d0f |
|
|
|
6c9d0f |
For such cases, we cannot make any assumptions about the directory
|
|
|
6c9d0f |
structure, and must hard-code the datadir.
|
|
|
6c9d0f |
|
|
|
6c9d0f |
https://bugzilla.gnome.org/show_bug.cgi?id=786785
|
|
|
6c9d0f |
---
|
|
|
6c9d0f |
gio/gdbus-2.0/codegen/Makefile.am | 2 +-
|
|
|
6c9d0f |
gio/gdbus-2.0/codegen/gdbus-codegen.in | 9 +++++++++
|
|
|
6c9d0f |
gio/gdbus-2.0/codegen/meson.build | 1 +
|
|
|
6c9d0f |
3 files changed, 11 insertions(+), 1 deletion(-)
|
|
|
6c9d0f |
|
|
|
6c9d0f |
diff --git a/gio/gdbus-2.0/codegen/Makefile.am b/gio/gdbus-2.0/codegen/Makefile.am
|
|
|
6c9d0f |
index b3fb2c292..b4e500cb0 100644
|
|
|
6c9d0f |
--- a/gio/gdbus-2.0/codegen/Makefile.am
|
|
|
6c9d0f |
+++ b/gio/gdbus-2.0/codegen/Makefile.am
|
|
|
6c9d0f |
@@ -21,7 +21,7 @@ CLEANFILES += gdbus-codegen
|
|
|
6c9d0f |
EXTRA_DIST += gdbus-codegen.in
|
|
|
6c9d0f |
|
|
|
6c9d0f |
gdbus-codegen: gdbus-codegen.in Makefile $(codegen_PYTHON)
|
|
|
6c9d0f |
- $(AM_V_GEN) sed -e 's,@datadir\@,$(datadir),' -e 's,@PYTHON\@,$(PYTHON),' $< > $@.tmp && mv $@.tmp $@
|
|
|
6c9d0f |
+ $(AM_V_GEN) sed -e 's,@DATADIR\@,$(datadir),' -e 's,@PYTHON\@,$(PYTHON),' $< > $@.tmp && mv $@.tmp $@
|
|
|
6c9d0f |
@chmod a+x $@
|
|
|
6c9d0f |
|
|
|
6c9d0f |
clean-local:
|
|
|
6c9d0f |
diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in
|
|
|
6c9d0f |
index 805098188..e3f4f00f8 100644
|
|
|
6c9d0f |
--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in
|
|
|
6c9d0f |
+++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in
|
|
|
6c9d0f |
@@ -37,6 +37,15 @@ else:
|
|
|
6c9d0f |
# parent directory to the python path.
|
|
|
6c9d0f |
path = os.path.join(filedir, '..')
|
|
|
6c9d0f |
|
|
|
6c9d0f |
+# If the above path detection failed, use the hard-coded datadir. This can
|
|
|
6c9d0f |
+# happen when, for instance, bindir and datadir are not in the same prefix or
|
|
|
6c9d0f |
+# on Windows where we cannot make any guarantees about the directory structure.
|
|
|
6c9d0f |
+#
|
|
|
6c9d0f |
+# In these cases our installation cannot be relocatable, but at least we should
|
|
|
6c9d0f |
+# be able to find the codegen module.
|
|
|
6c9d0f |
+if not os.path.isfile(os.path.join(path, 'codegen', 'codegen_main.py')):
|
|
|
6c9d0f |
+ path = os.path.join('@DATADIR@', 'glib-2.0')
|
|
|
6c9d0f |
+
|
|
|
6c9d0f |
sys.path.insert(0, os.path.abspath(path))
|
|
|
6c9d0f |
from codegen import codegen_main
|
|
|
6c9d0f |
|