Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
### Configuration

### Core
- `intelmq.bin.intelmqctl`: Use `importlib.metadata` instead of deprecated `pkg_resources` to determine the installed version, fixing bot module discovery failing on Debian 13 (PR#2721 by Sebastian Wagner, fixes #2648).

### Development

Expand All @@ -40,6 +41,7 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
- Updates to Contrib and Overview pages (PR#2672 by Sebastian Wagner).

### Packaging
- `debian/rules`: Run tests with `PYTHONPATH` pointing to the pybuild build directory, fixing the intelmq distribution not being detected during `dh_auto_test` on Debian 13 (PR#2721 by Sebastian Wagner, fixes #2675).

### Tests
- `intelmq.tests.bots.parsers.openphish.test_parser_commercial`: Replace dummy key with more obvious dummy key, generate raw from input (PR#2665 by Sebastian Wagner, fixes #2663).
Expand Down
8 changes: 8 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ override_dh_auto_build:
dh_auto_build
# $(MAKE) docs

override_dh_auto_test:
# https://github.com/certtools/intelmq/issues/2675
# on Debian 13's pybuild-driven dh_auto_test, the package's installed metadata (entry points / distribution info) isn't visible to the test run, since it happens against a build-dir copy without the source tree's egg-info on PYTHONPATH.
# make sure the build directory (which does contain the generated egg-info) is importable, fixing distribution/entry-point discovery
PYBUILD_SYSTEM=custom \
PYBUILD_TEST_ARGS="cd {build_dir}; PYTHONPATH={build_dir} python{version} -m pytest --no-cov intelmq/tests/" \
dh_auto_test

override_dh_auto_install: $(BOTDOCS)
sed -i -e '/#!\/usr\/bin\//d' intelmq/bin/*.py
sed -i -f debian/sedfile intelmq/etc/* setup.py contrib/logrotate/intelmq contrib/logcheck/logcheck.logfiles
Expand Down
12 changes: 8 additions & 4 deletions intelmq/bin/intelmqctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
import traceback
import time

import pkg_resources
from ruamel.yaml import YAML

try:
from importlib.metadata import version as _pkg_version, PackageNotFoundError
except ImportError: # pragma: no cover
from importlib_metadata import version as _pkg_version, PackageNotFoundError

from intelmq import (DEFAULT_LOGGING_LEVEL, # noqa: F401
HARMONIZATION_CONF_FILE,
RUNTIME_CONF_FILE, VAR_RUN_PATH, STATE_FILE_PATH,
Expand Down Expand Up @@ -127,10 +131,10 @@ def __init__(self, interactive: bool = False, returntype: ReturnType = ReturnTyp

APPNAME = "intelmqctl"
try:
VERSION = pkg_resources.get_distribution("intelmq").version
except pkg_resources.DistributionNotFound: # pragma: no cover
VERSION = _pkg_version("intelmq")
except PackageNotFoundError: # pragma: no cover
# can only happen in interactive mode
self._logger.error('No valid IntelMQ installation found: DistributionNotFound')
self._logger.error('No valid IntelMQ installation found: PackageNotFoundError')
sys.exit(1)
DESCRIPTION = """
description: intelmqctl is the tool to control intelmq system.
Expand Down
Loading