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
try:
return normsep(which(file))
except WhichError:
return None
def unique_list(l):
result = []