]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Move path resolution stuff to bind10_config
authorMukund Sivaraman <muks@isc.org>
Wed, 4 Sep 2013 10:11:57 +0000 (15:41 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 4 Sep 2013 15:07:49 +0000 (20:37 +0530)
... and don't generate isc/server_common/bind10_server.py from
isc/server_common/bind10_server.py.in. This fixes a builddir vs srcdir
path failure for the isc.server_common module.

configure.ac
src/lib/python/bind10_config.py.in
src/lib/python/isc/server_common/Makefile.am
src/lib/python/isc/server_common/bind10_server.py [moved from src/lib/python/isc/server_common/bind10_server.py.in with 88% similarity]

index e01f5cfc1310b19ca49c7b545d0f6913f1e888b3..8098a8ff4d03f03cf7978c3b704512730a5ea420 100644 (file)
@@ -1471,7 +1471,6 @@ AC_OUTPUT([doc/version.ent
            src/lib/python/isc/notify/tests/notify_out_test
            src/lib/python/isc/log/tests/log_console.py
            src/lib/python/isc/log_messages/work/__init__.py
-           src/lib/python/isc/server_common/bind10_server.py
            src/lib/dns/gen-rdatacode.py
            src/lib/python/bind10_config.py
            src/lib/cc/session_config.h.pre
index e56e908faeb1d5c036913e7d783d771346e5c02f..855dd008cee41450950d1c62125526b2ce8601b3 100644 (file)
 # variables to python scripts and libraries.
 import os
 
+def get_specfile_location(module_name):
+    """Return the path to the module spec file following common convetion.
+
+    This method generates the path commonly used by most BIND 10
+    modules, determined by a well known prefix and the module name.
+
+    A specific module can override this method if it uses a different
+    path for the spec file.
+
+    """
+    # First check if it's running under an 'in-source' environment,
+    # then try commonly used paths and file names.  If found, use it.
+    for ev in ['B10_FROM_SOURCE', 'B10_FROM_BUILD']:
+        if ev in os.environ:
+            specfile = os.environ[ev] + '/src/bin/' + module_name + \
+                       '/' + module_name + '.spec'
+            if os.path.exists(specfile):
+                return specfile
+    # Otherwise, just use the installed path, whether or not it really
+    # exists; leave error handling to the caller.
+    specfile_path = '@datadir@/@PACKAGE@'\
+        .replace('${datarootdir}', '@datarootdir@')\
+        .replace('${prefix}', '@prefix@')
+    return specfile_path + '/' + module_name + '.spec'
+
 def reload():
     # In a function, for testing purposes
     global BIND10_MSGQ_SOCKET_FILE
index 54b288584e21cdf271e3ea9699943e656cb857f6..53e46e0ddd638493fe63d942bdbab074684617c9 100644 (file)
@@ -7,7 +7,6 @@ python_PYTHON += logger.py
 pythondir = $(pyexecdir)/isc/server_common
 
 BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/work/server_common_messages.py
-BUILT_SOURCES += bind10_server.py
 
 nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/server_common_messages.py
 
similarity index 88%
rename from src/lib/python/isc/server_common/bind10_server.py.in
rename to src/lib/python/isc/server_common/bind10_server.py
index 5bbd341a71cfec599b6ce1d59916effd8068d64f..249d4d9bd7d35203ba024a371ada2cac8b5eb858 100644 (file)
@@ -18,6 +18,7 @@ import os
 import select
 import signal
 
+import bind10_config
 import isc.log
 import isc.config
 from isc.server_common.logger import logger
@@ -98,35 +99,10 @@ class BIND10Server:
 
         """
         self._mod_cc = isc.config.ModuleCCSession(
-            self._get_specfile_location(), self._config_handler,
-            self._command_handler)
+            bind10_config.get_specfile_location(self.__module_name),
+            self._config_handler, self._command_handler)
         self._mod_cc.start()
 
-    def _get_specfile_location(self):
-        """Return the path to the module spec file following common convetion.
-
-        This method generates the path commonly used by most BIND 10 modules,
-        determined by a well known prefix and the module name.
-
-        A specific module can override this method if it uses a different
-        path for the spec file.
-
-        """
-        # First check if it's running under an 'in-source' environment,
-        # then try commonly used paths and file names.  If found, use it.
-        for ev in ['B10_FROM_SOURCE', 'B10_FROM_BUILD']:
-            if ev in os.environ:
-                specfile = os.environ[ev] + '/src/bin/' + self.__module_name +\
-                    '/' + self.__module_name + '.spec'
-                if os.path.exists(specfile):
-                    return specfile
-        # Otherwise, just use the installed path, whether or not it really
-        # exists; leave error handling to the caller.
-        specfile_path = '${datarootdir}/bind10'\
-            .replace('${datarootdir}', '${prefix}/share')\
-            .replace('${prefix}', '/Users/jinmei/opt')
-        return specfile_path + '/' + self.__module_name + '.spec'
-
     def _trigger_shutdown(self):
         """Initiate a shutdown sequence.