Skip to content

Commit

Permalink
Ensure that needed configurations reaches dlite-pyembed.c
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis committed Oct 30, 2024
1 parent 01aa724 commit cdca52a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bindings/python/scripts/dlite-validate
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand Down Expand Up @@ -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())

Expand Down

0 comments on commit cdca52a

Please sign in to comment.