diff --git a/pykat/testing/web/web_interface.py b/pykat/testing/web/web_interface.py index b195a3277649225e46c7fb5720ed7c4d06cc5ba4..bbc4017bb731009a449b2d56f95c4e2553afeeee 100644 --- a/pykat/testing/web/web_interface.py +++ b/pykat/testing/web/web_interface.py @@ -116,25 +116,6 @@ class FinesseProcessWatcher(Thread): print "Watcher is continuing" try: - # store a copy of the kat file for future use if a nobuild is - # requested from the user. - if sys.platform == "win32": - EXE = ".exe" - else: - EXE = "" - - KAT_EXE = os.path.join(app.instance_path,"tests",str(self.process_to_watch.test_id),"build","kat" + EXE) - KAT_STORE_PATH = os.path.join(app.instance_path,"kat_store") - KAT_STORE_EXE = os.path.join(KAT_STORE_PATH,"kat_" + str(self.process_to_watch.get_version()) + EXE) - - if not os.path.exists(KAT_STORE_PATH): - os.mkdir(KAT_STORE_PATH) - - if os.path.exists(KAT_EXE): - if os.path.exists(KAT_STORE_EXE): - os.remove(KAT_STORE_EXE) - - shutil.copyfile(KAT_EXE, KAT_STORE_EXE) testdoc = db.get('testid', self.process_to_watch.test_id, @@ -202,6 +183,33 @@ class FinesseProcessWatcher(Thread): #finally update with details on the kat files ran testdoc["kats_run"] = kats_run db.update(testdoc) + + # store a copy of the kat file for future use if a nobuild is + # requested from the user. + if sys.platform == "win32": + EXE = ".exe" + else: + EXE = "" + + KAT_EXE = os.path.join(app.instance_path,"tests",str(self.process_to_watch.test_id),"build","kat" + EXE) + KAT_STORE_PATH = os.path.join(app.instance_path,"kat_store") + KAT_STORE_EXE = os.path.join(KAT_STORE_PATH,"kat_" + str(self.process_to_watch.get_version()) + EXE) + + if not os.path.exists(KAT_STORE_PATH): + os.mkdir(KAT_STORE_PATH) + + if os.path.exists(KAT_EXE): + if os.path.exists(KAT_STORE_EXE): + os.remove(KAT_STORE_EXE) + + shutil.copyfile(KAT_EXE, KAT_STORE_EXE) + + # Remove the src and lib directories from the build as they are not needed + # and take up a fair bit of space + BUILD_PATH = os.path.join(self.process_to_watch.BASE_DIR, "build") + + utils.runcmd(["rm","src","-rf"],cwd=BUILD_PATH) + utils.runcmd(["rm","lib","-rf"],cwd=BUILD_PATH) except RecordNotFound: print "Could not find database records for test id " + str(self.process_to_watch.test_id) pass