Bug 1639986 - Add hack to bootstrap to install Python 2 on macOS r=firefox-build-system-reviewers,nalexander
authorRicky Stewart <rstewart@mozilla.com>
Thu, 21 May 2020 20:25:34 +0000
changeset 531515 95be09f031e4928ef5808f9b05ff54b48afd6438
parent 531514 53abd4bfccb4aa33bc82dda93c5d00df8bc67b8a
child 531516 4b31e67c062b80e9091476fe0b4582c3ae5995f3
push id37440
push userabutkovits@mozilla.com
push dateFri, 22 May 2020 09:43:16 +0000
treeherdermozilla-central@fbf71e4d2e21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, nalexander
bugs1639986
milestone78.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 1639986 - Add hack to bootstrap to install Python 2 on macOS r=firefox-build-system-reviewers,nalexander This is ugly and complicates the code some but it's manageable and allows us to keep things afloat on macOS while the testing team plugs along with the `mach` migration. Differential Revision: https://phabricator.services.mozilla.com/D76386
python/mozboot/mozboot/osx.py
--- a/python/mozboot/mozboot/osx.py
+++ b/python/mozboot/mozboot/osx.py
@@ -298,30 +298,40 @@ class OSXBootstrapper(BaseBootstrapper):
 
     def _ensure_homebrew_packages(self, packages, extra_brew_args=[]):
         self._ensure_homebrew_found()
         self._ensure_package_manager_updated()
         cmd = [self.brew] + extra_brew_args
 
         installed = set(self.check_output(cmd + ['list'],
                                           universal_newlines=True).split())
-        to_install = [package for package in packages if package not in installed]
+        to_install = set(
+            package for package in packages if package not in installed)
 
         # The "--quiet" tells "brew" to only list the package names, and not the
         # comparison between current and new version.
         outdated = set(self.check_output(cmd + ['outdated', '--quiet'],
                                          universal_newlines=True).split())
-        to_upgrade = [package for package in packages if package in outdated]
+        to_upgrade = set(package for package in packages if package in outdated)
 
         if to_install or to_upgrade:
             print(PACKAGE_MANAGER_PACKAGES % ('Homebrew',))
+        if 'python@2' in to_install:
+            # Special handling for Python 2 since brew can't install it
+            # out-of-the-box any more.
+            to_install.remove('python@2')
+            subprocess.check_call(
+                cmd + ['install',
+                       'https://raw.githubusercontent.com/Homebrew/homebrew-core'
+                       '/86a44a0a552c673a05f11018459c9f5faae3becc'
+                       '/Formula/python@2.rb'])
         if to_install:
-            subprocess.check_call(cmd + ['install'] + to_install)
+            subprocess.check_call(cmd + ['install'] + list(to_install))
         if to_upgrade:
-            subprocess.check_call(cmd + ['upgrade'] + to_upgrade)
+            subprocess.check_call(cmd + ['upgrade'] + list(to_upgrade))
 
     def _ensure_homebrew_casks(self, casks):
         self._ensure_homebrew_found()
 
         known_taps = self.check_output([self.brew, 'tap'])
 
         # Ensure that we can access old versions of packages.
         if b'homebrew/cask-versions' not in known_taps:
@@ -343,16 +353,17 @@ class OSXBootstrapper(BaseBootstrapper):
         # least on 10.8) and because the build system wants a version
         # newer than what Apple ships.
         packages = [
             'autoconf@2.13',
             'git',
             'gnu-tar',
             'node',
             'python',
+            'python@2',
             'terminal-notifier',
             'watchman',
         ]
         if install_mercurial:
             packages.append('mercurial')
         self._ensure_homebrew_packages(packages)
 
     def ensure_homebrew_browser_packages(self, artifact_mode=False):