From 88ce2073e176521f6e15a52fec7b7db1f9de7129 Mon Sep 17 00:00:00 2001 From: vuori Date: Fri, 28 Dec 2018 16:30:28 +0200 Subject: [PATCH] create_pkg: autodetect version. --- create_pkg.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/create_pkg.py b/create_pkg.py index db60273..47a397a 100644 --- a/create_pkg.py +++ b/create_pkg.py @@ -1,7 +1,7 @@ # # weasel-pageant packaging script. # -# Copyright 2017 Valtteri Vuorikoski +# Copyright 2017, 2018 Valtteri Vuorikoski # # This file is part of weasel-pageant, and is free software: you can # redistribute it and/or modify it under the terms of the GNU General @@ -11,8 +11,9 @@ import sys import zipfile +import re -CURRENT_VERSION = '1.1' +CURRENT_VERSION = 'unknown' try: reltype = sys.argv[1] @@ -23,6 +24,13 @@ print('usage: create_pkg release|debug', file=sys.stderr) sys.exit(1) +# Autodetect version from the source +with open('linux/main.c', 'r') as fp: + for line in fp: + m = re.match(r'#define VERSION "([^"]+)', line) + if m: + CURRENT_VERSION = m.group(1) + manifest = [ 'COPYING', 'COPYING.PuTTY',