hussain-s commented on code in PR #743:
URL: https://github.com/apache/burr/pull/743#discussion_r3115205293


##########
scripts/apache_release.py:
##########
@@ -119,6 +122,262 @@ def _run_command(
         _fail(f"{error_message}{error_detail}")
 
 
+def _render_template(template_name: str, context: dict[str, Any]) -> str:
+    """Render a template with Jinja2 if available, or a simple placeholder 
fallback."""
+    template_path = TEMPLATES_DIR / template_name
+
+    if not template_path.exists():
+        _fail(f"Template not found: {template_path}")
+
+    try:
+        from jinja2 import Environment, FileSystemLoader, StrictUndefined
+
+        environment = Environment(
+            loader=FileSystemLoader(str(TEMPLATES_DIR)),
+            autoescape=False,
+            keep_trailing_newline=True,
+            trim_blocks=True,
+            lstrip_blocks=True,
+            undefined=StrictUndefined,
+        )
+        return environment.get_template(template_name).render(**context)
+    except ImportError:
+        content = template_path.read_text(encoding="utf-8")
+        for key, value in context.items():
+            content = re.sub(
+                r"{{\s*" + re.escape(key) + r"\s*}}",
+                lambda _match, replacement=str(value): replacement,
+                content,
+            )
+        return re.sub(r"{#.*?#}\n?", "", content, flags=re.DOTALL)
+
+
+def _copy_to_clipboard(content: str) -> bool:
+    """Copy content to the system clipboard when a known clipboard tool 
exists."""
+    clipboard_commands = [
+        ["pbcopy"],
+        ["xclip", "-selection", "clipboard"],
+        ["xsel", "--clipboard", "--input"],
+        ["clip"],

Review Comment:
   added system name as inline comment in next revision.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to