Bug 1264831 - Use @imports in find_program. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 15 Apr 2016 11:11:58 +0900
changeset 317142 f84123a66e198c7c6f17aab04e65e28bdc92896e
parent 317141 dc27fd8f2c4e88c87771bc3654cf113bc21c9b9e
child 317143 66e2cb10760096a9b9f1b1de813a7e3865cb5630
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Bug 1264831 - Use @imports in find_program. r=gps This removes the last use of complete configure sandbox unlocking.
--- a/build/moz.configure/util.configure
+++ b/build/moz.configure/util.configure
@@ -26,25 +26,21 @@ def is_absolute_or_relative(path):
     return os.sep in path
 @imports(_import='mozpack.path', _as='mozpath')
 def normsep(path):
     return mozpath.normsep(path)
-# This unlocks the sandbox. Do not copy blindly.
-@imports(_import='__builtin__', _as='__builtins__')
+@imports(_from='which', _import='which')
+@imports(_from='which', _import='WhichError')
 def find_program(file):
     if is_absolute_or_relative(file):
         return os.path.abspath(file) if os.path.isfile(file) else None
-    # We can't use @imports here because it imports at declaration time,
-    # and the declaration of find_program happens before we ensure the
-    # which module is available in sys.path somehow.
-    from which import which, WhichError
         return normsep(which(file))
     except WhichError:
         return None
 def unique_list(l):
     result = []