Split approve file into multiple files

This commit is contained in:
Phil Nash 2013-09-27 19:01:14 +01:00
parent 345a4eab9b
commit 2f7a296897
8 changed files with 14604 additions and 14142 deletions

View file

@ -1,14 +1,29 @@
import os
import sys
import shutil
import glob
from scriptCommon import catchPath
baselinesPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/approvedResults.txt' )
filteredResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/unapprovedResults.txt' )
rootPath = os.path.join( catchPath, 'projects/SelfTest/Baselines' )
if os.path.isfile( filteredResultsPath ):
os.remove( baselinesPath )
os.rename( filteredResultsPath, baselinesPath )
if len(sys.argv) > 1:
files = [os.path.join( rootPath, f ) for f in sys.argv[1:]]
else:
print "approval file " + filteredResultsPath + " does not exist"
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 len(files) > 0:
for unapprovedFile in files:
approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile )
else:
print "no files to approve"