From f055e2748ef3f06ed0746a85c652c0d2c1550345 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 28 Dec 2012 19:59:07 +0000 Subject: [PATCH] Add LOCALE_DIR. Remove PREFIXDIR and SYSCONFDIR. svn: r20866 --- gramps/gen/const.py.in | 14 +------------- setup.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/gramps/gen/const.py.in b/gramps/gen/const.py.in index d7bbc0c66..2265f83b5 100644 --- a/gramps/gen/const.py.in +++ b/gramps/gen/const.py.in @@ -89,19 +89,7 @@ APP_VCARD = ["text/x-vcard", "text/x-vcalendar"] # system paths # #------------------------------------------------------------------------- -if sys.platform == "win32": - if sys.prefix == os.path.dirname(os.getcwd()): - PREFIXDIR = sys.prefix - SYSCONFDIR = os.path.join(sys.prefix, "etc") - else: - PREFIXDIR = os.path.join(os.path.dirname(__file__), os.pardir) - SYSCONFDIR = os.path.join(PREFIXDIR, "etc") -elif sys.platform == "darwin" and sys.prefix != sys.exec_prefix: - PREFIXDIR = sys.prefix - SYSCONFDIR = os.path.join(sys.prefix, "etc") -else: - PREFIXDIR = "@prefix@" - SYSCONFDIR = "@sysconfdir@" +LOCALE_DIR = "@LOCALE_DIR@" #------------------------------------------------------------------------- # diff --git a/setup.py b/setup.py index e07bda0bd..a3fbb96a3 100644 --- a/setup.py +++ b/setup.py @@ -231,24 +231,24 @@ def write_gramps_script(install_cmd, build_scripts): log.info('changing mode of %s to %o', filename, mode) os.chmod(filename, mode) -def write_const_py(install_cmd): +def write_const_py(command): ''' Write the const.py file. ''' const_py_in = os.path.join('gramps', 'gen', 'const.py.in') const_py = os.path.join('gramps', 'gen', 'const.py') - if hasattr(install_cmd, 'install_data'): + if hasattr(command, 'install_data'): #during install - prefix = "'%s'" % install_cmd.install_data - sysconfdir = "'%s'" % os.path.join(install_cmd.install_data, 'etc') # Is this correct? + locale_dir = os.path.join(command.install_data, 'share', 'locale') else: #in build - prefix = 'os.path.join(os.path.dirname(__file__), os.pardir)' - sysconfdir = prefix + ' + "' + os.sep + 'etc"' # Is this correct? + if os.access(const_py, os.F_OK): + # Prevent overwriting version created during install + return + locale_dir = os.path.join(command.build_base, 'mo') subst_vars = (('@VERSIONSTRING@', VERSION), - ('"@prefix@"', prefix), - ('"@sysconfdir@"', sysconfdir)) + ('@LOCALE_DIR@', locale_dir)) substitute_variables(const_py_in, const_py, subst_vars)