[r21246]Allow hard-coded paths to be overridden with $XDG_DATA_DIRS

Necessary for post-installation relocatability.
Also ensure that data installed to share/gramps is in mac bundle.

svn: r21247
This commit is contained in:
John Ralls 2013-01-29 21:14:15 +00:00
parent 7c82a5df48
commit 2cd6aa43e4
2 changed files with 21 additions and 4 deletions

View File

@ -200,10 +200,23 @@ else:
# Paths to data files.
#
#-------------------------------------------------------------------------
LOCALE_DIR = "@LOCALE_DIR@"
DATA_DIR = "@DATA_DIR@"
IMAGE_DIR = "@IMAGE_DIR@"
DOC_DIR = "@DOC_DIR@"
if "XDG_DATA_DIRS" in os.environ:
share = None
for path in os.environ["XDG_DATA_DIRS"].split(":"):
if os.path.exists(os.path.join(path, "gramps", "tips.xml")):
share = path
break
if not share:
share = os.path.split("@DATA_DIR@")[0]
LOCALE_DIR = os.path.join(share, "locale")
DATA_DIR = os.path.join(share, "gramps")
IMAGE_DIR = os.path.join(DATA_DIR, "icons", "hicolor")
DOC_DIR = os.path.join(share, "doc", "gramps")
else:
LOCALE_DIR = "@LOCALE_DIR@"
DATA_DIR = "@DATA_DIR@"
IMAGE_DIR = "@IMAGE_DIR@"
DOC_DIR = "@DOC_DIR@"
TIP_DATA = os.path.join(DATA_DIR, "tips.xml")
PAPERSIZE = os.path.join(DATA_DIR, "papersize.xml")

View File

@ -187,6 +187,10 @@
${prefix}/lib/graphviz/config6
</data>
<data>
${prefix}/share/gramps
</data>
<!-- Copy in the themes data. You may want to trim this to save space
in your bundle. -->
<data>