--- /dev/null
+from typing import Any, Dict
+
+from setuptools import Extension
+
+
+def build(setup_kwargs: Dict[Any, Any]) -> None:
+ setup_kwargs.update(
+ {
+ "ext_modules": [
+ Extension(
+ name="knot_resolver_manager.kresd_controller.supervisord.plugin.notify",
+ sources=["knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c"],
+ ),
+ ]
+ }
+ )
+++ /dev/null
-# !!! Do not use this in production !!!!!
-# This makefile is a hack to simplify initial development
-#
-# Use variant of this instead:
-# https://docs.python.org/3/extending/building.html#building
-
-notify.so: notify.o
- gcc -shared notify.o -L/usr/local/lib -o notify.so
-
-notify.o: notifymodule.c
- gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include/python3.10 -c notifymodule.c -o notify.o
\ No newline at end of file
"Aleš Mrázek <ales.mrazek@nic.cz>"
]
+# See currently open issue about building C extensions here:
+# https://github.com/python-poetry/poetry/issues/2740
+[tool.poetry.build]
+script = "build.py"
+generate-setup-file = true
+
[tool.poetry.dependencies]
python = "^3.6.8"
aiohttp = "^3.6.12"
docs = { cmd = "scripts/docs", help = "Create HTML documentation" }
test = { shell = "env PYTHONPATH=. pytest --junitxml=unit.junit.xml --cov=knot_resolver_manager --show-capture=all tests/unit/", help = "Run tests" }
check = { cmd = "scripts/codecheck", help = "Run static code analysis" }
-format = { shell = "black knot_resolver_manager/ tests/ scripts/; isort .", help = "Run code formatter" }
+format = { shell = "black knot_resolver_manager/ tests/ scripts/ build.py; isort .", help = "Run code formatter" }
fixdeps = { shell = "poetry install; npm install; npm update", help = "Install/update dependencies according to configuration files"}
commit = { shell = "scripts/commit", help = "Invoke every single check before commiting" }
container = { cmd = "scripts/container.py", help = "Manage containers" }
line-length = 120
target_version = ['py38']
include = '\.py$'
+exclude = '''
+^/setup.py # Poetry generates it and we want to keep it unchanged
+'''
[tool.isort]
line_length=120 # corresponds to -w flag
include_trailing_comma=true # corresponds to -tc flag
skip_glob = '^((?!py$).)*$' # isort all Python files
float_to_top=true
+profile = "black"
+skip = [
+ "setup.py", # Poetry generates it and we want to keep it unchanged
+]
[tool.tox]
legacy_tox_ini = """
export PATH="$(realpath manager/.install_kresd)/sbin:$PATH"
cd manager
+echo
+echo Building Knot Resolver Manager native extensions
+echo ------------------------------------------------
+poetry build
+# copy native modules from build directory to source directory
+shopt -s globstar
+shopt -s nullglob
+for d in build/lib*; do
+ for f in "$d/"**/*.so; do
+ cp -v "$f" ${f#"$d/"}
+ done
+done
+shopt -u globstar
+shopt -u nullglob
+
+
echo
echo Knot Manager API is accessible on http://localhost:5000
echo -------------------------------------------------------