diff options
Diffstat (limited to 'gio/gdbus-2.0/codegen')
-rw-r--r-- | gio/gdbus-2.0/codegen/Makefile.am | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | gio/gdbus-2.0/codegen/gdbus-codegen.in | 14 | ||||
-rw-r--r-- | gio/gdbus-2.0/codegen/meson.build | 22 |
3 files changed, 25 insertions, 13 deletions
diff --git a/gio/gdbus-2.0/codegen/Makefile.am b/gio/gdbus-2.0/codegen/Makefile.am index b3fb2c292..b4e500cb0 100644 --- a/gio/gdbus-2.0/codegen/Makefile.am +++ b/gio/gdbus-2.0/codegen/Makefile.am @@ -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: diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in index 805098188..67d367543 100644..100755 --- a/gio/gdbus-2.0/codegen/gdbus-codegen.in +++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in @@ -37,7 +37,19 @@ else: # parent directory to the python path. path = os.path.join(filedir, '..') -sys.path.insert(0, os.path.abspath(path)) +# Canonicalize, then do further testing +path = os.path.abspath(path) + +# 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, path) from codegen import codegen_main sys.exit(codegen_main.codegen_main()) diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build index 0e9ffbdfa..54a86b0d6 100644 --- a/gio/gdbus-2.0/codegen/meson.build +++ b/gio/gdbus-2.0/codegen/meson.build @@ -11,9 +11,9 @@ 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 gdbus_codegen = configure_file(input : 'gdbus-codegen.in', output : 'gdbus-codegen', install : true, @@ -23,19 +23,19 @@ gdbus_codegen = configure_file(input : 'gdbus-codegen.in', codegen_dir = join_paths(get_option('datadir'), 'glib-2.0/codegen') -configure_file(input : 'config.py.in', - output : 'config.py', - install : true, - install_dir : codegen_dir, - configuration : gdbus_codegen_conf -) +gdbus_codegen_built_files = [] +gdbus_codegen_built_files += configure_file(input : 'config.py.in', + output : 'config.py', + install : true, + install_dir : codegen_dir, + configuration : gdbus_codegen_conf) blank_conf = configuration_data() foreach f : gdbus_codegen_files # Copy these into the builddir so that gdbus-codegen can be used uninstalled # and then install it too so that it can be used after installation - configure_file(input : f, output : f, - install : true, - install_dir : codegen_dir, - configuration : blank_conf) + gdbus_codegen_built_files += configure_file(input : f, output : f, + install : true, + install_dir : codegen_dir, + configuration : blank_conf) endforeach |