From 4699a1ef20a3482b6a51a92233070f786724df9d Mon Sep 17 00:00:00 2001 From: Matt Schwager Date: Wed, 28 Aug 2024 09:12:24 -0400 Subject: [PATCH] Use importlib instead of pkg_resources --- fierce/fierce.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fierce/fierce.py b/fierce/fierce.py index cc0d53e..52df3f6 100755 --- a/fierce/fierce.py +++ b/fierce/fierce.py @@ -59,23 +59,21 @@ def find_subdomain_list_file(filename): return os.path.abspath(filename_path) try: - import pkg_resources + import importlib except ImportError: return filename # If the relative check failed then attempt to find the list file # in the pip package directory. This will typically happen on pip package # installs (duh) - package_filename_path = os.path.join("lists", filename) try: - full_package_path = pkg_resources.resource_filename( - "fierce", - package_filename_path - ) + # Use importlib.resources.as_file when Python 3.9 is minimum version + full_package_path = importlib.resources.path("fierce.lists", filename) except ImportError: return filename - return full_package_path + with full_package_path as path: + return str(path) def head_request(url, timeout=2):