diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 900e9f7b1bdc79f4e0b40f10a5dcd469d7337530..d021e5b9f363abd604f71bffd532d7511effb4fb 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -61,7 +61,7 @@ def construct(self):
         self.path(src="../../etc/message.xml", dst="app_settings/message.xml")
 
         if self.is_packaging_viewer():
-            if self.prefix(src="app_settings"):
+            with self.prefix(src="app_settings"):
                 self.exclude("logcontrol.xml")
                 self.exclude("logcontrol-dev.xml")
                 self.path("*.pem")
@@ -84,9 +84,8 @@ def construct(self):
             
                 # ... and the included spell checking dictionaries
                 pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
-                if self.prefix(src=pkgdir,dst=""):
+                with self.prefix(src=pkgdir,dst=""):
                     self.path("dictionaries")
-                    self.end_prefix(pkgdir)
 
                 # include the extracted packages information (see BuildPackagesInfo.cmake)
                 self.path(src=os.path.join(self.args['build'],"packages-info.txt"), dst="packages-info.txt")
@@ -129,24 +128,21 @@ def construct(self):
                                  "settings_install.xml",
                                  src="environment")
 
-                self.end_prefix("app_settings")
 
-            if self.prefix(src="character"):
+            with self.prefix(src="character"):
                 self.path("*.llm")
                 self.path("*.xml")
                 self.path("*.tga")
-                self.end_prefix("character")
 
             # Include our fonts
-            if self.prefix(src="fonts"):
+            with self.prefix(src="fonts"):
                 self.path("*.ttf")
                 self.path("*.txt")
-                self.end_prefix("fonts")
 
             # skins
-            if self.prefix(src="skins"):
+            with self.prefix(src="skins"):
                     # include the entire textures directory recursively
-                    if self.prefix(src="*/textures"):
+                    with self.prefix(src="*/textures"):
                             self.path("*/*.tga")
                             self.path("*/*.j2c")
                             self.path("*/*.jpg")
@@ -156,7 +152,6 @@ def construct(self):
                             self.path("*.jpg")
                             self.path("*.png")
                             self.path("textures.xml")
-                            self.end_prefix("*/textures")
                     self.path("*/xui/*/*.xml")
                     self.path("*/xui/*/widgets/*.xml")
                     self.path("*/*.xml")
@@ -168,19 +163,16 @@ def construct(self):
                     # 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"):
+                    with self.prefix(src="*/html", dst="*/html.old"):
                             self.path("*.png")
                             self.path("*/*/*.html")
                             self.path("*/*/*.gif")
-                            self.end_prefix("*/html")
 
-                    self.end_prefix("skins")
 
             # local_assets dir (for pre-cached textures)
-            if self.prefix(src="local_assets"):
+            with self.prefix(src="local_assets"):
                 self.path("*.j2c")
                 self.path("*.tga")
-                self.end_prefix("local_assets")
 
             # File in the newview/ directory
             self.path("gpu_table.txt")
@@ -377,19 +369,17 @@ def construct(self):
             self.path2basename(vmpdir,"InstallerUserMessage.py")
 
             #VMP  Tkinter icons
-            if self.prefix("vmp_icons"):
+            with self.prefix("vmp_icons"):
                 self.path("*.png")
                 self.path("*.gif")
-                self.end_prefix("vmp_icons")
 
             #before, we only needed llbase at build time.  With VMP, we need it at run time.
             llbase_path = os.path.join(self.get_dst_prefix(),'llbase')
             if not os.path.exists(llbase_path):
                 os.makedirs(llbase_path)
-            if self.prefix(dst="llbase"):
+            with self.prefix(dst="llbase"):
                 self.path2basename(llbasedir,"*.py")
                 self.path2basename(llbasedir,"_cllsd.so")
-                self.end_prefix()
 
         # Plugin host application
         self.path2basename(os.path.join(os.pardir,
@@ -397,7 +387,7 @@ def construct(self):
                            "slplugin.exe")
         
         # Get shared libs from the shared libs staging directory
-        if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', self.args['configuration']),
+        with self.prefix(src=os.path.join(os.pardir, 'sharedlibs', self.args['configuration']),
                        dst=""):
 
             # Get llcommon and deps. If missing assume static linkage and continue.
@@ -466,31 +456,27 @@ def construct(self):
             except:
                 print "Skipping libtcmalloc_minimal.dll"
 
-            self.end_prefix()
 
         self.path(src="licenses-win32.txt", dst="licenses.txt")
         self.path("featuretable.txt")
         self.path("ca-bundle.crt")
 
         # Media plugins - CEF
-        if self.prefix(src='../media_plugins/cef/%s' % self.args['configuration'], dst="llplugin"):
+        with self.prefix(src='../media_plugins/cef/%s' % self.args['configuration'], dst="llplugin"):
             self.path("media_plugin_cef.dll")
-            self.end_prefix()
 
         # Media plugins - LibVLC
-        if self.prefix(src='../media_plugins/libvlc/%s' % self.args['configuration'], dst="llplugin"):
+        with self.prefix(src='../media_plugins/libvlc/%s' % self.args['configuration'], dst="llplugin"):
             self.path("media_plugin_libvlc.dll")
-            self.end_prefix()
 
         # Media plugins - Example (useful for debugging - not shipped with release viewer)
         if self.channel_type() != 'release':
-            if self.prefix(src='../media_plugins/example/%s' % self.args['configuration'], dst="llplugin"):
+            with self.prefix(src='../media_plugins/example/%s' % self.args['configuration'], dst="llplugin"):
                 self.path("media_plugin_example.dll")
-                self.end_prefix()
 
         # CEF runtime files - debug
         if self.args['configuration'].lower() == 'debug':
-            if self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'debug'), dst="llplugin"):
+            with self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'debug'), dst="llplugin"):
                 self.path("chrome_elf.dll")
                 self.path("d3dcompiler_43.dll")
                 self.path("d3dcompiler_47.dll")
@@ -501,10 +487,9 @@ def construct(self):
                 self.path("natives_blob.bin")
                 self.path("snapshot_blob.bin")
                 self.path("widevinecdmadapter.dll")
-                self.end_prefix()
         else:
         # CEF runtime files - not debug (release, relwithdebinfo etc.)
-            if self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'release'), dst="llplugin"):
+            with self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'release'), dst="llplugin"):
                 self.path("chrome_elf.dll")
                 self.path("d3dcompiler_43.dll")
                 self.path("d3dcompiler_47.dll")
@@ -515,25 +500,22 @@ def construct(self):
                 self.path("natives_blob.bin")
                 self.path("snapshot_blob.bin")
                 self.path("widevinecdmadapter.dll")
-                self.end_prefix()
 
         # MSVC DLLs needed for CEF and have to be in same directory as plugin
-        if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', 'Release'), dst="llplugin"):
+        with self.prefix(src=os.path.join(os.pardir, 'sharedlibs', 'Release'), dst="llplugin"):
             self.path("msvcp120.dll")
             self.path("msvcr120.dll")
-            self.end_prefix()
 
         # CEF files common to all configurations
-        if self.prefix(src=os.path.join(os.pardir, 'packages', 'resources'), dst="llplugin"):
+        with self.prefix(src=os.path.join(os.pardir, 'packages', 'resources'), dst="llplugin"):
             self.path("cef.pak")
             self.path("cef_100_percent.pak")
             self.path("cef_200_percent.pak")
             self.path("cef_extensions.pak")
             self.path("devtools_resources.pak")
             self.path("icudtl.dat")
-            self.end_prefix()
 
-        if self.prefix(src=os.path.join(os.pardir, 'packages', 'resources', 'locales'), dst=os.path.join('llplugin', 'locales')):
+        with self.prefix(src=os.path.join(os.pardir, 'packages', 'resources', 'locales'), dst=os.path.join('llplugin', 'locales')):
             self.path("am.pak")
             self.path("ar.pak")
             self.path("bg.pak")
@@ -587,13 +569,11 @@ def construct(self):
             self.path("vi.pak")
             self.path("zh-CN.pak")
             self.path("zh-TW.pak")
-            self.end_prefix()
 
-            if self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'release'), dst="llplugin"):
+            with self.prefix(src=os.path.join(os.pardir, 'packages', 'bin', 'release'), dst="llplugin"):
                 self.path("libvlc.dll")
                 self.path("libvlccore.dll")
                 self.path("plugins/")
-                self.end_prefix()
 
         # pull in the crash logger and updater from other projects
         # tag:"crash-logger" here as a cue to the exporter
@@ -796,14 +776,14 @@ def construct(self):
         chardetdir = os.path.join(pkgdir, "lib", "python", "chardet")
         idnadir = os.path.join(pkgdir, "lib", "python", "idna")
 
-        if self.prefix(src="", dst="Contents"):  # everything goes in Contents
+        with self.prefix(src="", dst="Contents"):  # everything goes in Contents
             self.path("Info.plist", dst="Info.plist")
 
             # copy additional libs in <bundle>/Contents/MacOS/
             self.path(os.path.join(relpkgdir, "libndofdev.dylib"), dst="Resources/libndofdev.dylib")
             self.path(os.path.join(relpkgdir, "libhunspell-1.3.0.dylib"), dst="Resources/libhunspell-1.3.0.dylib")   
 
-            if self.prefix(dst="MacOS"):              
+            with self.prefix(dst="MacOS"):              
                 #this copies over the python wrapper script, associated utilities and required libraries, see SL-321, SL-322, SL-323
                 self.path2basename(vmpdir,"SL_Launcher")
                 self.path2basename(vmpdir,"*.py")
@@ -811,52 +791,44 @@ def construct(self):
                 certifi_path = os.path.join(self.get_dst_prefix(),'certifi')
                 if not os.path.exists(certifi_path):
                     os.makedirs(certifi_path)
-                if self.prefix(dst="certifi"):
+                with self.prefix(dst="certifi"):
                     self.path2basename(os.path.join(vmpdir,"certifi"),"*")
-                    self.end_prefix()                   
                 # llbase provides our llrest service layer and llsd decoding
                 llbase_path = os.path.join(self.get_dst_prefix(),'llbase')
                 if not os.path.exists(llbase_path):
                     os.makedirs(llbase_path)
-                if self.prefix(dst="llbase"):
+                with self.prefix(dst="llbase"):
                     self.path2basename(llbasedir,"*.py")
                     self.path2basename(llbasedir,"_cllsd.so")
-                    self.end_prefix()
                 #requests module needed by llbase/llrest.py
                 #this is only needed on POSIX, because in Windows we compile it into the EXE
                 requests_path = os.path.join(self.get_dst_prefix(),'requests')
                 if not os.path.exists(requests_path):
                     os.makedirs(requests_path)
-                if self.prefix(dst="requests"):
+                with self.prefix(dst="requests"):
                     self.path2basename(requestsdir,"*")
-                    self.end_prefix()                   
                 urllib3_path = os.path.join(self.get_dst_prefix(),'urllib3')
                 if not os.path.exists(urllib3_path):
                     os.makedirs(urllib3_path)
-                if self.prefix(dst="urllib3"):
+                with self.prefix(dst="urllib3"):
                     self.path2basename(urllib3dir,"*")
-                    self.end_prefix()                   
                 chardet_path = os.path.join(self.get_dst_prefix(),'chardet')
                 if not os.path.exists(chardet_path):
                     os.makedirs(chardet_path)
-                if self.prefix(dst="chardet"):
+                with self.prefix(dst="chardet"):
                     self.path2basename(chardetdir,"*")
-                    self.end_prefix()                   
                 idna_path = os.path.join(self.get_dst_prefix(),'idna')
                 if not os.path.exists(idna_path):
                     os.makedirs(idna_path)
-                if self.prefix(dst="idna"):
+                with self.prefix(dst="idna"):
                     self.path2basename(idnadir,"*")
-                    self.end_prefix()                   
-                self.end_prefix()         
 
             # most everything goes in the Resources directory
-            if self.prefix(src="", dst="Resources"):
+            with self.prefix(src="", dst="Resources"):
                 super(DarwinManifest, self).construct()
 
-                if self.prefix("cursors_mac"):
+                with self.prefix("cursors_mac"):
                     self.path("*.tif")
-                    self.end_prefix("cursors_mac")
 
                 self.path("licenses-mac.txt", dst="licenses.txt")
                 self.path("featuretable_mac.txt")
@@ -864,15 +836,13 @@ def construct(self):
                 self.path("ca-bundle.crt")
 
                 icon_path = self.icon_path()
-                if self.prefix(src=icon_path, dst="") :
+                with self.prefix(src=icon_path, dst="") :
                     self.path("secondlife.icns")
-                    self.end_prefix(icon_path)
 
                 #VMP Tkinter icons
-                if self.prefix("vmp_icons"):
+                with self.prefix("vmp_icons"):
                     self.path("*.png")
                     self.path("*.gif")
-                    self.end_prefix("vmp_icons")
 
                 self.path("SecondLife.nib")
                 
@@ -978,7 +948,7 @@ def path_optional(src, dst):
                             print "Can't symlink %s -> %s: %s" % (src, dst, err)
 
                 # Dullahan helper apps go inside SLPlugin.app
-                if self.prefix(src="", dst="SLPlugin.app/Contents/Frameworks"):
+                with self.prefix(src="", dst="SLPlugin.app/Contents/Frameworks"):
                     helperappfile = 'DullahanHelper.app'
                     self.path2basename(relpkgdir, helperappfile)
 
@@ -994,15 +964,14 @@ def path_optional(src, dst):
                         self.dst_path_of('DullahanHelper.app/Contents/MacOS/'
                                          'Frameworks/Chromium Embedded Framework.framework')
 
-                    self.end_prefix()
 
-                    helperexecutablepath = self.dst_path_of('SLPlugin.app/Contents/Frameworks/DullahanHelper.app/Contents/MacOS/DullahanHelper')
-                    self.run_command('install_name_tool -change '
-                                     '"@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" '
-                                     '"@executable_path/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "%s"' % helperexecutablepath)
+                helperexecutablepath = self.dst_path_of('SLPlugin.app/Contents/Frameworks/DullahanHelper.app/Contents/MacOS/DullahanHelper')
+                self.run_command('install_name_tool -change '
+                                 '"@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" '
+                                 '"@executable_path/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "%s"' % helperexecutablepath)
 
                 # SLPlugin plugins
-                if self.prefix(src="", dst="llplugin"):
+                with self.prefix(src="", dst="llplugin"):
                     self.path2basename("../media_plugins/cef/" + self.args['configuration'],
                                        "media_plugin_cef.dylib")
 
@@ -1011,74 +980,68 @@ def path_optional(src, dst):
                                        "media_plugin_libvlc.dylib")
 
                     # copy LibVLC dynamic libraries
-                    if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'release' ), dst="lib"):
+                    with self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'release' ), dst="lib"):
                         self.path( "libvlc*.dylib*" )
-                        self.end_prefix()
 
                     # copy LibVLC plugins folder
-                    if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'release', 'plugins' ), dst="lib"):
+                    with self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'release', 'plugins' ), dst="lib"):
                         self.path( "*.dylib" )
                         self.path( "plugins.dat" )
-                        self.end_prefix()
-
-                    self.end_prefix("llplugin")
-
-                    # do this install_name_tool *after* media plugin is copied over
-                    dylibexecutablepath = self.dst_path_of('llplugin/media_plugin_cef.dylib')
-                    self.run_command('install_name_tool -change '
-                                     '"@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" '
-                                     '"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "%s"' % dylibexecutablepath)
-
-                self.end_prefix("Resources")
-
-                # CEF framework goes inside Second Life.app/Contents/Frameworks
-                if self.prefix(src="", dst="Frameworks"):
-                    frameworkfile="Chromium Embedded Framework.framework"
-                    self.path2basename(relpkgdir, frameworkfile)
-                    self.end_prefix("Frameworks")
-
-                # This code constructs a relative path from the
-                # target framework folder back to the location of the symlink.
-                # It needs to be relative so that the symlink still works when
-                # (as is normal) the user moves the app bundle out of the DMG
-                # and into the /Applications folder. Note we also call 'raise'
-                # to terminate the process if we get an error since without
-                # this symlink, Second Life web media can't possibly work.
-                # Real Framework folder:
-                #   Second Life.app/Contents/Frameworks/Chromium Embedded Framework.framework/
-                # Location of symlink and why it's relative 
-                #   Second Life.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework/
-                # Real Frameworks folder, with the symlink inside the bundled SLPlugin.app (and why it's relative)
-                #   <top level>.app/Contents/Frameworks/Chromium Embedded Framework.framework/
-                #   <top level>.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework ->
-                # It might seem simpler just to create a symlink Frameworks to
-                # the parent of Chromimum Embedded Framework.framework. But
-                # that would create a symlink cycle, which breaks our
-                # packaging step. So make a symlink from Chromium Embedded
-                # Framework.framework to the directory of the same name, which
-                # is NOT an ancestor of the symlink.
-                frameworkpath = os.path.join(os.pardir, os.pardir, os.pardir,
-                                             os.pardir, "Frameworks",
-                                             "Chromium Embedded Framework.framework")
-                try:
-                    # from SLPlugin.app/Contents/Frameworks/Chromium Embedded
-                    # Framework.framework back to Second
-                    # Life.app/Contents/Frameworks/Chromium Embedded Framework.framework
-                    origin, target = pluginframeworkpath, frameworkpath
-                    symlinkf(target, origin)
-                    # from SLPlugin.app/Contents/Frameworks/Dullahan
-                    # Helper.app/Contents/MacOS/Frameworks/Chromium Embedded
-                    # Framework.framework back to
-                    # SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework
-                    self.cmakedirs(os.path.dirname(helperframeworkpath))
-                    origin = helperframeworkpath
-                    target = os.path.join(os.pardir, frameworkpath)
-                    symlinkf(target, origin)
-                except OSError as err:
-                    print "Can't symlink %s -> %s: %s" % (origin, target, err)
-                    raise
-
-            self.end_prefix("Contents")
+
+
+                # do this install_name_tool *after* media plugin is copied over
+                dylibexecutablepath = self.dst_path_of('llplugin/media_plugin_cef.dylib')
+                self.run_command('install_name_tool -change '
+                                 '"@rpath/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" '
+                                 '"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" "%s"' % dylibexecutablepath)
+
+
+            # CEF framework goes inside Second Life.app/Contents/Frameworks
+            with self.prefix(src="", dst="Frameworks"):
+                frameworkfile="Chromium Embedded Framework.framework"
+                self.path2basename(relpkgdir, frameworkfile)
+
+            # This code constructs a relative path from the
+            # target framework folder back to the location of the symlink.
+            # It needs to be relative so that the symlink still works when
+            # (as is normal) the user moves the app bundle out of the DMG
+            # and into the /Applications folder. Note we also call 'raise'
+            # to terminate the process if we get an error since without
+            # this symlink, Second Life web media can't possibly work.
+            # Real Framework folder:
+            #   Second Life.app/Contents/Frameworks/Chromium Embedded Framework.framework/
+            # Location of symlink and why it's relative 
+            #   Second Life.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework/
+            # Real Frameworks folder, with the symlink inside the bundled SLPlugin.app (and why it's relative)
+            #   <top level>.app/Contents/Frameworks/Chromium Embedded Framework.framework/
+            #   <top level>.app/Contents/Resources/SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework ->
+            # It might seem simpler just to create a symlink Frameworks to
+            # the parent of Chromimum Embedded Framework.framework. But
+            # that would create a symlink cycle, which breaks our
+            # packaging step. So make a symlink from Chromium Embedded
+            # Framework.framework to the directory of the same name, which
+            # is NOT an ancestor of the symlink.
+            frameworkpath = os.path.join(os.pardir, os.pardir, os.pardir,
+                                         os.pardir, "Frameworks",
+                                         "Chromium Embedded Framework.framework")
+            try:
+                # from SLPlugin.app/Contents/Frameworks/Chromium Embedded
+                # Framework.framework back to Second
+                # Life.app/Contents/Frameworks/Chromium Embedded Framework.framework
+                origin, target = pluginframeworkpath, frameworkpath
+                symlinkf(target, origin)
+                # from SLPlugin.app/Contents/Frameworks/Dullahan
+                # Helper.app/Contents/MacOS/Frameworks/Chromium Embedded
+                # Framework.framework back to
+                # SLPlugin.app/Contents/Frameworks/Chromium Embedded Framework.framework
+                self.cmakedirs(os.path.dirname(helperframeworkpath))
+                origin = helperframeworkpath
+                target = os.path.join(os.pardir, frameworkpath)
+                symlinkf(target, origin)
+            except OSError as err:
+                print "Can't symlink %s -> %s: %s" % (origin, target, err)
+                raise
+
 
         # NOTE: the -S argument to strip causes it to keep enough info for
         # annotated backtraces (i.e. function names in the crash log).  'strip' with no
@@ -1275,21 +1238,19 @@ def construct(self):
         debpkgdir = os.path.join(pkgdir, "lib", "debug")
 
         self.path("licenses-linux.txt","licenses.txt")
-        if self.prefix("linux_tools", dst=""):
+        with self.prefix("linux_tools", dst=""):
             self.path("client-readme.txt","README-linux.txt")
             self.path("client-readme-voice.txt","README-linux-voice.txt")
             self.path("client-readme-joystick.txt","README-linux-joystick.txt")
             self.path("wrapper.sh","secondlife")
-            if self.prefix(src="", dst="etc"):
+            with self.prefix(src="", dst="etc"):
                 self.path("handle_secondlifeprotocol.sh")
                 self.path("register_secondlifeprotocol.sh")
                 self.path("refresh_desktop_app_entry.sh")
                 self.path("launch_url.sh")
-                self.end_prefix("etc")
             self.path("install.sh")
-            self.end_prefix("linux_tools")
 
-        if self.prefix(src="", dst="bin"):
+        with self.prefix(src="", dst="bin"):
             self.path("secondlife-bin","do-not-directly-run-secondlife-bin")
             self.path("../linux_crash_logger/linux-crash-logger","linux-crash-logger.bin")
             self.path2basename("../llplugin/slplugin", "SLPlugin") 
@@ -1299,40 +1260,33 @@ def construct(self):
             llbase_path = os.path.join(self.get_dst_prefix(),'llbase')
             if not os.path.exists(llbase_path):
                 os.makedirs(llbase_path)
-            if self.prefix(dst="llbase"):
+            with self.prefix(dst="llbase"):
                 self.path2basename("../packages/lib/python/llbase","*.py")
                 self.path2basename("../packages/lib/python/llbase","_cllsd.so")         
-            self.end_prefix("bin")
 
-        if self.prefix("res-sdl"):
+        with self.prefix("res-sdl"):
             self.path("*")
             # recurse
-            self.end_prefix("res-sdl")
 
         # Get the icons based on the channel type
         icon_path = self.icon_path()
         print "DEBUG: icon_path '%s'" % icon_path
-        if self.prefix(src=icon_path, dst="") :
+        with self.prefix(src=icon_path, dst="") :
             self.path("secondlife_256.png","secondlife_icon.png")
-            if self.prefix(src="",dst="res-sdl") :
+            with self.prefix(src="",dst="res-sdl") :
                 self.path("secondlife_256.BMP","ll_icon.BMP")
-                self.end_prefix("res-sdl")
-            self.end_prefix(icon_path)
 
         # plugins
-        if self.prefix(src="", dst="bin/llplugin"):
+        with self.prefix(src="", dst="bin/llplugin"):
             self.path("../media_plugins/gstreamer010/libmedia_plugin_gstreamer010.so", "libmedia_plugin_gstreamer.so")
             self.path("../media_plugins/libvlc/libmedia_plugin_libvlc.so", "libmedia_plugin_libvlc.so")
-            self.end_prefix("bin/llplugin")
 
-        if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'vlc', 'plugins'), dst="bin/llplugin/vlc/plugins"):
+        with self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'vlc', 'plugins'), dst="bin/llplugin/vlc/plugins"):
             self.path( "plugins.dat" )
             self.path( "*/*.so" )
-            self.end_prefix()
 
-        if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib' ), dst="lib"):
+        with self.prefix(src=os.path.join(os.pardir, 'packages', 'lib' ), dst="lib"):
             self.path( "libvlc*.so*" )
-            self.end_prefix()
 
         # llcommon
         if not self.path("../llcommon/libllcommon.so", "lib/libllcommon.so"):
@@ -1395,7 +1349,7 @@ def construct(self):
         relpkgdir = os.path.join(pkgdir, "lib", "release")
         debpkgdir = os.path.join(pkgdir, "lib", "debug")
 
-        if self.prefix(relpkgdir, dst="lib"):
+        with self.prefix(relpkgdir, dst="lib"):
             self.path("libapr-1.so")
             self.path("libapr-1.so.0")
             self.path("libapr-1.so.0.4.5")
@@ -1455,21 +1409,18 @@ def construct(self):
                 print "Skipping libfmodex.so - not found"
                 pass
 
-            self.end_prefix("lib")
 
-            # Vivox runtimes
-            if self.prefix(src=relpkgdir, dst="bin"):
-                self.path("SLVoice")
-                self.end_prefix()
-            if self.prefix(src=relpkgdir, dst="lib"):
-                self.path("libortp.so")
-                self.path("libsndfile.so.1")
-                #self.path("libvivoxoal.so.1") # no - we'll re-use the viewer's own OpenAL lib
-                self.path("libvivoxsdk.so")
-                self.path("libvivoxplatform.so")
-                self.end_prefix("lib")
-
-            self.strip_binaries()
+        # Vivox runtimes
+        with self.prefix(src=relpkgdir, dst="bin"):
+            self.path("SLVoice")
+        with self.prefix(src=relpkgdir, dst="lib"):
+            self.path("libortp.so")
+            self.path("libsndfile.so.1")
+            #self.path("libvivoxoal.so.1") # no - we'll re-use the viewer's own OpenAL lib
+            self.path("libvivoxsdk.so")
+            self.path("libvivoxplatform.so")
+
+        self.strip_binaries()
 
 
 class Linux_x86_64_Manifest(LinuxManifest):