diff options
| author | brad kittenbrink <brad@lindenlab.com> | 2009-09-30 18:57:00 -0700 | 
|---|---|---|
| committer | brad kittenbrink <brad@lindenlab.com> | 2009-09-30 18:57:00 -0700 | 
| commit | 292aecbb3e14658c470978efeb7cd790ec156fd2 (patch) | |
| tree | c81975b7ccacccddf6cd4ccb07bdfdf278a8b042 | |
| parent | 0c0b59e10473159de0dc2a5ed899e01ee46b4d7a (diff) | |
Updated test_win32_manifest.py to throw custom exception objects, rather than relying on string comparison.
| -rw-r--r-- | indra/lib/python/indra/util/test_win32_manifest.py | 23 | ||||
| -rwxr-xr-x | indra/newview/viewer_manifest.py | 8 | 
2 files changed, 24 insertions, 7 deletions
| diff --git a/indra/lib/python/indra/util/test_win32_manifest.py b/indra/lib/python/indra/util/test_win32_manifest.py index 75473ff55f..0a2ebc48d4 100644 --- a/indra/lib/python/indra/util/test_win32_manifest.py +++ b/indra/lib/python/indra/util/test_win32_manifest.py @@ -33,6 +33,21 @@ import sys, os  import tempfile  from xml.dom.minidom import parse +class AssemblyTestException(Exception): +    pass + +class NoManifestException(AssemblyTestException): +    pass + +class MultipleBindingsException(AssemblyTestException): +    pass + +class UnexpectedVersionException(AssemblyTestException): +    pass + +class NoMatchingAssemblyException(AssemblyTestException): +    pass +  def get_HKLM_registry_value(key_str, value_str):      import _winreg      reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) @@ -81,7 +96,7 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver):      mt_result = os.system(system_call)      if mt_result == 31:          print "No manifest found in %s" % src_filename -        raise Exception("No manifest found") +        raise NoManifestException()      manifest_dom = parse(tmp_file_name)      nodes = manifest_dom.getElementsByTagName('assemblyIdentity') @@ -93,19 +108,19 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver):      if len(versions) == 0:          print "No matching assemblies found in %s" % src_filename -        raise Exception("No matching assembly") +        raise NoMatchingAssemblyException()      elif len(versions) > 1:          print "Multiple bindings to %s found:" % assembly_name          print versions          print  -        raise Exception("Multiple bindings") +        raise MultipleBindingsException(versions)      elif versions[0] != assembly_ver:          print "Unexpected version found for %s:" % assembly_name          print "Wanted %s, found %s" % (assembly_ver, versions[0])          print -        raise Exception("Unexpected version") +        raise UnexpectedVersionException(assembly_ver, versions[0])      os.remove(tmp_file_name) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 579bfaa4d9..bda81a505d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -187,6 +187,7 @@ class WindowsManifest(ViewerManifest):          # This is used to test that no manifest for the msvcrt exists.          # It is used as a temporary override during the construct method          from test_win32_manifest import test_assembly_binding +        from test_win32_manifest import NoManifestException, NoMatchingAssemblyException          if src and (os.path.exists(src) or os.path.islink(src)):              # ensure that destination path exists              self.cmakedirs(os.path.dirname(dst)) @@ -198,9 +199,10 @@ class WindowsManifest(ViewerManifest):                      else:                          test_assembly_binding(src, "Microsoft.VC80.CRT", "")                      raise Exception("Unknown condition") -                except Exception, err: -                    if err.message != "No matching assembly" or err.message != "No manifest found": -                        raise Exception("Found unexpected MSVCRT manifest binding") +                except NoManifestException, err: +                    pass +                except NoMatchingAssemblyException, err: +                    pass                  self.ccopy(src,dst)              else: | 
