From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- python/mach/mach/command_util.py | 1 - python/mach/mach/logging.py | 5 ++++- python/mach/mach/main.py | 11 ----------- python/mach/mach/telemetry.py | 15 ++++++--------- python/mach/mach/util.py | 16 ++++------------ python/mach/metrics.yaml | 20 ++++++++++---------- python/mach/pings.yaml | 2 +- 7 files changed, 25 insertions(+), 45 deletions(-) (limited to 'python/mach') diff --git a/python/mach/mach/command_util.py b/python/mach/mach/command_util.py index 2c35c8b01c..97e4f4b71f 100644 --- a/python/mach/mach/command_util.py +++ b/python/mach/mach/command_util.py @@ -93,7 +93,6 @@ MACH_COMMANDS = { "doctor": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), "environment": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), "eslint": MachCommandReference("tools/lint/mach_commands.py"), - "esmify": MachCommandReference("tools/esmify/mach_commands.py"), "event-into-legacy": MachCommandReference( "toolkit/components/glean/build_scripts/mach_commands.py" ), diff --git a/python/mach/mach/logging.py b/python/mach/mach/logging.py index 0f7bcf675a..47a4c1094b 100644 --- a/python/mach/mach/logging.py +++ b/python/mach/mach/logging.py @@ -15,7 +15,7 @@ import time import blessed import six -from mozbuild.util import mozilla_build_version +from mozbuild.buildversion import mozilla_build_version from packaging.version import Version IS_WINDOWS = sys.platform.startswith("win") @@ -47,6 +47,9 @@ def enable_blessed(): if os.environ.get("NO_ANSI"): return False + if not os.environ.get("MOZILLABUILD"): + return False + # MozillaBuild 4.0.2 is the first Release that supports # ANSI escape sequences, so if we're greater than that # version, we can enable them (via Blessed). diff --git a/python/mach/mach/main.py b/python/mach/mach/main.py index f178ff34f3..4a462b7909 100644 --- a/python/mach/mach/main.py +++ b/python/mach/mach/main.py @@ -6,7 +6,6 @@ # (mach). It is packaged as a module because everything is a library. import argparse -import codecs import logging import os import sys @@ -258,16 +257,6 @@ To see more help for a specific command, run: try: self.load_settings() - if sys.version_info < (3, 0): - if stdin.encoding is None: - sys.stdin = codecs.getreader("utf-8")(stdin) - - if stdout.encoding is None: - sys.stdout = codecs.getwriter("utf-8")(stdout) - - if stderr.encoding is None: - sys.stderr = codecs.getwriter("utf-8")(stderr) - # Allow invoked processes (which may not have a handle on the # original stdout file descriptor) to know if the original stdout # is a TTY. This provides a mechanism to allow said processes to diff --git a/python/mach/mach/telemetry.py b/python/mach/mach/telemetry.py index ba045f1dc3..40d5cc2216 100644 --- a/python/mach/mach/telemetry.py +++ b/python/mach/mach/telemetry.py @@ -2,19 +2,19 @@ # 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/. +import configparser import json import os import subprocess import sys +import urllib.parse as urllib_parse from pathlib import Path from textwrap import dedent import requests -import six.moves.urllib.parse as urllib_parse from mozbuild.base import BuildEnvironmentNotFoundException, MozbuildObject from mozbuild.telemetry import filter_args from mozversioncontrol import InvalidRepoPath, get_repository_object -from six.moves import configparser, input from mach.config import ConfigSettings from mach.settings import MachSettings @@ -29,11 +29,10 @@ SITE_DIR = (Path(__file__) / ".." / ".." / ".." / "sites").resolve() def create_telemetry_from_environment(settings): """Creates and a Telemetry instance based on system details. - If telemetry isn't enabled, the current interpreter isn't Python 3, or Glean - can't be imported, then a "mock" telemetry instance is returned that doesn't - set or record any data. This allows consumers to optimistically set telemetry - data without needing to specifically handle the case where the current system - doesn't support it. + If telemetry isn't enabled or Glean can't be imported, then a "mock" telemetry + instance is returned that doesn't set or record any data. This allows consumers + to optimistically set telemetry data without needing to specifically handle the + case where the current system doesn't support it. """ active_metadata = MozSiteMetadata.from_runtime() @@ -42,8 +41,6 @@ def create_telemetry_from_environment(settings): if not ( is_applicable_telemetry_environment() - # Glean is not compatible with Python 2 - and sys.version_info >= (3, 0) # If not using a mach virtualenv (e.g.: bootstrap uses native python) # then we can't guarantee that the glean package that we import is a # compatible version. Therefore, don't use glean. diff --git a/python/mach/mach/util.py b/python/mach/mach/util.py index b6bf1727fa..6069219ba5 100644 --- a/python/mach/mach/util.py +++ b/python/mach/mach/util.py @@ -20,20 +20,12 @@ def setenv(key, value): """Compatibility shim to ensure the proper string type is used with os.environ for the version of Python being used. """ - from six import text_type - encoding = "mbcs" if sys.platform == "win32" else "utf-8" - if sys.version_info[0] == 2: - if isinstance(key, text_type): - key = key.encode(encoding) - if isinstance(value, text_type): - value = value.encode(encoding) - else: - if isinstance(key, bytes): - key = key.decode(encoding) - if isinstance(value, bytes): - value = value.decode(encoding) + if isinstance(key, bytes): + key = key.decode(encoding) + if isinstance(value, bytes): + value = value.decode(encoding) os.environ[key] = value diff --git a/python/mach/metrics.yaml b/python/mach/metrics.yaml index 16b2aa2877..ce0725b215 100644 --- a/python/mach/metrics.yaml +++ b/python/mach/metrics.yaml @@ -23,7 +23,7 @@ mach: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -43,7 +43,7 @@ mach: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -57,7 +57,7 @@ mach: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -71,7 +71,7 @@ mach: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -87,7 +87,7 @@ mach.system: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -101,7 +101,7 @@ mach.system: - https://bugzilla.mozilla.org/show_bug.cgi?id=1655845#c3 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -115,7 +115,7 @@ mach.system: - https://bugzilla.mozilla.org/show_bug.cgi?id=1655845#c3 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -129,7 +129,7 @@ mach.system: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -143,7 +143,7 @@ mach.system: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage @@ -158,7 +158,7 @@ mach.system: - https://bugzilla.mozilla.org/show_bug.cgi?id=1291053#c34 notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com expires: never send_in_pings: - usage diff --git a/python/mach/pings.yaml b/python/mach/pings.yaml index c975437237..b5fe1966ff 100644 --- a/python/mach/pings.yaml +++ b/python/mach/pings.yaml @@ -19,4 +19,4 @@ usage: include_client_id: true notification_emails: - build-telemetry@mozilla.com - - mhentges@mozilla.com + - ahochheiden@mozilla.com -- cgit v1.2.3