sanitize tag
build_powerbi / build-connector (push) Has been cancelled
build_powerbi / build-visual (push) Has been cancelled
build_powerbi / deploy-installers (push) Has been cancelled

This commit is contained in:
oguzhankoral
2025-05-28 14:49:11 +03:00
parent 30c2a2002c
commit b9ff8ee5f7
+7 -1
View File
@@ -3,8 +3,14 @@ import sys
import os
def sanitize_version(tag):
"""Extracts the first three numeric segments from a tag string, because PowerBI is..."""
parts = re.findall(r"\d+", tag)
return ".".join(parts[:3]) if len(parts) >= 3 else tag
def patch_connector(tag):
"""Patches the connector version within the data connector file"""
sanitized_tag = sanitize_version(tag)
pq_file = os.path.join(os.path.dirname(__file__), "src", "powerbi-data-connector", "Speckle.pq")
with open(pq_file, "r") as file:
@@ -12,7 +18,7 @@ def patch_connector(tag):
for (index, line) in enumerate(lines):
if '[Version = "3.0.0"]' in line:
lines[index] = f'[Version = "{tag}"]\n'
lines[index] = f'[Version = "{sanitized_tag}"]\n'
print(f"Patched connector version number in {pq_file}")
break