From 14e80a11eab73bb5bd382a9d102785c954c342be Mon Sep 17 00:00:00 2001 From: Wolfgang Waltenberger Date: Wed, 17 Jan 2024 20:28:25 +0100 Subject: [PATCH] small script to build all database pickles from scratch --- unittests/buildPickles.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 unittests/buildPickles.py diff --git a/unittests/buildPickles.py b/unittests/buildPickles.py new file mode 100755 index 000000000..10fceccef --- /dev/null +++ b/unittests/buildPickles.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import glob, shutil, os + +def rmOldPickles(): + files = glob.glob ( "**/*.pcl", recursive=True ) + files += glob.glob ( "**/.*.pcl", recursive=True ) + for f in files: + if not "notebookTests" in f: + print ( f"[buildPickles] rm {f}" ) + os.unlink ( f ) + +def buildDatabases(): + from smodels.experiment.databaseObj import Database + versionfiles = glob.glob ( "*/version" ) + for versionfile in versionfiles: + dbpath = versionfile.replace("/version","") + print ( dbpath ) + try: + db = Database ( dbpath ) + except Exception as e: + print ( f"error: {e}" ) + +if __name__ == "__main__": + rmOldPickles() + buildDatabases()