Description: replace usages of pkg_resources with packaging and importlib
Author: Ananthu C V <weepingclown@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1103717
Last-Update: 2025-04-21
--- a/grpc_tools/command.py
+++ b/grpc_tools/command.py
@@ -15,4 +15,4 @@
 import os
-import pkg_resources
 import sys
+from importlib.resources import files
 
@@ -32,4 +32,3 @@
 
-    well_known_protos_include = pkg_resources.resource_filename(
-        'grpc_tools', '_proto')
+    well_known_protos_include = files('grpc_tools').joinpath('_proto')
 
--- a/grpc_tools/protoc.py
+++ b/grpc_tools/protoc.py
@@ -16,4 +16,4 @@
 
-import pkg_resources
 import sys
+from importlib.resources import files
 
@@ -34,3 +34,3 @@
 if __name__ == '__main__':
-    proto_include = pkg_resources.resource_filename('grpc_tools', '_proto')
+    proto_include = files('grpc_tools').joinpath('_proto')
     sys.exit(main(sys.argv + ['-I{}'.format(proto_include)]))
--- a/setup.py
+++ b/setup.py
@@ -17,3 +17,2 @@
 import os.path
-import pkg_resources
 import platform
@@ -30,2 +29,3 @@
 from distutils import util
+from packaging.version import Version
 
@@ -123,4 +123,4 @@
     mac_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
-    if mac_target and (pkg_resources.parse_version(mac_target) <
-                       pkg_resources.parse_version('10.9.0')):
+    if mac_target and (Version(mac_target) <
+                       Version('10.9.0')):
         os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
