From fdb0e001f70f40267fa5b42e2d97b7128918b5ad Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 11 Oct 2012 19:01:49 -0400
Subject: [PATCH] Use viewer_manifest.py magic to rename embedded html dir to
 html.old. Previous attempt at this same feat copied "*/html" and then
 iterated through every such directory in the copy-target space, renaming each
 individually with os.rename(). Richard kindly pointed out that it can be done
 more simply by using a viewer_manifest.py feature permitting wildcards even
 in dst= args.

---
 indra/newview/viewer_manifest.py | 34 +++++++-------------------------
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 4f1b58dfcbc..96b14413ae9 100644
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -28,10 +28,7 @@
 """
 import sys
 import os.path
-import errno
-import glob
 import re
-import shutil
 import tarfile
 import time
 import random
@@ -134,35 +131,18 @@ def construct(self):
                     self.path("*/*.xml")
 
                     # Local HTML files (e.g. loading screen)
-                    if self.prefix(src="*/html"):
+                    # The claim is that we never use local html files any
+                    # longer. But rather than commenting out this block, let's
+                    # rename every html subdirectory as html.old. That way, if
+                    # we're wrong, a user actually does have the relevant
+                    # files; s/he just needs to rename every html.old
+                    # directory back to html to recover them.
+                    if self.prefix(src="*/html", dst="*/html.old"):
                             self.path("*.png")
                             self.path("*/*/*.html")
                             self.path("*/*/*.gif")
                             self.end_prefix("*/html")
 
-                    # The claim is that we never use local html files any
-                    # longer. But rather than commenting out the "*/html"
-                    # block above, let's rename every html subdirectory we
-                    # copied as html.old. That way, if we're wrong, a user
-                    # actually does have the relevant files; s/he just needs
-                    # to rename every html.old directory back to html to
-                    # recover them. (Possibly I could accomplish the rename
-                    # with clever use of self.prefix(), but the leading "*"
-                    # perplexes me.)
-                    for htmldir in glob.glob(os.path.join(self.get_dst_prefix(), "*", "html")):
-                        htmlold = htmldir + ".old"
-                        print "Renaming %r => %r" % (htmldir, os.path.basename(htmlold))
-                        try:
-                            os.rename(htmldir, htmlold)
-                        except OSError, err:
-                            if err.errno != errno.ENOTEMPTY:
-                                raise
-                            # If we already have a directory by that name and
-                            # it's not empty, remove it and retry.
-                            shutil.rmtree(htmlold)
-                            # If it still blows up, let the exception propagate.
-                            os.rename(htmldir, htmlold)
-
                     self.end_prefix("skins")
 
             # local_assets dir (for pre-cached textures)
-- 
GitLab