Skip to content

Commit

Permalink
Regression: ship (again) pyc files
Browse files Browse the repository at this point in the history
This was basically broken when the build process of python3-modules was fully integrated into bazel.
We now use the python interpreter from bazel to build those files and not anymore the one we ship.
At the moment we believe this is OK as:
* we're using the same python version
* we're using the checked-hash invalidation mode

Change-Id: Ife235a857a482c112c3cf142d4b9d5b7a4b6cbb2
JIRA-Ref: CMK-21242
(cherry picked from commit 32999ed)
  • Loading branch information
TimotheusBachinger committed Feb 12, 2025
1 parent a2ca87a commit ea3053f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions omd/packages/check_mk/check_mk.make
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,14 @@ $(CHECK_MK_INTERMEDIATE_INSTALL): $(SOURCE_BUILT_AGENTS) $(CHECK_MK_BUILD) $(PAC

# After installing all python modules, ensure they are compiled
# compile pyc files explicitly selecting `checked-hash` invalidation mode
$(PACKAGE_PYTHON3_MODULES_PYTHON) -m compileall \
$(BAZEL_CMD) run :venv
source .venv/bin/activate \
&& python3 -m compileall \
-f \
--invalidation-mode=checked-hash \
-s "$(CHECK_MK_INSTALL_DIR)/lib/python3" \
"$(CHECK_MK_INSTALL_DIR)/lib/python3/cmk"
"$(CHECK_MK_INSTALL_DIR)/lib/python3/cmk" \
&& deactivate

# Provide the externally documented paths for Checkmk plugins
$(MKDIR) $(CHECK_MK_INSTALL_DIR)/lib
Expand Down
10 changes: 9 additions & 1 deletion omd/packages/omd/omd.make
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ omdlib-install: $(PACKAGE_PYTHON3_MODULES_PYTHON_DEPS)
$(MKDIR) $(DESTDIR)$(OMD_ROOT)/lib/python3/omdlib
install -m 644 $(PACKAGE_DIR)/$(OMD)/omdlib/*.py $(DESTDIR)$(OMD_ROOT)/lib/python3/omdlib/
sed -i 's|###OMD_VERSION###|$(OMD_VERSION)|g' $(DESTDIR)$(OMD_ROOT)/lib/python3/omdlib/__init__.py
$(PACKAGE_PYTHON3_MODULES_PYTHON) -m py_compile $(DESTDIR)$(OMD_ROOT)/lib/python3/omdlib/*.py
# Pre-compile all python modules
$(BAZEL_CMD) run :venv
source .venv/bin/activate \
&& python3 -m compileall \
-f \
--invalidation-mode=checked-hash \
-s "$(CHECK_MK_INSTALL_DIR)/lib/python3" \
$(DESTDIR)$(OMD_ROOT)/lib/python3/omdlib/ \
&& deactivate

0 comments on commit ea3053f

Please sign in to comment.