File: next_version.py

package info (click to toggle)
python3-openid 3.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,692 kB
  • sloc: python: 17,486; xml: 234; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 789 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/env python3
"""
Compute the next release version of the library, using `--major`, `--minor`,
or `--patch` arguments to determine the level at which the version is to be
incremented.
"""
import sys
from os.path import abspath, join, dirname

if __name__ == '__main__':
    sys.path.append(abspath(join(dirname(__file__), '..')))

    import openid

    major, minor, patch = openid.version_info
    pieces = None

    if '--major' in sys.argv:
        pieces = (major + 1, 0, 0)
    elif '--minor' in sys.argv:
        pieces = (major, minor + 1, 0)
    elif '--patch' in sys.argv:
        pieces = (major, minor, patch + 1)

    if pieces:
        print('.'.join(map(str, pieces)), end='')
    else:
        print('Major, minor, or patch?', file=sys.stderr)
        sys.exit(1)