""" Prepare urls to refer to the tag """ import sys from pathlib import Path def main(tag: str) -> None: for style_dir in Path(__file__).parent.parent.glob('style_*'): for style_qml in (style_dir / 'styles').glob('*.qml'): with style_qml.open() as style_file: master_style = style_file.read() tag_style = master_style.replace('https://forge.chapril.org/linux_alpes/caliec/raw/branch/master/', f'https://forge.chapril.org/linux_alpes/caliec/raw/tag/{tag}/') with style_qml.open('w') as style_file: style_file.write(tag_style) if __name__ == '__main__': if len(sys.argv) != 2: print("This script needs the name of the tag") else: main(sys.argv[1])