Bug 1451065 - Attempt to install Python 3 on Debian distros; r?Build
Not all distros will have a "python3" package. But the modern ones
should.
Because many people install Python via other means, we only install
the system packages if a Python 3 executable can't be found.
MozReview-Commit-ID: 2ni7Ha92cRD
--- a/python/mozboot/mozboot/debian.py
+++ b/python/mozboot/mozboot/debian.py
@@ -95,17 +95,32 @@ class DebianBootstrapper(StyloInstall, B
self.packages = self.COMMON_PACKAGES + self.DISTRO_PACKAGES
if self.distro == 'Debian' or self.distro == 'debian':
self.packages += self.DEBIAN_PACKAGES
self.browser_packages = self.BROWSER_COMMON_PACKAGES + self.BROWSER_DISTRO_PACKAGES
self.mobile_android_packages = self.MOBILE_ANDROID_COMMON_PACKAGES + \
self.MOBILE_ANDROID_DISTRO_PACKAGES
def install_system_packages(self):
- self.apt_install(*self.packages)
+ # Python 3 may not be present on all distros. Search for it and
+ # install if found.
+ packages = list(self.packages)
+
+ have_python3 = any([self.which('python3'), self.which('python3.6'),
+ self.which('python3.5')])
+
+ if not have_python3:
+ python3_packages = self.check_output([
+ 'apt-cache', 'pkgnames', 'python3'])
+ python3_packages = python3_packages.splitlines()
+
+ if 'python3' in python3_packages:
+ packages.extend(['python3', 'python3-dev'])
+
+ self.apt_install(*packages)
def install_browser_packages(self):
self.ensure_browser_packages()
def install_browser_artifact_mode_packages(self):
self.ensure_browser_packages(artifact_mode=True)
def install_mobile_android_packages(self):