12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- # Copyright (C) 2010 Internet Systems Consortium.
- #
- # Permission to use, copy, modify, and distribute this software for any
- # purpose with or without fee is hereby granted, provided that the above
- # copyright notice and this permission notice appear in all copies.
- #
- # THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
- # DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
- # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
- # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- # This is a base-level module intended to provide configure-time
- # variables to python scripts and libraries.
- import os
- def reload():
- # In a function, for testing purposes
- global BIND10_MSGQ_SOCKET_FILE
- global DATA_PATH
- global PLUGIN_PATHS
- global PREFIX
- global LIBEXECDIR
- LIBEXECDIR = ("@libexecdir@/@PACKAGE@"). \
- replace("${exec_prefix}", "@exec_prefix@"). \
- replace("${prefix}", "@prefix@")
- BIND10_MSGQ_SOCKET_FILE = os.path.join("@localstatedir@",
- "@PACKAGE_NAME@",
- "msgq_socket").replace("${prefix}",
- "@prefix@")
- PREFIX = "@prefix@"
- # If B10_FROM_SOURCE is set in the environment, we use data files
- # from a directory relative to the value of that variable, or, if defined,
- # relative to the value of B10_FROM_SOURCE_LOCALSTATEDIR. Otherwise
- # we use the ones installed on the system.
- # B10_FROM_SOURCE_LOCALSTATEDIR is specifically intended to be used for
- # tests where we want to use variuos types of configuration within the test
- # environment. (We may want to make it even more generic so that the path is
- # passed from the boss process)
- if "B10_FROM_SOURCE" in os.environ:
- if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
- DATA_PATH = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"]
- else:
- DATA_PATH = os.environ["B10_FROM_SOURCE"]
- PLUGIN_PATHS = [os.environ["B10_FROM_SOURCE"] +
- '/src/bin/cfgmgr/plugins']
- else:
- DATA_PATH = "@localstatedir@/@PACKAGE@".replace("${prefix}", PREFIX)
- PLUGIN_PATHS = ["@prefix@/share/@PACKAGE@/config_plugins"]
- # For testing the plugins so they can find their own spec files
- if "B10_TEST_PLUGIN_DIR" in os.environ:
- PLUGIN_PATHS = os.environ["B10_TEST_PLUGIN_DIR"].split(':')
- reload()
|