@@ -62,16 +62,25 @@ def parse_tag(tag):
62
62
63
63
return VersionSpec (int (major ), int (minor ), int (build ), int (rc ))
64
64
65
- def check_configure_ac (spec ):
65
+ def check_buildsystem (spec ):
66
66
'''
67
- Parse configure.ac and return
67
+ Parse configure.ac or CMakeLists.txt and return
68
68
(major, minor, build, rc)
69
69
'''
70
70
info = {}
71
71
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
+
72
81
with open (filename ) as f :
73
82
for line in f :
74
- m = re .match (r"define\(_CLIENT_VERSION_([A-Z_]+), ([0-9a-z]+)\)" , line )
83
+ m = re .match (pattern , line )
75
84
if m :
76
85
info [m .group (1 )] = m .group (2 )
77
86
# check if IS_RELEASE is set
@@ -110,7 +119,7 @@ def main():
110
119
sys .exit (1 )
111
120
112
121
# Check version components against configure.ac in git tree
113
- check_configure_ac (spec )
122
+ check_buildsystem (spec )
114
123
115
124
# Generate base message
116
125
if not spec .build :
0 commit comments