Commit 12ed43db authored by serge-sans-paille's avatar serge-sans-paille
Browse files

Bug 1858062 - Remove reference to distutils in mozboot a=pascalc

distutils is no longer available in Python 3.12, which means we cannot
require it on bootstrap, otherwise we cannot bootstrap from Py 3.12.

We already require setuptools as part of mach's requirements, so it's
fine to depend on setuptools elsewhere.

Original Revision: https://phabricator.services.mozilla.com/D190537

Differential Revision: https://phabricator.services.mozilla.com/D200113
parent f52d4267
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -170,13 +170,6 @@ class BaseBootstrapper(object):
        to the user, if necessary.
        """

    def suggest_install_distutils(self):
        """Called if distutils.{sysconfig,spawn} can't be imported."""
        print(
            "Does your distro require installing another package for distutils?",
            file=sys.stderr,
        )

    def suggest_install_pip3(self):
        """Called if pip3 can't be found."""
        print(
+0 −16
Original line number Diff line number Diff line
@@ -491,22 +491,6 @@ class Bootstrapper(object):

    def _validate_python_environment(self, topsrcdir):
        valid = True
        try:
            # distutils is singled out here because some distros (namely Ubuntu)
            # include it in a separate package outside of the main Python
            # installation.
            import distutils.spawn
            import distutils.sysconfig

            assert distutils.sysconfig is not None and distutils.spawn is not None
        except ImportError as e:
            print("ERROR: Could not import package %s" % e.name, file=sys.stderr)
            self.instance.suggest_install_distutils()
            valid = False
        except AssertionError:
            print("ERROR: distutils is not behaving as expected.", file=sys.stderr)
            self.instance.suggest_install_distutils()
            valid = False
        pip3 = to_optional_path(which("pip3"))
        if not pip3:
            print("ERROR: Could not find pip3.", file=sys.stderr)
+0 −7
Original line number Diff line number Diff line
@@ -17,13 +17,6 @@ class DebianBootstrapper(LinuxBootstrapper, BaseBootstrapper):
        self.dist_id = dist_id
        self.codename = codename

    def suggest_install_distutils(self):
        print(
            "HINT: Try installing distutils with "
            "`apt-get install python3-distutils`.",
            file=sys.stderr,
        )

    def suggest_install_pip3(self):
        print(
            "HINT: Try installing pip3 with `apt-get install python3-pip`.",
+4 −1
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

VERSION = "0.1"