Skip to content

Fix stomp version checks#2718

Open
BharatDeva wants to merge 1 commit into
certtools:developfrom
BharatDeva:fix/stomp-version-check-2600
Open

Fix stomp version checks#2718
BharatDeva wants to merge 1 commit into
certtools:developfrom
BharatDeva:fix/stomp-version-check-2600

Conversation

@BharatDeva

Copy link
Copy Markdown

Description

Fixes #2600.

stomp.py 8.2.0 changed stomp.__version__ from a tuple to a string. The STOMP collector and output bots compared that value directly with tuple literals, so the version checks could fail before the bots finished initialization or connection setup.

This change adds a small shared stomp_version() helper in the STOMP mixin module. It prefers importlib.metadata.version(stomp.py), which is the stable package metadata interface, and falls back to stomp.__version__ for environments where only the module version is available. The collector and output bot now compare packaging.version.Version objects instead of comparing raw module attributes.

The fallback keeps compatibility with older tuple-style module versions while supporting newer string-style versions.

Testing

Ran locally in WSL Ubuntu with Python 3.12.3:

  • PYTHONPATH=. .venv-wsl-pr/bin/python -m pytest -o addopts= intelmq/tests/lib/test_stomp_mixin.py intelmq/tests/bots/outputs/stomp/test_output.py
    • 3 passed
  • PYTHONPATH=. .venv-wsl-pr/bin/python -m compileall -q intelmq/bots/collectors/stomp intelmq/bots/outputs/stomp intelmq/lib/mixins/stomp.py intelmq/tests/lib/test_stomp_mixin.py
    • passed
  • git diff --check origin/develop...HEAD
    • passed

Use importlib metadata and packaging.version.Version for stomp.py version checks instead of comparing stomp.__version__ directly.

stomp.py 8.2.0 changed __version__ from a tuple to a string, which made the collector and output bots fail when comparing the version with tuple literals. A shared helper keeps the version parsing in one place and falls back to the module attribute for environments where distribution metadata is unavailable.

Signed-off-by: BharatDeva <278575558+BharatDeva@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stomp.py 8.2.0+ breaks the version check in stomp bots

1 participant