From 102628badc97c8b2a1d45d1464256a1abd6075c6 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 27 Oct 2024 11:16:05 +0100 Subject: [PATCH 1/2] Do not write warnings about behavior change --- bindings/python/scripts/dlite-validate | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bindings/python/scripts/dlite-validate b/bindings/python/scripts/dlite-validate index 8a2635e34..48fc03827 100644 --- a/bindings/python/scripts/dlite-validate +++ b/bindings/python/scripts/dlite-validate @@ -5,8 +5,23 @@ import sys import argparse import json import re +import ctypes +from ctypes.util import find_library from pathlib import Path +# Silence warning about behavior by setting environment variable +# DLITE_BEHAVIOR=OFF before importing dlite. +# This must be done at c-level outside os.environ. +clib = find_library("c") +dll = ctypes.CDLL(clib) +setenv = dll.setenv +setenv.argtypes = [ + ctypes.POINTER(ctypes.c_char), # name + ctypes.POINTER(ctypes.c_char), # value + ctypes.c_int, # overwrite +] +setenv(b"DLITE_BEHAVIOR", b"OFF", 1) + import dlite From 678893b214c77a9feae8391d142ef4b7f0d90cf9 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sun, 27 Oct 2024 11:22:13 +0100 Subject: [PATCH 2/2] Changed "behavior" to "behavior change" in warning message --- src/dlite-behavior.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dlite-behavior.c b/src/dlite-behavior.c index b6f8d0c1b..c8b6a62f5 100644 --- a/src/dlite-behavior.c +++ b/src/dlite-behavior.c @@ -128,7 +128,7 @@ int dlite_behavior_get(const char *name) const char *ver = dlite_get_version(); // current version b->value = (strcmp_semver(ver, b->version_new) >= 0) ? 1 : 0; - dlite_warnx("Behavior `%s` is not configured. " + dlite_warnx("Behavior change `%s` is not configured. " "It will be enabled by default from v%s. " "See https://sintef.github.io/dlite/user_guide/configure_behavior_changes.html for more info.", b->name, b->version_new);