From d14d93b520b984f838c71cbaf2036e326722c688 Mon Sep 17 00:00:00 2001 From: Eric Avdey Date: Tue, 30 Jul 2024 01:58:26 -0300 Subject: [PATCH] refactor: migrate from pkg_resources to importlib.metadata (#374) Signed-off-by: Eric Avdey Co-authored-by: Chad Wilson --- check_and_install_getgauge.py | 6 +++--- python.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/check_and_install_getgauge.py b/check_and_install_getgauge.py index 75bc184..b61787a 100644 --- a/check_and_install_getgauge.py +++ b/check_and_install_getgauge.py @@ -2,7 +2,7 @@ import sys from subprocess import check_output -import pkg_resources +from importlib.metadata import version, PackageNotFoundError def get_version(): @@ -29,10 +29,10 @@ def assert_versions(): expected_gauge_version = python_plugin_version try: - getgauge_version = pkg_resources.get_distribution('getgauge').version + getgauge_version = version('getgauge') if getgauge_version != expected_gauge_version: install_getgauge("getgauge=="+expected_gauge_version) - except pkg_resources.DistributionNotFound: + except PackageNotFoundError: install_getgauge("getgauge=="+expected_gauge_version) diff --git a/python.json b/python.json index 7d143cc..b47fbd4 100644 --- a/python.json +++ b/python.json @@ -1,6 +1,6 @@ { "id": "python", - "version": "0.4.5", + "version": "0.4.6", "description": "Python support for gauge", "run": { "windows": [