This is an automated email from the ASF dual-hosted git repository.
brile pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid-website-src.git
The following commit(s) were added to refs/heads/master by this push:
new 80b5ecc0f infra: update copy druid script for escaped druid version
var (#519)
80b5ecc0f is described below
commit 80b5ecc0f7e488dfb977f5504e33b543c707a77f
Author: 317brian <[email protected]>
AuthorDate: Wed Mar 5 11:20:48 2025 -0800
infra: update copy druid script for escaped druid version var (#519)
* infra: update copy druid scripot
* update regex to catch more things
---------
Co-authored-by: Victoria Lim <[email protected]>
---
scripts/copy_druid_docs.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/scripts/copy_druid_docs.py b/scripts/copy_druid_docs.py
index 9f22d13d7..7886ea2ca 100755
--- a/scripts/copy_druid_docs.py
+++ b/scripts/copy_druid_docs.py
@@ -1,6 +1,7 @@
import os
import shutil
import subprocess
+import re
"""
copy_druid_docs.py does the following:
@@ -20,6 +21,7 @@ To use this as a standalone script, call it like:
python copy_druid_docs.py -v 26.0.0
"""
+
druid_variable = "{{DRUIDVERSION}}"
def check_source(source_directory):
@@ -57,13 +59,15 @@ def check_source(source_directory):
def replace_text_in_file(destination_directory, druid_version):
"""
- Find/replace {{DRUIDVERSION}} with the actual version
+ Find/replace actual Druid version for these placeholders
+ "{{DRUIDVERSION}}", "\{\{DRUIDVERSION}}", "\{DRUIDVERSION}",
"\{{DRUIDVERSION}}", "\{DRUIDVERSION}}"
"""
-
with open(destination_directory, 'r') as file:
file_content = file.read()
- modified_content = file_content.replace(druid_variable, druid_version)
+
+ pattern = r"([\\{]*)DRUIDVERSION([\\}]*)"
+ modified_content = re.sub(pattern, druid_version, file_content)
with open(destination_directory, 'w') as file:
file.write(modified_content)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]