From f2aa5c5db6c8522b9f419ab1c498b427a320e527 Mon Sep 17 00:00:00 2001 From: James McCorrie Date: Mon, 6 Apr 2026 15:37:10 +0100 Subject: [PATCH] fix: lint flow The JobSpec requires the commit attribute, however it's only available on the SimCfg at the moment. Move the commit hash attributes to to FlowCfg base class as it's required for all flows. Signed-off-by: James McCorrie --- src/dvsim/flow/base.py | 7 +++++++ src/dvsim/sim/flow.py | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dvsim/flow/base.py b/src/dvsim/flow/base.py index 149fec5b..43b05359 100644 --- a/src/dvsim/flow/base.py +++ b/src/dvsim/flow/base.py @@ -26,6 +26,7 @@ rm_path, subst_wildcards, ) +from dvsim.utils.git import git_commit_hash if TYPE_CHECKING: from dvsim.job.deploy import Deploy @@ -160,6 +161,12 @@ def __init__(self, flow_cfg_file, hjson_data, args, mk_config) -> None: # Configure the report path for instrumentation instrumentation.set_report_path(reports_dir / "metrics.json") + # After initialisation & expansion, save some useful revision metadata + proj_root = Path(self.proj_root) + + self.commit = git_commit_hash(path=proj_root, short=False) + self.commit_short = git_commit_hash(path=proj_root, short=True) + # Run any final checks self._post_init() diff --git a/src/dvsim/sim/flow.py b/src/dvsim/sim/flow.py index 909b3798..fe9e0fac 100644 --- a/src/dvsim/sim/flow.py +++ b/src/dvsim/sim/flow.py @@ -44,7 +44,7 @@ from dvsim.tool.utils import get_sim_tool_plugin from dvsim.utils import TS_FORMAT, rm_path from dvsim.utils.fs import relative_to -from dvsim.utils.git import git_commit_hash, git_https_url_with_commit +from dvsim.utils.git import git_https_url_with_commit __all__ = ("SimCfg",) @@ -176,11 +176,6 @@ def __init__(self, flow_cfg_file, hjson_data, args, mk_config) -> None: super().__init__(flow_cfg_file, hjson_data, args, mk_config) - # After initialisation & expansion, save some useful revision metadata - proj_root = Path(self.proj_root) - self.commit = git_commit_hash(path=proj_root, short=False) - self.commit_short = git_commit_hash(path=proj_root, short=True) - def _expand(self) -> None: # Choose a wave format now. Note that this has to happen after parsing # the configuration format because our choice might depend on the