From 80077eee89e4f0aa3af5dca1a4b2b5e1665bda6f Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 18 Dec 2023 15:32:14 -0600 Subject: configdep: T5836: add boolean check whether script called as dependency --- python/vyos/configdep.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/vyos/configdep.py b/python/vyos/configdep.py index 8a28811eb..64727d355 100644 --- a/python/vyos/configdep.py +++ b/python/vyos/configdep.py @@ -107,6 +107,13 @@ def call_dependents(): f = l.pop(0) f() +def called_as_dependent() -> bool: + st = stack()[1:] + for f in st: + if f.filename == __file__: + return True + return False + def graph_from_dependency_dict(d: dict) -> dict: g = {} for k in list(d): -- cgit v1.2.3