diff --git a/gramps/gen/const.py.in b/gramps/gen/const.py.in index fe6863d43..74c4413c0 100644 --- a/gramps/gen/const.py.in +++ b/gramps/gen/const.py.in @@ -199,17 +199,10 @@ else: # Paths to data files. # #------------------------------------------------------------------------- -SHARE_DIR = "@SHARE_DIR@" LOCALE_DIR = "@LOCALE_DIR@" - -if SHARE_DIR != '': - DATA_DIR = os.path.join(SHARE_DIR, 'gramps') - IMAGE_DIR = os.path.join(SHARE_DIR, 'gramps', 'icons', 'hicolor') - DOC_DIR = os.path.join(SHARE_DIR, 'doc', 'gramps') -else: - DATA_DIR = 'data' - IMAGE_DIR = 'images' - DOC_DIR = os.curdir +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") diff --git a/setup.py b/setup.py index ee99f854d..b6648ca12 100644 --- a/setup.py +++ b/setup.py @@ -242,18 +242,26 @@ def write_const_py(command): if hasattr(command, 'install_data'): #during install share_dir = os.path.join(command.install_data, 'share') - locale_dir = os.path.join(command.install_data, 'share', 'locale') + locale_dir = os.path.join(share_dir, 'locale') + data_dir = os.path.join(share_dir, 'gramps') + image_dir = os.path.join(share_dir, 'gramps', 'icons', 'hicolor') + doc_dir = os.path.join(share_dir, 'doc', 'gramps') else: #in build if 'install' in command.distribution.command_obj: # Prevent overwriting version created during install return - share_dir = '' - locale_dir = os.path.join(command.build_base, 'mo') + base_dir = os.path.abspath(os.path.dirname(__file__)) + locale_dir = os.path.abspath(os.path.join(command.build_base, 'mo')) + data_dir = os.path.join(base_dir, 'data') + image_dir = os.path.join(base_dir, 'images') + doc_dir = base_dir subst_vars = (('@VERSIONSTRING@', VERSION), - ('@SHARE_DIR@', share_dir), - ('@LOCALE_DIR@', locale_dir)) + ('@LOCALE_DIR@', locale_dir), + ('@DATA_DIR@', data_dir), + ('@IMAGE_DIR@', image_dir), + ('@DOC_DIR@', doc_dir),) substitute_variables(const_py_in, const_py, subst_vars)