This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new 76fea82 Move substitution formatting to the analysis module
76fea82 is described below
commit 76fea82e7edbcb00bb9a4dea223ad8c1225795ad
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Mar 21 16:17:01 2025 +0200
Move substitution formatting to the analysis module
---
atr/analysis.py | 8 ++++++++
atr/routes/files.py | 9 +--------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/atr/analysis.py b/atr/analysis.py
index a5ae1a6..19c6c50 100755
--- a/atr/analysis.py
+++ b/atr/analysis.py
@@ -380,6 +380,14 @@ def print_data(analysis: Analysis) -> None:
sys.stdout.flush()
+def substitutions_format(substitutions: dict[str, list[str]]) -> str:
+ subs = []
+ for key, values in substitutions.items():
+ if values:
+ subs.append(f"{key.upper()}: {', '.join(values)}")
+ return ", ".join(subs)
+
+
def variant_pattern() -> str:
# .bin can also be an EXT
# For example in opennlp
diff --git a/atr/routes/files.py b/atr/routes/files.py
index 4e30497..53dc083 100644
--- a/atr/routes/files.py
+++ b/atr/routes/files.py
@@ -218,14 +218,7 @@ async def root_files_list(session: CommitterSession,
project_name: str, version_
}
template, substitutions = analysis.filename_parse(path, elements)
path_templates[path] = template
- subs = []
- for key, values in substitutions.items():
- if values:
- subs.append(f"{key.upper()}: {', '.join(values)}")
- if subs:
- path_substitutions[path] = ", ".join(subs)
- else:
- path_substitutions[path] = "none"
+ path_substitutions[path] =
analysis.substitutions_format(substitutions) or "none"
search = re.search(analysis.extension_pattern(), path)
if search:
if search.group("artifact"):
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]