aboutsummaryrefslogtreecommitdiffstats
path: root/tools/scripts/approve.py
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-29 19:25:29 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-29 19:25:29 +0100
commitbc524d70253a4ab2fe40c3ca3e5666e267c0a4d1 (patch)
tree1e629e7b46b1d9972a973bc93fd100bcebd395be /tools/scripts/approve.py
downloadnihil-bc524d70253a4ab2fe40c3ca3e5666e267c0a4d1.tar.gz
nihil-bc524d70253a4ab2fe40c3ca3e5666e267c0a4d1.tar.bz2
Diffstat (limited to 'tools/scripts/approve.py')
-rwxr-xr-xtools/scripts/approve.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/scripts/approve.py b/tools/scripts/approve.py
new file mode 100755
index 0000000..6d73be5
--- /dev/null
+++ b/tools/scripts/approve.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import shutil
+import glob
+from scriptCommon import catchPath
+
+rootPath = os.path.join( catchPath, 'tests/SelfTest/Baselines' )
+
+if len(sys.argv) > 1:
+ files = [os.path.join( rootPath, f ) for f in sys.argv[1:]]
+else:
+ files = glob.glob( os.path.join( rootPath, "*.unapproved.txt" ) )
+
+
+def approveFile( approvedFile, unapprovedFile ):
+ justFilename = unapprovedFile[len(rootPath)+1:]
+ if os.path.exists( unapprovedFile ):
+ if os.path.exists( approvedFile ):
+ os.remove( approvedFile )
+ os.rename( unapprovedFile, approvedFile )
+ print( "approved " + justFilename )
+ else:
+ print( "approval file " + justFilename + " does not exist" )
+
+if files:
+ for unapprovedFile in files:
+ approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile )
+else:
+ print( "no files to approve" )