mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
gdbus-codegen: Don't assume bindir and datadir share prefix
This assumption breaks when, for instance: * Called as /bin/gdbus-codegen * Installed on Windows in a directory that is not `bin/` For such cases, we cannot make any assumptions about the directory structure, and must hard-code the datadir. https://bugzilla.gnome.org/show_bug.cgi?id=786785
This commit is contained in:
parent
62dedcb099
commit
b9f2ea4235
@ -21,7 +21,7 @@ CLEANFILES += gdbus-codegen
|
||||
EXTRA_DIST += gdbus-codegen.in
|
||||
|
||||
gdbus-codegen: gdbus-codegen.in Makefile $(codegen_PYTHON)
|
||||
$(AM_V_GEN) sed -e 's,@datadir\@,$(datadir),' -e 's,@PYTHON\@,$(PYTHON),' $< > $@.tmp && mv $@.tmp $@
|
||||
$(AM_V_GEN) sed -e 's,@DATADIR\@,$(datadir),' -e 's,@PYTHON\@,$(PYTHON),' $< > $@.tmp && mv $@.tmp $@
|
||||
@chmod a+x $@
|
||||
|
||||
clean-local:
|
||||
|
@ -37,6 +37,15 @@ else:
|
||||
# parent directory to the python path.
|
||||
path = os.path.join(filedir, '..')
|
||||
|
||||
# If the above path detection failed, use the hard-coded datadir. This can
|
||||
# happen when, for instance, bindir and datadir are not in the same prefix or
|
||||
# on Windows where we cannot make any guarantees about the directory structure.
|
||||
#
|
||||
# In these cases our installation cannot be relocatable, but at least we should
|
||||
# be able to find the codegen module.
|
||||
if not os.path.isfile(os.path.join(path, 'codegen', 'codegen_main.py')):
|
||||
path = os.path.join('@DATADIR@', 'glib-2.0')
|
||||
|
||||
sys.path.insert(0, os.path.abspath(path))
|
||||
from codegen import codegen_main
|
||||
|
||||
|
@ -11,6 +11,7 @@ gdbus_codegen_files = [
|
||||
gdbus_codegen_conf = configuration_data()
|
||||
gdbus_codegen_conf.set('VERSION', glib_version)
|
||||
gdbus_codegen_conf.set('PYTHON', python.path())
|
||||
gdbus_codegen_conf.set('DATADIR', glib_datadir)
|
||||
|
||||
# Install gdbus-codegen executable
|
||||
# FIXME: Set permissions
|
||||
|
Loading…
Reference in New Issue
Block a user