From: Eli Schwartz <eschwartz93@gmail.com>
Date: Sun, 15 Sep 2024 21:31:16 -0400
Subject: drop the final remaining use of the deprecated pkg_resources module

Declaring a namespace package has gone through a few revisions.
pkg_resources has a version that is heavily deprecated. pkgutil provides
a python2/python3 compatible version that is also compatible with native
python3 namespaces.

https://packaging.python.org/en/latest/guides/packaging-namespace-packages/

pkg_resources is very very deprecated and importing or using it results
in deprecation warnings. It's time to move off of it entirely.

Fixes: https://github.com/PyFilesystem/pyfilesystem2/issues/577

Origin: upstream, https://github.com/PyFilesystem/pyfilesystem2/pull/590
---
 fs/__init__.py        | 2 +-
 fs/opener/__init__.py | 2 +-
 setup.cfg             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/__init__.py b/fs/__init__.py
index 97dc55b..8cddcb1 100644
--- a/fs/__init__.py
+++ b/fs/__init__.py
@@ -1,7 +1,7 @@
 """Python filesystem abstraction layer.
 """
 
-__import__("pkg_resources").declare_namespace(__name__)  # type: ignore
+__path__ = __import__("pkgutil").extend_path(__path__, __name__)
 
 from . import path
 from ._fscompat import fsdecode, fsencode
diff --git a/fs/opener/__init__.py b/fs/opener/__init__.py
index 651a630..336f737 100644
--- a/fs/opener/__init__.py
+++ b/fs/opener/__init__.py
@@ -3,7 +3,7 @@
 """
 
 # Declare fs.opener as a namespace package
-__import__("pkg_resources").declare_namespace(__name__)  # type: ignore
+__path__ = __import__("pkgutil").extend_path(__path__, __name__)
 
 # Import opener modules so that `registry.install` if called on each opener
 from . import appfs, ftpfs, memoryfs, osfs, tarfs, tempfs, zipfs
diff --git a/setup.cfg b/setup.cfg
index 3cd1425..afb76f5 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -43,7 +43,7 @@ setup_requires =
     setuptools >=38.3.0
 install_requires =
     platformdirs >= 4
-    setuptools
+    setuptools          ; python_version < '3.8'
     enum34 ~=1.1.6      ;  python_version < '3.4'
     typing ~=3.6        ;  python_version < '3.6'
     backports.os ~=0.1  ;  python_version < '3.0'
