Permalink
Browse files

config: Make sure we include installed DATADIR in config.get_data_file

  • Loading branch information...
1 parent ed910a8 commit 082e711f5a05ab32a1d18861c1b4a09fc0b74172 Ulrik Sverdrup committed Aug 23, 2009
Showing with 13 additions and 4 deletions.
  1. +11 −3 kupfer/config.py
  2. +1 −1 kupfer/main.py
  3. +1 −0 kupfer/version_subst.py.in
View
@@ -34,10 +34,18 @@ def get_data_file(filename):
Return path to @filename if it exists
anywhere in the data paths, else return None
"""
- # Add "./data" in workdir for running from builddir
data_paths = []
- data_paths.append("./data")
- data_paths.extend(base.load_data_paths(PACKAGE_NAME))
+ try:
+ from . import version_subst
+ except ImportError:
+ first_datadir = "./data"
+ else:
+ first_datadir = os.path.join(version_subst.DATADIR, PACKAGE_NAME)
+
+ data_paths.append(first_datadir)
+ for data_path in base.load_data_paths(PACKAGE_NAME):
+ if not data_path in data_paths:
+ data_paths.append(data_path)
for direc in data_paths:
file_path = os.path.join(direc, filename)
View
@@ -8,7 +8,7 @@ def setup_locale_and_gettext():
package_name = "kupfer"
localedir = "./locale"
try:
- import version_subst
+ from . import version_subst
except ImportError:
pass
else:
@@ -1,3 +1,4 @@
VERSION = "@VERSION@"
PACKAGE_NAME = "@PACKAGE@"
LOCALEDIR = "@LOCALEDIR@"
+DATADIR = "@DATADIR@"

0 comments on commit 082e711

Please sign in to comment.