Jeremy C. Reed a8486dda67 [master] add some pyo (python optimized files) to CLEANFILES il y a 13 ans
..
work a8486dda67 [master] add some pyo (python optimized files) to CLEANFILES il y a 13 ans
Makefile.am 59464e665c [master] forgot CLEANFILES entry in merge of #963 il y a 13 ans
README 68cf1ccf20 [1101] updated README so that it matches the latest implementation. il y a 13 ans
__init__.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
bind10_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
cfgmgr_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
cmdctl_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
config_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
dbutil_messages.py ab56098767 [963] use logging framework for b10-dbutil il y a 13 ans
ddns_messages.py 3dbb7c077b [1451] fix module so that it is runnable il y a 13 ans
gen-forwarder.sh b6709a7001 [1101] added a helper shell script to generate dummy python scripts. il y a 13 ans
libxfrin_messages.py 519720d9c6 [1259] Log when TTLs don't match il y a 13 ans
notify_out_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
server_common_messages.py 07dd87ca1a [1643] Logging il y a 13 ans
stats_httpd_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
stats_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
xfrin_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
xfrout_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans
zonemgr_messages.py c342486980 [1101] use pre-generated forwarding .py files under log_messages srcdir il y a 13 ans

README

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 /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 /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:

1. Create the dummy script (see above) for the module and update
Makefile.am in this directory accordingly. See (and use)
a helper shell script named gen-forwarder.sh.
2. Update Makefil.am of the module that defines the log message. The
following are a sample snippet for Makefile.am 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)/work/mymodule_messages.py
pylogmessagedir = $(pyexecdir)/isc/log_messages/

CLEANFILES = $(PYTHON_LOGMSGPKG_DIR)/work/mymodule_messages.py
CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/mymodule_messages.pyc

EXTRA_DIST = mymodule_messages.mes

$(PYTHON_LOGMSGPKG_DIR)/work/mymodule_messages.py : mymodule_messages.mes
$(top_builddir)/src/lib/log/compiler/message \
-d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/mymodule_messages.mes

# 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: $(PYTHON_LOGMSGPKG_DIR)/work/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.