summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2011-05-27 12:09:10 -0400
committerShaun McCance <shaunm@gnome.org>2011-05-27 12:09:10 -0400
commit00a8df54545a66aa70c20ceecb19709ca0b811a7 (patch)
treea50a284952d9cb31076773db7cf99f3e5138c0ed
parentabd3afc9bd7066658d295de3a39c5c0b287d0644 (diff)
downloaditstool-00a8df54545a66aa70c20ceecb19709ca0b811a7.tar.gz
Include installation dir in search path if XDG_DATA_DIRS not set
-rw-r--r--configure.ac9
-rwxr-xr-xitstool.in5
2 files changed, 13 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 5eed58e..8618395 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,15 @@
AC_INIT([itstool], [1.0.1], [])
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
+DATADIR=`(
+ case $prefix in
+ NONE) prefix=$ac_default_prefix ;;
+ *) ;;
+ esac
+ eval echo $(eval echo $datadir)
+)`
+AC_SUBST([DATADIR])
+
AC_CONFIG_FILES([
Makefile
itstool
diff --git a/itstool.in b/itstool.in
index 6f42791..cba3893 100755
--- a/itstool.in
+++ b/itstool.in
@@ -1,6 +1,7 @@
#!/usr/bin/env python
VERSION="@VERSION@"
+DATADIR="@DATADIR@"
import gettext
import hashlib
@@ -386,7 +387,9 @@ class Document (object):
dirs.append(ddir)
ddir = os.getenv('XDG_DATA_DIRS', '')
if ddir == '':
- ddir = '/usr/local/share:/usr/share'
+ if DATADIR not in ('/usr/local/share', '/usr/share'):
+ ddir += DATADIR + ':'
+ ddir += '/usr/local/share:/usr/share'
dirs.extend(ddir.split(':'))
ddone = {}
for ddir in dirs: