Browse Source

45216: Copy entirety of the results folder to the log folder for archival purposes.

A. Shawn Bandy 8 years ago
parent
commit
f44ab3f171
1 changed files with 4 additions and 19 deletions
  1. 4 19
      toolset/lifecycle/post-run-tests/keep-logs.py

+ 4 - 19
toolset/lifecycle/post-run-tests/keep-logs.py

@@ -7,6 +7,7 @@
 import os
 import zipfile
 import datetime
+import shutil
 # Follows closely from:
 # http://stackoverflow.com/a/34153816
 #
@@ -37,23 +38,7 @@ for folder in os.listdir(path_in):
         print "An OSError occurred while writing to a log zip file for {0}: \
             {1}".format(file, err)
   zip_file.close()
-path__raw_in = os.path.abspath(os.path.normpath(os.path.expanduser(os.path.join( \
+path_results_in = os.path.abspath(os.path.normpath(os.path.expanduser(os.path.join( \
     os.environ['TFB_REPOPARENT'], os.environ['TFB_REPONAME'], \
-    'results/2*'))))
-for folder in os.listdir(path_raw_in):
-  if not os.path.exists(path_out):
-    os.makedirs(path_out)
-  zip_file = zipfile.ZipFile(path_out + '/' + folder + '.zip', 'w')
-# ... walk the folder structure ...
-  for root, directories, files in os.walk(os.path.join(path_raw_in, folder), 'w', \
-        zipfile.ZIP_DEFLATED):
-# ... and add to the zip file.   
-    for file in files:
-      try:
-        zip_file.write(os.path.abspath(os.path.join(root, file)), \
-            arcname=file)
-      except OSError as err:
-        print "An OSError occurred while writing to a log zip file for {0}: \
-            {1}".format(file, err)
-  zip_file.close()
-
+    'results'))))
+shutil.copytree(path_results_in, path_out + '/results')