From 4bcb67756f226b0dcee8e5b2685fc288c0db5c0a Mon Sep 17 00:00:00 2001 From: Zeid Zabaneh <2043828+zzzeid@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:44:11 -0400 Subject: [PATCH] telemetry: use importlib_resources instead of pkg_resources (bug 1894839) (#1732) - use importlib_resources for compatibility with older Pythons - remove deprecated usage of pkg_resources - add Python 3.12 to setup.py classifiers --- mozregression/telemetry.py | 7 ++++--- setup.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mozregression/telemetry.py b/mozregression/telemetry.py index 6bde7236..1b9706b4 100644 --- a/mozregression/telemetry.py +++ b/mozregression/telemetry.py @@ -4,17 +4,18 @@ from multiprocessing import Process from pathlib import Path import distro +import importlib_resources import mozinfo from glean import Configuration, Glean, load_metrics, load_pings from mozlog import get_proxy_logger -from pkg_resources import resource_filename from mozregression import __version__ from mozregression.dates import is_date_or_datetime, to_datetime LOG = get_proxy_logger("telemetry") -PINGS = load_pings(resource_filename(__name__, "pings.yaml")) -METRICS = load_metrics(resource_filename(__name__, "metrics.yaml")) + +PINGS = load_pings(importlib_resources.files(__name__) / "pings.yaml") +METRICS = load_metrics(importlib_resources.files(__name__) / "metrics.yaml") UsageMetrics = namedtuple( "UsageMetrics", diff --git a/setup.py b/setup.py index dbcd9174..5f921cd5 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,7 @@ DEPENDENCIES = [ "colorama>=0.4.1", "configobj>=5.0.6", "distro>=1.8.0", + "importlib_resources>= 5.10", "mozdevice>=4.1.0,<5", "mozfile>=2.0.0", "mozinfo>=1.1.0", @@ -54,6 +55,7 @@ setup( "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", ], )