File: replace-pkg_resources-with-importlib-and-packaging.patch

package info (click to toggle)
python-grpc-tools 1.14.1-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,312 kB
  • sloc: cpp: 168,051; makefile: 875; python: 209; javascript: 110; sh: 57
file content (48 lines) | stat: -rw-r--r-- 1,520 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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'