diff options
Diffstat (limited to 'src')
59 files changed, 351 insertions, 99 deletions
diff --git a/src/bin/bind10/Makefile.am b/src/bin/bind10/Makefile.am index 6ab88d89ce..7dc7807f59 100644 --- a/src/bin/bind10/Makefile.am +++ b/src/bin/bind10/Makefile.am @@ -1,10 +1,16 @@ SUBDIRS = . tests sbin_SCRIPTS = bind10 -CLEANFILES = bind10 bind10_src.pyc bind10_messages.py bind10_messages.pyc +CLEANFILES = bind10 bind10_src.pyc +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.pyc pkglibexecdir = $(libexecdir)/@PACKAGE@ -pyexec_DATA = bind10_messages.py + +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ + +noinst_SCRIPTS = run_bind10.sh bind10dir = $(pkgdatadir) bind10_DATA = bob.spec @@ -13,6 +19,11 @@ EXTRA_DIST = bob.spec man_MANS = bind10.8 EXTRA_DIST += $(man_MANS) bind10.xml bind10_messages.mes +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/bind10_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/bind10_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/bind10_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/bind10_messages.py + if ENABLE_MAN bind10.8: bind10.xml @@ -20,11 +31,15 @@ bind10.8: bind10.xml endif -bind10_messages.py: bind10_messages.mes - $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/bin/bind10/bind10_messages.mes +$(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py : bind10_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/bind10_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/bind10_messages.py: Makefile + echo "from work.bind10_messages import *" > $@ # this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix -bind10: bind10_src.py +bind10: bind10_src.py $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py $(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" \ -e "s|@@LIBEXECDIR@@|$(pkglibexecdir)|" bind10_src.py >$@ chmod a+x $@ diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in index 81b24f15ff..28af8cc58f 100755 --- a/src/bin/bind10/bind10_src.py.in +++ b/src/bin/bind10/bind10_src.py.in @@ -66,7 +66,7 @@ import isc.cc import isc.util.process import isc.net.parse import isc.log -from bind10_messages import * +from isc.log_messages.bind10_messages import * import isc.bind10.sockcreator isc.log.init("b10-boss") diff --git a/src/bin/bind10/run_bind10.sh.in b/src/bin/bind10/run_bind10.sh.in index b5b9721542..899ec89ede 100755 --- a/src/bin/bind10/run_bind10.sh.in +++ b/src/bin/bind10/run_bind10.sh.in @@ -23,7 +23,7 @@ BIND10_PATH=@abs_top_builddir@/src/bin/bind10 PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/resolver:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/stats:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:@abs_top_builddir@/src/bin/zonemgr:@abs_top_builddir@/src/bin/dhcp6:@abs_top_builddir@/src/bin/sockcreator:$PATH export PATH -PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs:@abs_top_builddir@/src/lib/log/.libs:@abs_top_builddir@/src/lib/util/io/.libs:@abs_top_builddir@/src/lib/python/isc/config:@abs_top_builddir@/src/lib/python/isc/acl/.libs: +PYTHONPATH=@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs:@abs_top_builddir@/src/lib/log/.libs:@abs_top_builddir@/src/lib/util/io/.libs:@abs_top_builddir@/src/lib/python/isc/config:@abs_top_builddir@/src/lib/python/isc/acl/.libs: export PYTHONPATH # If necessary (rare cases), explicitly specify paths to dynamic libraries diff --git a/src/bin/bind10/tests/Makefile.am b/src/bin/bind10/tests/Makefile.am index f388ba1cbe..d0f36ca6b2 100644 --- a/src/bin/bind10/tests/Makefile.am +++ b/src/bin/bind10/tests/Makefile.am @@ -22,7 +22,7 @@ endif echo Running test: $$pytest ; \ chmod +x $(abs_builddir)/$$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_srcdir)/src/bin:$(abs_top_builddir)/src/bin/bind10:$(abs_top_builddir)/src/lib/util/io/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_srcdir)/src/bin:$(abs_top_builddir)/src/bin/bind10:$(abs_top_builddir)/src/lib/util/io/.libs \ BIND10_MSGQ_SOCKET_FILE=$(abs_top_builddir)/msgq_socket \ $(PYCOVERAGE_RUN) $(abs_builddir)/$$pytest || exit ; \ done diff --git a/src/bin/bindctl/Makefile.am b/src/bin/bindctl/Makefile.am index cd8bcb3165..700f26e30b 100644 --- a/src/bin/bindctl/Makefile.am +++ b/src/bin/bindctl/Makefile.am @@ -5,6 +5,8 @@ man_MANS = bindctl.1 EXTRA_DIST = $(man_MANS) bindctl.xml +noinst_SCRIPTS = run_bindctl.sh + python_PYTHON = __init__.py bindcmd.py cmdparse.py exception.py moduleinfo.py \ mycollections.py pythondir = $(pyexecdir)/bindctl diff --git a/src/bin/bindctl/run_bindctl.sh.in b/src/bin/bindctl/run_bindctl.sh.in index 8f6ba59351..f7d7e7828e 100755 --- a/src/bin/bindctl/run_bindctl.sh.in +++ b/src/bin/bindctl/run_bindctl.sh.in @@ -20,7 +20,7 @@ export PYTHON_EXEC BINDCTL_PATH=@abs_top_builddir@/src/bin/bindctl -PYTHONPATH=@abs_top_srcdir@/src/bin:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/bin:@abs_top_srcdir@/src/lib/python +PYTHONPATH=@abs_top_srcdir@/src/bin:@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/bin:@abs_top_srcdir@/src/lib/python export PYTHONPATH # If necessary (rare cases), explicitly specify paths to dynamic libraries diff --git a/src/bin/bindctl/tests/Makefile.am b/src/bin/bindctl/tests/Makefile.am index 891d41304a..5bde145053 100644 --- a/src/bin/bindctl/tests/Makefile.am +++ b/src/bin/bindctl/tests/Makefile.am @@ -19,6 +19,6 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/bindctl:$(abs_top_srcdir)/src/bin \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/bindctl:$(abs_top_srcdir)/src/bin \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/bin/cfgmgr/b10-cfgmgr.py.in b/src/bin/cfgmgr/b10-cfgmgr.py.in index 8befbdf10b..2ccc4304b0 100755 --- a/src/bin/cfgmgr/b10-cfgmgr.py.in +++ b/src/bin/cfgmgr/b10-cfgmgr.py.in @@ -28,7 +28,7 @@ import os.path import isc.log isc.log.init("b10-cfgmgr") from isc.config.cfgmgr import ConfigManager, ConfigManagerDataReadError, logger -from cfgmgr_messages import * +from isc.log_messages.cfgmgr_messages import * isc.util.process.rename() diff --git a/src/bin/cfgmgr/plugins/tests/Makefile.am b/src/bin/cfgmgr/plugins/tests/Makefile.am index 07b7a858c2..d4b87505ea 100644 --- a/src/bin/cfgmgr/plugins/tests/Makefile.am +++ b/src/bin/cfgmgr/plugins/tests/Makefile.am @@ -19,8 +19,8 @@ if ENABLE_PYTHON_COVERAGE endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ - env B10_TEST_PLUGIN_DIR=$(abs_srcdir)/..:$(abs_builddir)/.. \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/cfgmgr:$(abs_top_builddir)/src/lib/dns/python/.libs \ + B10_TEST_PLUGIN_DIR=$(abs_srcdir)/..:$(abs_builddir)/.. \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/cfgmgr:$(abs_top_builddir)/src/lib/dns/python/.libs \ $(LIBRARY_PATH_PLACEHOLDER) \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/bin/cfgmgr/tests/Makefile.am b/src/bin/cfgmgr/tests/Makefile.am index 99f8cc9471..41edc8edb6 100644 --- a/src/bin/cfgmgr/tests/Makefile.am +++ b/src/bin/cfgmgr/tests/Makefile.am @@ -21,9 +21,9 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ chmod +x $(abs_builddir)/$$pytest ; \ - env TESTDATA_PATH=$(abs_srcdir)/testdata \ + TESTDATA_PATH=$(abs_srcdir)/testdata \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/cfgmgr:$(abs_top_builddir)/src/lib/python/isc/config \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/cfgmgr:$(abs_top_builddir)/src/lib/python/isc/config \ $(PYCOVERAGE_RUN) $(abs_builddir)/$$pytest || exit ; \ done diff --git a/src/bin/cmdctl/Makefile.am b/src/bin/cmdctl/Makefile.am index fcd23f8662..fff44b08e1 100644 --- a/src/bin/cmdctl/Makefile.am +++ b/src/bin/cmdctl/Makefile.am @@ -3,7 +3,9 @@ SUBDIRS = . tests pkglibexecdir = $(libexecdir)/@PACKAGE@ pkglibexec_SCRIPTS = b10-cmdctl -pyexec_DATA = cmdctl_messages.py + +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/cmdctl_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ b10_cmdctldir = $(pkgdatadir) @@ -19,7 +21,14 @@ b10_cmdctl_DATA += cmdctl.spec EXTRA_DIST = $(CMDCTL_CONFIGURATIONS) -CLEANFILES= b10-cmdctl cmdctl.pyc cmdctl.spec cmdctl_messages.py cmdctl_messages.pyc +CLEANFILES= b10-cmdctl cmdctl.pyc cmdctl.spec +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/cmdctl_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/cmdctl_messages.pyc + +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/cmdctl_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/cmdctl_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/cmdctl_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/cmdctl_messages.py man_MANS = b10-cmdctl.8 EXTRA_DIST += $(man_MANS) b10-cmdctl.xml cmdctl_messages.mes @@ -34,11 +43,15 @@ endif cmdctl.spec: cmdctl.spec.pre $(SED) -e "s|@@SYSCONFDIR@@|$(sysconfdir)|" cmdctl.spec.pre >$@ -cmdctl_messages.py: cmdctl_messages.mes - $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/bin/cmdctl/cmdctl_messages.mes +$(PYTHON_LOGMSGPKG_DIR)/work/cmdctl_messages.py : cmdctl_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/cmdctl_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/cmdctl_messages.py: Makefile + echo "from work.cmdctl_messages import *" > $@ # this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix -b10-cmdctl: cmdctl.py cmdctl_messages.py +b10-cmdctl: cmdctl.py $(PYTHON_LOGMSGPKG_DIR)/work/cmdctl_messages.py $(SED) "s|@@PYTHONPATH@@|@pyexecdir@|" cmdctl.py >$@ chmod a+x $@ diff --git a/src/bin/cmdctl/cmdctl.py.in b/src/bin/cmdctl/cmdctl.py.in index 2f89894066..fcd69b88da 100755 --- a/src/bin/cmdctl/cmdctl.py.in +++ b/src/bin/cmdctl/cmdctl.py.in @@ -47,7 +47,7 @@ import isc.net.parse from optparse import OptionParser, OptionValueError from hashlib import sha1 from isc.util import socketserver_mixin -from cmdctl_messages import * +from isc.log_messages.cmdctl_messages import * # TODO: these debug-levels are hard-coded here; we are planning on # creating a general set of debug levels, see ticket #1074. When done, diff --git a/src/bin/cmdctl/tests/Makefile.am b/src/bin/cmdctl/tests/Makefile.am index e4ec9d43f7..6bb9fba8e7 100644 --- a/src/bin/cmdctl/tests/Makefile.am +++ b/src/bin/cmdctl/tests/Makefile.am @@ -19,7 +19,7 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/cmdctl \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/cmdctl \ CMDCTL_SPEC_PATH=$(abs_top_builddir)/src/bin/cmdctl \ CMDCTL_SRC_PATH=$(abs_top_srcdir)/src/bin/cmdctl \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index 4a0e9186de..79f5968310 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -15,7 +15,7 @@ endif check-local: for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_srcdir)/src/bin:$(abs_top_builddir)/src/bin/bind10:$(abs_top_builddir)/src/lib/util/io/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_srcdir)/src/bin:$(abs_top_builddir)/src/bin/bind10:$(abs_top_builddir)/src/lib/util/io/.libs \ $(LIBRARY_PATH_PLACEHOLDER) \ BIND10_MSGQ_SOCKET_FILE=$(abs_top_builddir)/msgq_socket \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ diff --git a/src/bin/loadzone/Makefile.am b/src/bin/loadzone/Makefile.am index 74d4dd4ddc..a235d68bd0 100644 --- a/src/bin/loadzone/Makefile.am +++ b/src/bin/loadzone/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = . tests/correct tests/error bin_SCRIPTS = b10-loadzone +noinst_SCRIPTS = run_loadzone.sh CLEANFILES = b10-loadzone diff --git a/src/bin/loadzone/run_loadzone.sh.in b/src/bin/loadzone/run_loadzone.sh.in index 95de3961aa..e6db99c7e7 100755 --- a/src/bin/loadzone/run_loadzone.sh.in +++ b/src/bin/loadzone/run_loadzone.sh.in @@ -18,7 +18,7 @@ PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@} export PYTHON_EXEC -PYTHONPATH=@abs_top_builddir@/src/lib/python +PYTHONPATH=@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_builddir@/src/lib/python export PYTHONPATH # If necessary (rare cases), explicitly specify paths to dynamic libraries diff --git a/src/bin/loadzone/tests/correct/Makefile.am b/src/bin/loadzone/tests/correct/Makefile.am index 3507bfaaaa..73c8a3464a 100644 --- a/src/bin/loadzone/tests/correct/Makefile.am +++ b/src/bin/loadzone/tests/correct/Makefile.am @@ -13,6 +13,8 @@ EXTRA_DIST += ttl2.db EXTRA_DIST += ttlext.db EXTRA_DIST += example.db +noinst_SCRIPTS = correct_test.sh + # If necessary (rare cases), explicitly specify paths to dynamic libraries # required by loadable python modules. LIBRARY_PATH_PLACEHOLDER = diff --git a/src/bin/loadzone/tests/correct/correct_test.sh.in b/src/bin/loadzone/tests/correct/correct_test.sh.in index 509d8e5f13..d944451034 100644..100755 --- a/src/bin/loadzone/tests/correct/correct_test.sh.in +++ b/src/bin/loadzone/tests/correct/correct_test.sh.in @@ -18,7 +18,7 @@ PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@} export PYTHON_EXEC -PYTHONPATH=@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/python +PYTHONPATH=@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/python export PYTHONPATH LOADZONE_PATH=@abs_top_builddir@/src/bin/loadzone diff --git a/src/bin/loadzone/tests/error/Makefile.am b/src/bin/loadzone/tests/error/Makefile.am index 87bb1cf8ac..57f7857b21 100644 --- a/src/bin/loadzone/tests/error/Makefile.am +++ b/src/bin/loadzone/tests/error/Makefile.am @@ -12,6 +12,8 @@ EXTRA_DIST += keyerror3.db EXTRA_DIST += originerr1.db EXTRA_DIST += originerr2.db +noinst_SCRIPTS = error_test.sh + # If necessary (rare cases), explicitly specify paths to dynamic libraries # required by loadable python modules. LIBRARY_PATH_PLACEHOLDER = diff --git a/src/bin/loadzone/tests/error/error_test.sh.in b/src/bin/loadzone/tests/error/error_test.sh.in index d1d6bd1837..94c5edb9d3 100644..100755 --- a/src/bin/loadzone/tests/error/error_test.sh.in +++ b/src/bin/loadzone/tests/error/error_test.sh.in @@ -18,7 +18,7 @@ PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@} export PYTHON_EXEC -PYTHONPATH=@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/python +PYTHONPATH=@abs_top_builddir@/src/lib/python/isc/log_messages:@abs_top_srcdir@/src/lib/python:@abs_top_builddir@/src/lib/python export PYTHONPATH LOADZONE_PATH=@abs_top_builddir@/src/bin/loadzone diff --git a/src/bin/msgq/tests/Makefile.am b/src/bin/msgq/tests/Makefile.am index 50c1e6eefb..ee9ffd87fc 100644 --- a/src/bin/msgq/tests/Makefile.am +++ b/src/bin/msgq/tests/Makefile.am @@ -19,7 +19,7 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_builddir)/src/bin/msgq:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/msgq \ BIND10_TEST_SOCKET_FILE=$(builddir)/test_msgq_socket.sock \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/bin/stats/Makefile.am b/src/bin/stats/Makefile.am index e830f65d60..0e189b193f 100644 --- a/src/bin/stats/Makefile.am +++ b/src/bin/stats/Makefile.am @@ -7,12 +7,17 @@ pkglibexec_SCRIPTS = b10-stats b10-stats-httpd b10_statsdir = $(pkgdatadir) b10_stats_DATA = stats.spec stats-httpd.spec stats-schema.spec b10_stats_DATA += stats-httpd-xml.tpl stats-httpd-xsd.tpl stats-httpd-xsl.tpl -pyexec_DATA = stats_messages.py stats_httpd_messages.py + +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/stats_messages.py +nodist_pylogmessage_PYTHON += $(PYTHON_LOGMSGPKG_DIR)/work/stats_httpd_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ CLEANFILES = b10-stats stats.pyc CLEANFILES += b10-stats-httpd stats_httpd.pyc -CLEANFILES += stats_messages.py stats_messages.pyc -CLEANFILES += stats_httpd_messages.py stats_httpd_messages.pyc +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/stats_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/stats_messages.pyc +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/stats_httpd_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/stats_httpd_messages.pyc man_MANS = b10-stats.8 b10-stats-httpd.8 EXTRA_DIST = $(man_MANS) b10-stats.xml b10-stats-httpd.xml @@ -20,6 +25,16 @@ EXTRA_DIST += stats.spec stats-httpd.spec stats-schema.spec EXTRA_DIST += stats-httpd-xml.tpl stats-httpd-xsd.tpl stats-httpd-xsl.tpl EXTRA_DIST += stats_messages.mes stats_httpd_messages.mes +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/stats_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/stats_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/stats_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/stats_messages.py + +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/stats_httpd_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/stats_httpd_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/stats_httpd_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/stats_httpd_messages.py + if ENABLE_MAN b10-stats.8: b10-stats.xml @@ -30,18 +45,26 @@ b10-stats-httpd.8: b10-stats-httpd.xml endif -stats_messages.py: stats_messages.mes - $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/bin/stats/stats_messages.mes +$(PYTHON_LOGMSGPKG_DIR)/work/stats_messages.py : stats_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/stats_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/stats_messages.py: Makefile + echo "from work.stats_messages import *" > $@ + +$(PYTHON_LOGMSGPKG_DIR)/work/stats_httpd_messages.py : stats_httpd_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/stats_httpd_messages.mes -stats_httpd_messages.py: stats_httpd_messages.mes - $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/bin/stats/stats_httpd_messages.mes +$(PYTHON_LOGMSGPKG_DIR)/stats_httpd_messages.py: Makefile + echo "from work.stats_httpd_messages import *" > $@ # this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix -b10-stats: stats.py +b10-stats: stats.py $(PYTHON_LOGMSGPKG_DIR)/work/stats_messages.py $(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" stats.py >$@ chmod a+x $@ -b10-stats-httpd: stats_httpd.py +b10-stats-httpd: stats_httpd.py $(PYTHON_LOGMSGPKG_DIR)/work/stats_httpd_messages.py $(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" stats_httpd.py >$@ chmod a+x $@ diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in index 51d712b33d..afed54405a 100644..100755 --- a/src/bin/stats/stats.py.in +++ b/src/bin/stats/stats.py.in @@ -26,7 +26,7 @@ from isc.config.ccsession import ModuleCCSession, create_answer from isc.cc import Session, SessionError import isc.log -from stats_messages import * +from isc.log_messages.stats_messages import * isc.log.init("b10-stats") logger = isc.log.Logger("stats") diff --git a/src/bin/stats/stats_httpd.py.in b/src/bin/stats/stats_httpd.py.in index 74298cf288..6be6adf26c 100755 --- a/src/bin/stats/stats_httpd.py.in +++ b/src/bin/stats/stats_httpd.py.in @@ -35,7 +35,7 @@ import isc.config import isc.util.process import isc.log -from stats_httpd_messages import * +from isc.log_messages.stats_httpd_messages import * isc.log.init("b10-stats-httpd") logger = isc.log.Logger("stats-httpd") diff --git a/src/bin/stats/tests/Makefile.am b/src/bin/stats/tests/Makefile.am index dad6c48bbc..bb9369fba6 100644 --- a/src/bin/stats/tests/Makefile.am +++ b/src/bin/stats/tests/Makefile.am @@ -21,7 +21,7 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/bin/stats:$(abs_top_builddir)/src/bin/stats/tests \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/stats:$(abs_top_builddir)/src/bin/stats/tests \ B10_FROM_SOURCE=$(abs_top_srcdir) \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/bin/stats/tests/isc/Makefile.am b/src/bin/stats/tests/isc/Makefile.am index d31395d404..bdfa1eb38a 100644 --- a/src/bin/stats/tests/isc/Makefile.am +++ b/src/bin/stats/tests/isc/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = cc config util log +SUBDIRS = cc config util log log_messages EXTRA_DIST = __init__.py CLEANFILES = __init__.pyc diff --git a/src/bin/stats/tests/isc/log_messages/Makefile.am b/src/bin/stats/tests/isc/log_messages/Makefile.am new file mode 100644 index 0000000000..90b449940a --- /dev/null +++ b/src/bin/stats/tests/isc/log_messages/Makefile.am @@ -0,0 +1,7 @@ +EXTRA_DIST = __init__.py stats_messages.py stats_httpd_messages.py +CLEANFILES = __init__.pyc stats_messages.pyc stats_httpd_messages.pyc + +CLEANDIRS = __pycache__ + +clean-local: + rm -rf $(CLEANDIRS) diff --git a/src/bin/stats/tests/isc/log_messages/__init__.py b/src/bin/stats/tests/isc/log_messages/__init__.py new file mode 100644 index 0000000000..58e99e36ce --- /dev/null +++ b/src/bin/stats/tests/isc/log_messages/__init__.py @@ -0,0 +1,18 @@ +# Copyright (C) 2011 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 fake package that acts as a forwarder to the real package. +''' diff --git a/src/bin/tests/Makefile.am b/src/bin/tests/Makefile.am index 034152c173..446c002b8f 100644 --- a/src/bin/tests/Makefile.am +++ b/src/bin/tests/Makefile.am @@ -22,6 +22,6 @@ endif echo Running test: $$pytest ; \ chmod +x $(abs_builddir)/$$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/dns/python/.libs \ $(PYCOVERAGE_RUN) $(abs_builddir)/$$pytest || exit ; \ done diff --git a/src/bin/xfrin/Makefile.am b/src/bin/xfrin/Makefile.am index 0af9be6d5e..f88b4d27f8 100644 --- a/src/bin/xfrin/Makefile.am +++ b/src/bin/xfrin/Makefile.am @@ -6,14 +6,23 @@ pkglibexec_SCRIPTS = b10-xfrin b10_xfrindir = $(pkgdatadir) b10_xfrin_DATA = xfrin.spec -pyexec_DATA = xfrin_messages.py -CLEANFILES = b10-xfrin xfrin.pyc xfrinlog.py xfrin_messages.py xfrin_messages.pyc +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/xfrin_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ + +CLEANFILES = b10-xfrin xfrin.pyc xfrinlog.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/xfrin_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/xfrin_messages.pyc man_MANS = b10-xfrin.8 EXTRA_DIST = $(man_MANS) b10-xfrin.xml EXTRA_DIST += xfrin.spec xfrin_messages.mes +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/xfrin_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/xfrin_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/xfrin_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/xfrin_messages.py + if ENABLE_MAN b10-xfrin.8: b10-xfrin.xml @@ -22,11 +31,15 @@ b10-xfrin.8: b10-xfrin.xml endif # Define rule to build logging source files from message file -xfrin_messages.py: xfrin_messages.mes - $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/bin/xfrin/xfrin_messages.mes +$(PYTHON_LOGMSGPKG_DIR)/work/xfrin_messages.py : xfrin_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/xfrin_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/xfrin_messages.py: Makefile + echo "from work.xfrin_messages import *" > $@ # this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix -b10-xfrin: xfrin.py xfrin_messages.py +b10-xfrin: xfrin.py $(PYTHON_LOGMSGPKG_DIR)/work/xfrin_messages.py $(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" \ -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" xfrin.py >$@ chmod a+x $@ diff --git a/src/bin/xfrin/tests/Makefile.am b/src/bin/xfrin/tests/Makefile.am index 0f485aa2fd..8d2a450571 100644 --- a/src/bin/xfrin/tests/Makefile.am +++ b/src/bin/xfrin/tests/Makefile.am @@ -19,6 +19,6 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ + PYTHONPATH=$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/bin/xfrin:$(COMMON_PYTHON_PATH) \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/bin/xfrin/xfrin.py.in b/src/bin/xfrin/xfrin.py.in index 07de8f0c9e..8845b426f5 100755 --- a/src/bin/xfrin/xfrin.py.in +++ b/src/bin/xfrin/xfrin.py.in @@ -29,7 +29,7 @@ from isc.config.ccsession import * from isc.notify import notify_out import isc.util.process import isc.net.parse -from xfrin_messages import * +from isc.log_messages.xfrin_messages import * isc.log.init("b10-xfrin") logger = isc.log.Logger("xfrin") diff --git a/src/bin/xfrout/Makefile.am b/src/bin/xfrout/Makefile.am index c5492adf09..aae2e6aa4a 100644 --- a/src/bin/xfrout/Makefile.am +++ b/src/bin/xfrout/Makefile.am @@ -6,13 +6,22 @@ pkglibexec_SCRIPTS = b10-xfrout b10_xfroutdir = $(pkgdatadir) b10_xfrout_DATA = xfrout.spec -pyexec_DATA = xfrout_messages.py -CLEANFILES= b10-xfrout xfrout.pyc xfrout.spec xfrout_messages.py xfrout_messages.pyc +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/xfrout_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ + +CLEANFILES = b10-xfrout xfrout.pyc xfrout.spec +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/xfrout_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/xfrout_messages.pyc man_MANS = b10-xfrout.8 EXTRA_DIST = $(man_MANS) b10-xfrout.xml xfrout_messages.mes +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/xfrout_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/xfrout_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/xfrout_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/xfrout_messages.py + if ENABLE_MAN b10-xfrout.8: b10-xfrout.xml @@ -21,14 +30,18 @@ b10-xfrout.8: b10-xfrout.xml endif # Define rule to build logging source files from message file -xfrout_messages.py: xfrout_messages.mes - $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/bin/xfrout/xfrout_messages.mes +$(PYTHON_LOGMSGPKG_DIR)/work/xfrout_messages.py : xfrout_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/xfrout_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/xfrout_messages.py: Makefile + echo "from work.xfrout_messages import *" > $@ xfrout.spec: xfrout.spec.pre $(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" xfrout.spec.pre >$@ # this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix -b10-xfrout: xfrout.py xfrout_messages.py +b10-xfrout: xfrout.py $(PYTHON_LOGMSGPKG_DIR)/work/xfrout_messages.py $(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" \ -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" xfrout.py >$@ chmod a+x $@ diff --git a/src/bin/xfrout/tests/Makefile.am b/src/bin/xfrout/tests/Makefile.am index 2f1e2eaef5..8a643d7300 100644 --- a/src/bin/xfrout/tests/Makefile.am +++ b/src/bin/xfrout/tests/Makefile.am @@ -20,6 +20,6 @@ endif echo Running test: $$pytest ; \ chmod +x $(abs_builddir)/$$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_builddir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/util/io/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/xfrout:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/util/io/.libs \ $(PYCOVERAGE_RUN) $(abs_builddir)/$$pytest || exit ; \ done diff --git a/src/bin/xfrout/xfrout.py.in b/src/bin/xfrout/xfrout.py.in index fe42c5485b..144a1b8055 100755 --- a/src/bin/xfrout/xfrout.py.in +++ b/src/bin/xfrout/xfrout.py.in @@ -35,7 +35,7 @@ import errno from optparse import OptionParser, OptionValueError from isc.util import socketserver_mixin -from xfrout_messages import * +from isc.log_messages.xfrout_messages import * isc.log.init("b10-xfrout") logger = isc.log.Logger("xfrout") diff --git a/src/bin/zonemgr/Makefile.am b/src/bin/zonemgr/Makefile.am index 34e662276d..637b31aef5 100644 --- a/src/bin/zonemgr/Makefile.am +++ b/src/bin/zonemgr/Makefile.am @@ -6,14 +6,22 @@ pkglibexec_SCRIPTS = b10-zonemgr b10_zonemgrdir = $(pkgdatadir) b10_zonemgr_DATA = zonemgr.spec -pyexec_DATA = zonemgr_messages.py + +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/zonemgr_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ CLEANFILES = b10-zonemgr zonemgr.pyc zonemgr.spec -CLEANFILES += zonemgr_messages.py zonemgr_messages.pyc +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/zonemgr_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/zonemgr_messages.pyc man_MANS = b10-zonemgr.8 EXTRA_DIST = $(man_MANS) b10-zonemgr.xml zonemgr_messages.mes +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/zonemgr_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/zonemgr_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/zonemgr_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/zonemgr_messages.py + if ENABLE_MAN b10-zonemgr.8: b10-zonemgr.xml @@ -22,13 +30,17 @@ b10-zonemgr.8: b10-zonemgr.xml endif # Build logging source file from message files -zonemgr_messages.py: zonemgr_messages.mes - $(top_builddir)/src/lib/log/compiler/message -p $(top_srcdir)/src/bin/zonemgr/zonemgr_messages.mes +$(PYTHON_LOGMSGPKG_DIR)/work/zonemgr_messages.py : zonemgr_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/zonemgr_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/zonemgr_messages.py: Makefile + echo "from work.zonemgr_messages import *" > $@ zonemgr.spec: zonemgr.spec.pre $(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" zonemgr.spec.pre >$@ -b10-zonemgr: zonemgr.py +b10-zonemgr: zonemgr.py $(PYTHON_LOGMSGPKG_DIR)/work/zonemgr_messages.py $(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" \ -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" zonemgr.py >$@ chmod a+x $@ diff --git a/src/bin/zonemgr/tests/Makefile.am b/src/bin/zonemgr/tests/Makefile.am index 97f9b5e6ca..6e8c35b913 100644 --- a/src/bin/zonemgr/tests/Makefile.am +++ b/src/bin/zonemgr/tests/Makefile.am @@ -20,6 +20,6 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_builddir)/src/bin/zonemgr:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/zonemgr:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/bin/zonemgr/zonemgr.py.in b/src/bin/zonemgr/zonemgr.py.in index d4de6a8d14..5c8d9b54ba 100755 --- a/src/bin/zonemgr/zonemgr.py.in +++ b/src/bin/zonemgr/zonemgr.py.in @@ -37,7 +37,7 @@ from isc.datasrc import sqlite3_ds from optparse import OptionParser, OptionValueError from isc.config.ccsession import * import isc.util.process -from zonemgr_messages import * +from isc.log_messages.zonemgr_messages import * # Initialize logging for called modules. isc.log.init("b10-zonemgr") diff --git a/src/lib/python/isc/Makefile.am b/src/lib/python/isc/Makefile.am index d94100bc94..2b63da6c5b 100644 --- a/src/lib/python/isc/Makefile.am +++ b/src/lib/python/isc/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = datasrc cc config log net notify util testutils acl bind10 +SUBDIRS += log_messages python_PYTHON = __init__.py diff --git a/src/lib/python/isc/acl/tests/Makefile.am b/src/lib/python/isc/acl/tests/Makefile.am index 87781d72bc..569353ff34 100644 --- a/src/lib/python/isc/acl/tests/Makefile.am +++ b/src/lib/python/isc/acl/tests/Makefile.am @@ -19,7 +19,7 @@ if ENABLE_PYTHON_COVERAGE endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ - env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/isc/python/acl/.libs:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/isc/python/acl/.libs \ $(LIBRARY_PATH_PLACEHOLDER) \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/lib/python/isc/bind10/sockcreator.py b/src/lib/python/isc/bind10/sockcreator.py index 9fcc74e74c..8e5b019536 100644 --- a/src/lib/python/isc/bind10/sockcreator.py +++ b/src/lib/python/isc/bind10/sockcreator.py @@ -17,7 +17,7 @@ import socket import struct import os import subprocess -from bind10_messages import * +from isc.log_messages.bind10_messages import * from libutil_io_python import recv_fd logger = isc.log.Logger("boss") diff --git a/src/lib/python/isc/bind10/tests/Makefile.am b/src/lib/python/isc/bind10/tests/Makefile.am index f498b86840..0cc12ff48a 100644 --- a/src/lib/python/isc/bind10/tests/Makefile.am +++ b/src/lib/python/isc/bind10/tests/Makefile.am @@ -22,7 +22,7 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_srcdir)/src/bin:$(abs_top_builddir)/src/bin/bind10:$(abs_top_builddir)/src/lib/util/io/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_srcdir)/src/bin:$(abs_top_builddir)/src/bin/bind10:$(abs_top_builddir)/src/lib/util/io/.libs \ BIND10_MSGQ_SOCKET_FILE=$(abs_top_builddir)/msgq_socket \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/lib/python/isc/cc/tests/Makefile.am b/src/lib/python/isc/cc/tests/Makefile.am index 4e49501458..2dc6a58f38 100644 --- a/src/lib/python/isc/cc/tests/Makefile.am +++ b/src/lib/python/isc/cc/tests/Makefile.am @@ -23,7 +23,7 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \ + PYTHONPATH=$(COMMON_PYTHON_PATH) \ BIND10_TEST_SOCKET_FILE=$(builddir)/test_socket.sock \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/lib/python/isc/config/Makefile.am b/src/lib/python/isc/config/Makefile.am index 312ad3348c..62a372222e 100644 --- a/src/lib/python/isc/config/Makefile.am +++ b/src/lib/python/isc/config/Makefile.am @@ -1,27 +1,47 @@ SUBDIRS = . tests python_PYTHON = __init__.py ccsession.py cfgmgr.py config_data.py module_spec.py -pyexec_DATA = cfgmgr_messages.py $(top_builddir)/src/lib/python/config_messages.py - pythondir = $(pyexecdir)/isc/config -# Define rule to build logging source files from message file -cfgmgr_messages.py: cfgmgr_messages.mes - $(top_builddir)/src/lib/log/compiler/message \ - -p $(top_srcdir)/src/lib/python/isc/config/cfgmgr_messages.mes +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/work/cfgmgr_messages.py +BUILT_SOURCES += $(PYTHON_LOGMSGPKG_DIR)/work/config_messages.py +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/cfgmgr_messages.py +nodist_pylogmessage_PYTHON += $(PYTHON_LOGMSGPKG_DIR)/work/config_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ -$(top_builddir)/src/lib/python/config_messages.py: config_messages.mes - $(top_builddir)/src/lib/log/compiler/message \ - -p -d $(top_builddir)/src/lib/python \ - $(top_srcdir)/src/lib/python/isc/config/config_messages.mes - -CLEANFILES = cfgmgr_messages.py cfgmgr_messages.pyc -CLEANFILES += $(top_builddir)/src/lib/python/config_messages.py -CLEANFILES += $(top_builddir)/src/lib/python/config_messages.pyc +CLEANFILES = $(PYTHON_LOGMSGPKG_DIR)/work/cfgmgr_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/cfgmgr_messages.pyc +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/config_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/config_messages.pyc CLEANDIRS = __pycache__ EXTRA_DIST = cfgmgr_messages.mes config_messages.mes +BUILT_SOURCES += $(PYTHON_LOGMSGPKG_DIR)/cfgmgr_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/cfgmgr_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/cfgmgr_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/cfgmgr_messages.py + +BUILT_SOURCES += $(PYTHON_LOGMSGPKG_DIR)/config_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/config_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/config_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/config_messages.py + +# Define rule to build logging source files from message file +$(PYTHON_LOGMSGPKG_DIR)/work/cfgmgr_messages.py : cfgmgr_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/cfgmgr_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/cfgmgr_messages.py: Makefile + echo "from work.cfgmgr_messages import *" > $@ + +$(PYTHON_LOGMSGPKG_DIR)/work/config_messages.py : config_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/config_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/config_messages.py: Makefile + echo "from work.config_messages import *" > $@ + clean-local: rm -rf $(CLEANDIRS) diff --git a/src/lib/python/isc/config/ccsession.py b/src/lib/python/isc/config/ccsession.py index ba7724ce55..d07df1e3e8 100644 --- a/src/lib/python/isc/config/ccsession.py +++ b/src/lib/python/isc/config/ccsession.py @@ -43,7 +43,7 @@ from isc.util.file import path_search import bind10_config from isc.log import log_config_update import json -from config_messages import * +from isc.log_messages.config_messages import * logger = isc.log.Logger("config") diff --git a/src/lib/python/isc/config/cfgmgr.py b/src/lib/python/isc/config/cfgmgr.py index 1db9fd389f..9996a19852 100644 --- a/src/lib/python/isc/config/cfgmgr.py +++ b/src/lib/python/isc/config/cfgmgr.py @@ -32,7 +32,7 @@ from isc.config import ccsession, config_data, module_spec from isc.util.file import path_search import bind10_config import isc.log -from cfgmgr_messages import * +from isc.log_messages.cfgmgr_messages import * logger = isc.log.Logger("cfgmgr") diff --git a/src/lib/python/isc/config/tests/Makefile.am b/src/lib/python/isc/config/tests/Makefile.am index 47ccc41af3..7b48f43ad4 100644 --- a/src/lib/python/isc/config/tests/Makefile.am +++ b/src/lib/python/isc/config/tests/Makefile.am @@ -21,7 +21,7 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/python/isc/config \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/python/isc/config \ B10_TEST_PLUGIN_DIR=$(abs_top_srcdir)/src/bin/cfgmgr/plugins \ CONFIG_TESTDATA_PATH=$(abs_top_srcdir)/src/lib/config/tests/testdata \ CONFIG_WR_TESTDATA_PATH=$(abs_top_builddir)/src/lib/config/tests/testdata \ diff --git a/src/lib/python/isc/datasrc/tests/Makefile.am b/src/lib/python/isc/datasrc/tests/Makefile.am index 6f6d15731d..1a50fd3695 100644 --- a/src/lib/python/isc/datasrc/tests/Makefile.am +++ b/src/lib/python/isc/datasrc/tests/Makefile.am @@ -23,7 +23,7 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/python/isc/log \ + PYTHONPATH=:$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/python/isc/log \ TESTDATA_PATH=$(abs_srcdir)/testdata \ TESTDATA_WRITE_PATH=$(abs_builddir) \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ diff --git a/src/lib/python/isc/log/tests/Makefile.am b/src/lib/python/isc/log/tests/Makefile.am index a23887c697..8fa3746956 100644 --- a/src/lib/python/isc/log/tests/Makefile.am +++ b/src/lib/python/isc/log/tests/Makefile.am @@ -16,7 +16,7 @@ endif check-local: chmod +x $(abs_builddir)/log_console.py $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/python/isc/log \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/python/isc/log \ $(abs_srcdir)/check_output.sh $(abs_builddir)/log_console.py $(abs_srcdir)/console.out if ENABLE_PYTHON_COVERAGE touch $(abs_top_srcdir)/.coverage @@ -26,7 +26,7 @@ endif for pytest in $(PYTESTS_NOGEN) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/python/isc/log:$(abs_top_builddir)/src/lib/log/python/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/python/isc/log:$(abs_top_builddir)/src/lib/log/python/.libs \ B10_TEST_PLUGIN_DIR=$(abs_top_srcdir)/src/bin/cfgmgr/plugins \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done ; \ @@ -34,7 +34,7 @@ endif echo Running test: $$pytest ; \ chmod +x $(abs_builddir)/$$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/python/isc/log:$(abs_top_builddir)/src/lib/log/python/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/python/isc/log:$(abs_top_builddir)/src/lib/log/python/.libs \ B10_TEST_PLUGIN_DIR=$(abs_top_srcdir)/src/bin/cfgmgr/plugins \ $(PYCOVERAGE_RUN) $(abs_builddir)/$$pytest || exit ; \ done diff --git a/src/lib/python/isc/log_messages/Makefile.am b/src/lib/python/isc/log_messages/Makefile.am new file mode 100644 index 0000000000..dc060a12d8 --- /dev/null +++ b/src/lib/python/isc/log_messages/Makefile.am @@ -0,0 +1,9 @@ +SUBDIRS = work + +EXTRA_DIST = __init__.py +CLEANFILES = __init__.pyc + +CLEANDIRS = __pycache__ + +clean-local: + rm -rf $(CLEANDIRS) diff --git a/src/lib/python/isc/log_messages/README b/src/lib/python/isc/log_messages/README new file mode 100644 index 0000000000..85a2538638 --- /dev/null +++ b/src/lib/python/isc/log_messages/README @@ -0,0 +1,74 @@ +This is a placeholder package for logging messages of various modules +in the form of python scripts. This package is expected to be installed +somewhere like <top-install-dir>/python3.x/site-packages/isc/log_messages +and each message script is expected to be imported as +"isc.log_messages.some_module_messages". + +We also need to allow in-source test code to get access to the message +scripts in the same manner. That's why the package is stored in the +directory that shares the same trailing part as the install directory, +i.e., isc/log_messages. + +Furthermore, we need to support a build mode using a separate build +tree (such as in the case with 'make distcheck'). In that case if an +application (via a test script) imports "isc.log_messages.xxx", it +would try to import the module under the source tree, where the +generated message script doesn't exist. So, in the source directory +(i.e., here) we provide dummy scripts that subsequently import the +same name of module under the "work" sub-package. The caller +application is assumed to have <top_builddir>/src/lib/python/isc/log_messages +in its module search path (this is done by including +$(COMMON_PYTHON_PATH) in the PYTHONPATH environment variable), +which ensures the right directory is chosen. + +A python module or program that defines its own log messages needs to +make sure that the setup described above is implemented. It's a +complicated process, but can generally be done by following a common +pattern. The following are a sample snippet for Makefile.in for a +module named "mymodule" (which is supposed to be generated from a file +"mymodule_messages.mes"). In many cases it should work simply by +replacing 'mymodule' with the actual module name. + +==================== begin Makefile.am additions =================== +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ + +CLEANFILES = $(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.pyc + +EXTRA_DIST = mymodule_messages.mes + +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/mymodule_messages.py + +$(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.py : mymodule_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR) -p $(srcdir)/mymodule_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.py: Makefile + echo "from work.mymodule_messages import *" > $@ + +# This rule ensures mymodule_messages.py is (re)generated as a result of +# 'make'. If there's no other appropriate target, specify +# mymodule_messages.py in BUILT_SOURCES. +mymodule: <other source files> $(PYTHON_LOGMSGPKG_DIR)/mymodule_messages.py +===================== end Makefile.am additions ==================== + +Notes: +- "nodist_" prefix is important. Without this, 'make distcheck' tries + to make _messages.py before actually starting the main build, which + would fail because the message compiler isn't built yet. +- "pylogmessage" is a prefix for python scripts that define log + messages and are expected to be installed in the common isc/log_messages + directory. It's intentionally named differently from the common + "python" prefix (as in python_PYTHON), because the latter may be + used for other scripts in the same Makefile.am file. +- $(PYTHON_LOGMSGPKG_DIR) should be set to point to this directory (or + the corresponding build directory if it's different) by the + configure script. $(PYTHON_LOGMSGPKG_SRCDIR) should be set to point + to this directory by the configure script. +- The four lines starting from BUILT_SOURCES and the second make rule + are for preparing the dummy python file under the source tree. + Alternatively, you could directly add the file in this directory. diff --git a/src/lib/python/isc/log_messages/__init__.py.in b/src/lib/python/isc/log_messages/__init__.py.in new file mode 100644 index 0000000000..d222b8c0c4 --- /dev/null +++ b/src/lib/python/isc/log_messages/__init__.py.in @@ -0,0 +1,3 @@ +""" +This is an in-source forwarder package redirecting to work/* scripts. +""" diff --git a/src/lib/python/isc/log_messages/work/Makefile.am b/src/lib/python/isc/log_messages/work/Makefile.am new file mode 100644 index 0000000000..9bc5e0ff35 --- /dev/null +++ b/src/lib/python/isc/log_messages/work/Makefile.am @@ -0,0 +1,12 @@ +# .py is generated in the builddir by the configure script so that test +# scripts can refer to it when a separate builddir is used. + +python_PYTHON = __init__.py + +pythondir = $(pyexecdir)/isc/log_messages/ + +CLEANFILES = __init__.pyc +CLEANDIRS = __pycache__ + +clean-local: + rm -rf $(CLEANDIRS) diff --git a/src/lib/python/isc/log_messages/work/__init__.py.in b/src/lib/python/isc/log_messages/work/__init__.py.in new file mode 100644 index 0000000000..991f10acd4 --- /dev/null +++ b/src/lib/python/isc/log_messages/work/__init__.py.in @@ -0,0 +1,3 @@ +""" +This package is a placeholder for python scripts of log messages. +""" diff --git a/src/lib/python/isc/net/tests/Makefile.am b/src/lib/python/isc/net/tests/Makefile.am index 3a04f17b40..371df59bb5 100644 --- a/src/lib/python/isc/net/tests/Makefile.am +++ b/src/lib/python/isc/net/tests/Makefile.am @@ -19,6 +19,6 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/dns/python/.libs \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/lib/python/isc/notify/Makefile.am b/src/lib/python/isc/notify/Makefile.am index a23a1ffb4b..496c64d217 100644 --- a/src/lib/python/isc/notify/Makefile.am +++ b/src/lib/python/isc/notify/Makefile.am @@ -1,21 +1,30 @@ SUBDIRS = . tests python_PYTHON = __init__.py notify_out.py -pyexec_DATA = $(top_builddir)/src/lib/python/notify_out_messages.py - pythondir = $(pyexecdir)/isc/notify -$(top_builddir)/src/lib/python/notify_out_messages.py: notify_out_messages.mes - $(top_builddir)/src/lib/log/compiler/message \ - -p -d $(top_builddir)/src/lib/python \ - $(top_srcdir)/src/lib/python/isc/notify/notify_out_messages.mes +BUILT_SOURCES = $(PYTHON_LOGMSGPKG_DIR)/work/notify_out_messages.py +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/notify_out_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ EXTRA_DIST = notify_out_messages.mes -CLEANFILES = $(top_builddir)/src/lib/python/notify_out_messages.pyc -CLEANFILES += $(top_builddir)/src/lib/python/notify_out_messages.py +BUILT_SOURCES += $(PYTHON_LOGMSGPKG_DIR)/notify_out_messages.py +CLEANFILES = $(PYTHON_LOGMSGPKG_DIR)/notify_out_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/notify_out_messages.pyc +EXTRA_DIST += $(PYTHON_LOGMSGPKG_SRCDIR)/notify_out_messages.py + +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/notify_out_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/notify_out_messages.pyc CLEANDIRS = __pycache__ +$(PYTHON_LOGMSGPKG_DIR)/work/notify_out_messages.py : notify_out_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/notify_out_messages.mes + +$(PYTHON_LOGMSGPKG_DIR)/notify_out_messages.py: Makefile + echo "from work.notify_out_messages import *" > $@ + clean-local: rm -rf $(CLEANDIRS) diff --git a/src/lib/python/isc/notify/notify_out.py b/src/lib/python/isc/notify/notify_out.py index f1e02cab29..6b91c87d55 100644 --- a/src/lib/python/isc/notify/notify_out.py +++ b/src/lib/python/isc/notify/notify_out.py @@ -23,7 +23,7 @@ import errno from isc.datasrc import sqlite3_ds from isc.net import addr import isc -from notify_out_messages import * +from isc.log_messages.notify_out_messages import * logger = isc.log.Logger("notify_out") diff --git a/src/lib/python/isc/notify/tests/Makefile.am b/src/lib/python/isc/notify/tests/Makefile.am index 1427d93c12..b0fdb19339 100644 --- a/src/lib/python/isc/notify/tests/Makefile.am +++ b/src/lib/python/isc/notify/tests/Makefile.am @@ -18,7 +18,7 @@ if ENABLE_PYTHON_COVERAGE endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/dns/python/.libs \ $(LIBRARY_PATH_PLACEHOLDER) \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/lib/python/isc/util/tests/Makefile.am b/src/lib/python/isc/util/tests/Makefile.am index c3d35c2ac9..db44c864ff 100644 --- a/src/lib/python/isc/util/tests/Makefile.am +++ b/src/lib/python/isc/util/tests/Makefile.am @@ -19,6 +19,6 @@ endif for pytest in $(PYTESTS) ; do \ echo Running test: $$pytest ; \ $(LIBRARY_PATH_PLACEHOLDER) \ - env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/python/.libs \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/lib/dns/python/.libs \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done |