Skip to content

Commit

Permalink
small script to build all database pickles from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangWaltenberger committed Jan 17, 2024
1 parent 5df156b commit 14e80a1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions unittests/buildPickles.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 14e80a1

Please sign in to comment.