From 3c46728bb86e72e0de4e9fc18babb7a993c6e7c8 Mon Sep 17 00:00:00 2001 From: Christopher Peterson Sauer Date: Sat, 14 Jan 2023 02:37:37 -0800 Subject: [PATCH] Small simplification of header path for file flag. (This code section likely to be replaced later, though.) --- refresh.template.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/refresh.template.py b/refresh.template.py index 7fd5516..72c4c03 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -871,10 +871,10 @@ def _get_commands(target: str, flags: str): if file_path.endswith(_get_files.source_extensions): target_statment = f"inputs('{re.escape(file_path)}', {target_statment})" else: - # For header file we try to find from hdrs and srcs to get the targets + # For header files we try to find from hdrs and srcs to get the targets # Since attr function can't query with full path, get the file name to query - head, tail = os.path.split(file_path) - target_statment = f"let v = {target_statment} in attr(hdrs, '{tail}', $v) + attr(srcs, '{tail}', $v)" + fname = os.path.basename(file_path) + target_statment = f"let v = {target_statment} in attr(hdrs, '{fname}', $v) + attr(srcs, '{fname}', $v)" aquery_args = [ 'bazel', 'aquery',