From: Aleš Mrázek Date: Tue, 17 Sep 2024 22:33:17 +0000 (+0200) Subject: scripts/poe-tasks: created gen-constantspy script X-Git-Tag: v6.0.9~9^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c6871ce11b079aef2f3993a6d7cdd0b68415305;p=thirdparty%2Fknot-resolver.git scripts/poe-tasks: created gen-constantspy script New script to build constants.py module using Meson. Also check that the module is the current one. --- diff --git a/pyproject.toml b/pyproject.toml index 780ba1768..3b277fb5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,6 +79,7 @@ doc-schema = { cmd = "scripts/poe-tasks/doc-schema", help = "Generate a JSON sch test = { cmd = "scripts/poe-tasks/test", help = "Run pytest unit tests" } check = { cmd = "scripts/poe-tasks/check", help = "Check that all dependencies are installed and run static code analysis" } examples = { cmd = "scripts/poe-tasks/examples", help = "Validate all configuration examples using 'kresctl validate' utility" } +gen-constantspy = { cmd = "scripts/poe-tasks/gen-constantspy", help = "Generate 'constants.py' module using Meson configured options" } gen-setuppy = { cmd = "scripts/poe-tasks/gen-setuppy", help = "Generate 'setup.py' file for backwards compatibility" } format = { cmd = "scripts/poe-tasks/format", help = "Run code formatter" } kresctl = { cmd = "scripts/poe-tasks/kresctl", help="Run kresctl utility" } diff --git a/scripts/poe-tasks/check b/scripts/poe-tasks/check index d7766c200..7acd65b71 100755 --- a/scripts/poe-tasks/check +++ b/scripts/poe-tasks/check @@ -68,6 +68,13 @@ python setup.py --help > /dev/null check_rv $? echo +# check python/knot_resolver/constants.py +echo -e "${yellow}python/knot_resolver/constants.py${reset}" +meson_setup_configure > /dev/null +diff python/knot_resolver/constants.py $build_dir/python/constants.py +check_rv $? +echo + # check that doc/_static/config.schema.json is the latest echo -e "${yellow}Checking doc/_static/config.schema.json${reset}" python -m knot_resolver.client schema | diff - doc/_static/config.schema.json @@ -82,6 +89,7 @@ else echo -e "${red}These commands might help you:${reset}" echo -e "${red}\tpoe format${reset}" echo -e "${red}\tpoe gen-setuppy${reset}" + echo -e "${red}\tpoe gen-constantspy${reset}" echo -e "${red}\tpoe doc-schema${reset}" echo -e "${red}That's not great. Could you please fix that?${reset} 😲😟" fi diff --git a/scripts/poe-tasks/gen-constantspy b/scripts/poe-tasks/gen-constantspy new file mode 100755 index 000000000..f71f15775 --- /dev/null +++ b/scripts/poe-tasks/gen-constantspy @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# ensure consistent behaviour +src_dir="$(dirname "$(realpath "$0")")" +source $src_dir/utils/_env.sh + +echo +meson_setup_configure +echo +echo ----------------------------------------------- +echo Copying constants.py module configured by Meson +echo ----------------------------------------------- +cp -v $build_dir/python/constants.py $gitroot/python/knot_resolver/constants.py +echo \ No newline at end of file