File: release.py

package info (click to toggle)
slixmpp 1.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,520 kB
  • sloc: python: 41,715; xml: 1,197; makefile: 120
file content (38 lines) | stat: -rw-r--r-- 974 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python

"""
A small script to update the DOAP file and commit/tag it.

Usage: ./release.py 2.0.0
"""

import fileinput
import sys
from datetime import datetime
from subprocess import check_call

version = sys.argv[1]

doap_release = f"""    <release>
        <Version>
            <revision>{version}</revision>
            <created>{datetime.now():%Y-%m-%d}</created>
            <file-release rdf:resource="https://codeberg.org/poezio/slixmpp/archive/slix-{version}.tar.gz"/>
        </Version>
    </release>
</Project>"""

try:
    proud, default, shame = (int(x) for x in version.split("."))
except ValueError:
    print("Not a valid version")
    exit(1)

for line in fileinput.input(files=["doap.xml"], inplace=True):
    if line.startswith("</Project>"):
        print(doap_release)
    else:
        print(line, end="")

check_call(["git", "commit", "doap.xml", "-m", f"build: release {version}"])
check_call(["git", "tag", "-s", f"slix-{version}"])