diff --git a/fierce/fierce.py b/fierce/fierce.py index f9db675..f29d7f9 100755 --- a/fierce/fierce.py +++ b/fierce/fierce.py @@ -58,22 +58,15 @@ def find_subdomain_list_file(filename): if os.path.exists(filename_path): return os.path.abspath(filename_path) - try: - from importlib import resources - 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) try: - # Use importlib.resources.as_file when Python 3.9 is minimum version - full_package_path = resources.path("fierce.lists", filename) + from fierce import lists except ImportError: return filename - with full_package_path as path: - return str(path) + return str(lists.CURDIR / filename) def head_request(url, timeout=2): diff --git a/fierce/lists/__init__.py b/fierce/lists/__init__.py new file mode 100644 index 0000000..682b6f8 --- /dev/null +++ b/fierce/lists/__init__.py @@ -0,0 +1,7 @@ +import pathlib + + +CURDIR = pathlib.Path(__file__).parent +DEFAULT_LIST = CURDIR / "default.txt" +_20000_LIST = "20000.txt" +_5000_LIST = "5000.txt"