Skip to content

Commit 658a84a

Browse files
committed
Make make-tag.py compatible with CMake
1 parent 278f73a commit 658a84a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

make-tag.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,25 @@ def parse_tag(tag):
6262

6363
return VersionSpec(int(major), int(minor), int(build), int(rc))
6464

65-
def check_configure_ac(spec):
65+
def check_buildsystem(spec):
6666
'''
67-
Parse configure.ac and return
67+
Parse configure.ac or CMakeLists.txt and return
6868
(major, minor, build, rc)
6969
'''
7070
info = {}
7171
filename = 'configure.ac'
72+
if os.path.exists(filename):
73+
pattern = r"define\(_CLIENT_VERSION_([A-Z_]+), ([0-9a-z]+)\)"
74+
else:
75+
filename = 'CMakeLists.txt'
76+
if not os.path.exists(filename):
77+
print("No buildsystem (configure.ac or CMakeLists.txt) found", file=sys.stderr)
78+
sys.exit(1)
79+
pattern = r'set\(CLIENT_VERSION_([A-Z_]+)\s+"?([0-9a-z]+)"?\)'
80+
7281
with open(filename) as f:
7382
for line in f:
74-
m = re.match(r"define\(_CLIENT_VERSION_([A-Z_]+), ([0-9a-z]+)\)", line)
83+
m = re.match(pattern, line)
7584
if m:
7685
info[m.group(1)] = m.group(2)
7786
# check if IS_RELEASE is set
@@ -110,7 +119,7 @@ def main():
110119
sys.exit(1)
111120

112121
# Check version components against configure.ac in git tree
113-
check_configure_ac(spec)
122+
check_buildsystem(spec)
114123

115124
# Generate base message
116125
if not spec.build:

0 commit comments

Comments
 (0)