Bug 1264831 - Use @imports in find_program. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 15 Apr 2016 11:11:58 +0900
changeset 331239 f84123a66e198c7c6f17aab04e65e28bdc92896e
parent 331238 dc27fd8f2c4e88c87771bc3654cf113bc21c9b9e
child 331240 66e2cb10760096a9b9f1b1de813a7e3865cb5630
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1264831
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264831 - Use @imports in find_program. r=gps This removes the last use of complete configure sandbox unlocking.
build/moz.configure/util.configure
--- 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
     try:
         return normsep(which(file))
     except WhichError:
         return None
 
 
 def unique_list(l):
     result = []