From cdca52a6c0cc44b6b826b6844fcf5e9f9569f80c Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Wed, 30 Oct 2024 17:03:15 +0100 Subject: [PATCH] Ensure that needed configurations reaches dlite-pyembed.c --- bindings/python/scripts/dlite-validate | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bindings/python/scripts/dlite-validate b/bindings/python/scripts/dlite-validate index 5b0819df9..b063cc750 100644 --- a/bindings/python/scripts/dlite-validate +++ b/bindings/python/scripts/dlite-validate @@ -7,9 +7,6 @@ import json import re from pathlib import Path -DLITE_BEHAVIOR = True # Turn off warnings about behavior changes -import dlite - def parse(url, driver=None, options="mode=r", id=None): """Loads an instance from storage. @@ -23,6 +20,8 @@ def parse(url, driver=None, options="mode=r", id=None): Returns: A new instance. """ + import dlite + loc = url.split("#", 1)[0].split("?",1)[0] if driver is None: driver = Path(loc).suffix.lstrip('.').lower() @@ -103,6 +102,15 @@ def main(): args = parser.parse_args() + if not args.debug: + # Turn off DLite warnings about behavior changes + import __main__ + __main__.DLITE_BEHAVIOR = True + + # Delay importing dlite to after options are processed such that it is + # possible to configure DLite by settings variables in __main__. + import dlite + for path in args.storage_path: dlite.storage_path.append(Path(path).resolve())