1515# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
1616# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
1717# changes)
18- CLIENT_VERSION = "1.3.40 "
18+ CLIENT_VERSION = "1.3.41 "
1919
2020# Timeout for analysis with Cppcheck in seconds
2121CPPCHECK_TIMEOUT = 30 * 60
@@ -157,14 +157,29 @@ def get_cppcheck_info(cppcheck_path):
157157 return ''
158158
159159
160- def compile_version (cppcheck_path ):
160+ def __get_cppcheck_binary (cppcheck_path ):
161161 if __make_cmd == "msbuild.exe" :
162- if os .path .isfile (os .path .join (cppcheck_path , 'bin' , 'cppcheck.exe' )):
162+ return os .path .join (cppcheck_path , 'bin' , 'cppcheck.exe' )
163+ if __make_cmd == 'mingw32-make' :
164+ return os .path .join (cppcheck_path , 'cppcheck.exe' )
165+ return os .path .join (cppcheck_path , 'cppcheck' )
166+
167+
168+ def has_binary (cppcheck_path ):
169+ cppcheck_bin = __get_cppcheck_binary (cppcheck_path )
170+ if __make_cmd == "msbuild.exe" :
171+ if os .path .isfile (cppcheck_bin ):
163172 return True
164173 elif __make_cmd == 'mingw32-make' :
165- if os .path .isfile (os . path . join ( cppcheck_path , 'cppcheck.exe' ) ):
174+ if os .path .isfile (cppcheck_bin ):
166175 return True
167- elif os .path .isfile (os .path .join (cppcheck_path , 'cppcheck' )):
176+ elif os .path .isfile (cppcheck_bin ):
177+ return True
178+ return False
179+
180+
181+ def compile_version (cppcheck_path ):
182+ if has_binary (cppcheck_path ):
168183 return True
169184 # Build
170185 ret = compile_cppcheck (cppcheck_path )
@@ -175,13 +190,19 @@ def compile_version(cppcheck_path):
175190 exclude_bin = 'cppcheck.exe'
176191 else :
177192 exclude_bin = 'cppcheck'
178- # TODO: how to support multiple compiler on the same machine? this will clean msbuild.exe files in a mingw32-make build and vice versa
193+ # TODO: how to support multiple compilers on the same machine? this will clean msbuild.exe files in a mingw32-make build and vice versa
179194 subprocess .call (['git' , 'clean' , '-f' , '-d' , '-x' , '--exclude' , exclude_bin ], cwd = cppcheck_path )
180195 return ret
181196
182197
183198def compile_cppcheck (cppcheck_path ):
184199 print ('Compiling {}' .format (os .path .basename (cppcheck_path )))
200+
201+ cppcheck_bin = __get_cppcheck_binary (cppcheck_path )
202+ # remove file so interrupted "main" branch compilation is being resumed
203+ if os .path .isfile (cppcheck_bin ):
204+ os .remove (cppcheck_bin )
205+
185206 try :
186207 if __make_cmd == 'msbuild.exe' :
187208 subprocess .check_call (['python3' , os .path .join ('tools' , 'matchcompiler.py' ), '--write-dir' , 'lib' ], cwd = cppcheck_path )
@@ -211,7 +232,9 @@ def compile_cppcheck(cppcheck_path):
211232 subprocess .check_call ([os .path .join (cppcheck_path , 'cppcheck' ), '--version' ], cwd = cppcheck_path )
212233 except Exception as e :
213234 print ('Running Cppcheck failed: {}' .format (e ))
214- # TODO: remove binary
235+ # remove faulty binary
236+ if os .path .isfile (cppcheck_bin ):
237+ os .remove (cppcheck_bin )
215238 return False
216239
217240 return True
0 commit comments