Utilitaire pour changer les urls avant un tag
This commit is contained in:
parent
b823b462b0
commit
3e501eb0d4
24
utilitaires/prepare_tag.py
Normal file
24
utilitaires/prepare_tag.py
Normal 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])
|
Loading…
Reference in New Issue
Block a user