Bug 1550956: Import builtins in Python 3 compatible way r=firefox-build-system-reviewers,chmanchester
authorKagami Sascha Rosylight <saschanaz@outlook.com>
Thu, 23 May 2019 03:57:17 +0000
changeset 475178 b09e197ba5a3213026316668e89707749d5f3821
parent 475177 e882a5c576abc2c29ae3e3e3c5a27aefa0c2621e
child 475179 33f8dca276863d1cbc33511d47ba198f820400ea
push id36057
push useraciure@mozilla.com
push dateThu, 23 May 2019 21:52:03 +0000
treeherdermozilla-central@d551d37b9ad0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, chmanchester
bugs1550956
milestone69.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 1550956: Import builtins in Python 3 compatible way r=firefox-build-system-reviewers,chmanchester Differential Revision: https://phabricator.services.mozilla.com/D30790
build/mach_bootstrap.py
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -6,17 +6,20 @@ from __future__ import print_function, u
 
 import errno
 import json
 import os
 import platform
 import subprocess
 import sys
 import uuid
-import __builtin__
+if sys.version_info[0] < 3:
+    import __builtin__ as builtins
+else:
+    import builtins
 
 from types import ModuleType
 
 
 STATE_DIR_FIRST_RUN = '''
 mach and the build system store shared state in a common directory on the
 filesystem. The following directory will be created:
 
@@ -429,9 +432,9 @@ class ImportHook(object):
                 os.remove(module.__file__)
             del sys.modules[module.__name__]
             module = self(name, globals, locals, fromlist, level)
 
         return module
 
 
 # Install our hook
-__builtin__.__import__ = ImportHook(__builtin__.__import__)
+builtins.__import__ = ImportHook(builtins.__import__)