File: create_tag.py

package info (click to toggle)
freezegun 1.5.1-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 344 kB
  • sloc: python: 2,114; makefile: 22
file content (22 lines) | stat: -rw-r--r-- 564 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import re


def read_version():
    with open(os.path.join('freezegun', '__init__.py')) as f:
        m = re.search(r'''__version__\s*=\s*['"]([^'"]*)['"]''', f.read())
        if m:
            return m.group(1)
        raise ValueError("couldn't find version")


def create_tag():
    from subprocess import call
    version = read_version()
    errno = call(['git', 'tag', '--annotate', version, '--message', 'Version %s' % version])
    if errno == 0:
        print("Added tag for version %s" % version)


if __name__ == '__main__':
    create_tag()