Utilitaire pour changer les urls avant un tag

This commit is contained in:
Jacky Volpes 2021-09-01 16:18:55 +02:00
parent b823b462b0
commit 3e501eb0d4
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
"""
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])