diff --git a/ci/pkgtest.yaml b/ci/pkgtest.yaml index 6d6def6dac47aeff1f89bffacdf8a9d06d706144..08a53dc34ec59755a8bbaf096a84531a7eacf680 100644 --- a/ci/pkgtest.yaml +++ b/ci/pkgtest.yaml @@ -5,9 +5,9 @@ stages: # pkgbuild {{{ .pkgbuild: &pkgbuild stage: pkgbuild - tags: - - lxc - - amd64 +# tags: +# - lxc +# - amd64 before_script: - git config --global user.name CI - git config --global user.email ci@nic diff --git a/distro/tests/manager-packaging/control b/distro/tests/manager-packaging/control index 09bc0e7c056ab5739d548f77ca3c6eff802b7531..c820dbe61b78b22ab354bd1ff0ac1c73a2ec83d9 100644 --- a/distro/tests/manager-packaging/control +++ b/distro/tests/manager-packaging/control @@ -1,3 +1,8 @@ +{# Test that all packages are installed #} +Tests: dependencies.py +Tests-Directory: manager/tests/packaging/ + + {# Test that kresctl command exists and is in $PATH #} Tests: kresctl.sh Tests-Directory: manager/tests/packaging diff --git a/manager/knot_resolver_manager/__main__.py b/manager/knot_resolver_manager/__main__.py index 33151e9623c626db08823530f06af86f0ee9dd1d..e533e360b8079f8b090d32b8d6d45277c3f021b6 100644 --- a/manager/knot_resolver_manager/__main__.py +++ b/manager/knot_resolver_manager/__main__.py @@ -1,3 +1,6 @@ +# pylint: skip-file +# flake8: noqa + # throws nice syntax error on old Python versions: 0_0 # Python >= 3.6 required diff --git a/manager/tests/packaging/dependencies.py b/manager/tests/packaging/dependencies.py new file mode 100755 index 0000000000000000000000000000000000000000..20ad02d9a3711502df0bd489abdfb9e62a8b168b --- /dev/null +++ b/manager/tests/packaging/dependencies.py @@ -0,0 +1,33 @@ +#!/usr/bin/python3 + +import importlib +import importlib.util +import sys +from types import ModuleType + +import pkg_resources + +# replace imports with mocks +dummy = ModuleType("dummy") +dummy.__dict__["setup"] = lambda *args, **kwargs: None +dummy.__dict__["build"] = lambda *args, **kwargs: None +sys.modules["setuptools"] = dummy +sys.modules["build"] = dummy + +# load install_requires array from setup.py +spec = importlib.util.spec_from_file_location("setup", "manager/setup.py") +mod = importlib.util.module_from_spec(spec) +spec.loader.exec_module(mod) +install_requires = mod.install_requires + +# stip version codes +deps = set((x[: x.index(">")].lower() for x in install_requires)) + +# find out which packages are missing +installed = {pkg.key for pkg in pkg_resources.working_set} +missing = deps - installed + +# fail if there are some missing +if len(missing) > 0: + print(f"Some required packages are missing: {missing}", file=sys.stderr) + exit(1)