Debian Codegraph @

debian/patches/python3.13-pipes.patch

raw
1 From dfa9d853fff02212ff232da5b39b76adf3ecce83 Mon Sep 17 00:00:00 2001
2 From: Leonardo Pistone <[email protected]>
3 Date: Thu, 7 Dec 2023 12:59:29 -0800
4 Subject: [PATCH] Fix Python DeprecationWarning: 'pipes' (#34941)
5
6 Starting from Python 3.11, the pipes module produces this warning:
7
8 DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
9
10 Turns out that in this repo the pipes module is only used for the
11 "quote" function which is turn directly taken from the shlex module [1].
12
13 The shlex module is not deprecated as of today and is already used in
14 other places in this repo. The function shlex.quote has been around
15 since the ancient Python 3.3.
16
17 [1] https://github.com/python/cpython/blob/3.11/Lib/pipes.py#L64-L66
18
19 <!--
20
21 If you know who should review your pull request, please assign it to that
22 person, otherwise the pull request would get assigned randomly.
23
24 If your pull request is for a specific language, please add the appropriate
25 lang label.
26
27 -->
28
29 Closes #34941
30
31 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/34941 from lepistone:deprecate-python-pipes 233c54c135542178703aa700a2dddadc895fedb0
32 PiperOrigin-RevId: 588883480
33 ---
34 tools/run_tests/run_performance_tests.py | 10 +++++-----
35 tools/run_tests/run_tests.py | 4 ++--
36 2 files changed, 7 insertions(+), 7 deletions(-)
37
38 Origin: upstream, https://github.com/grpc/grpc/pull/34941
39 Bug-Debian: https://bugs.debian.org/1084603
40 --- a/tools/run_tests/run_performance_tests.py
41 +++ b/tools/run_tests/run_performance_tests.py
42 @@ -22,8 +22,8 @@
43 import json
44 import multiprocessing
45 import os
46 -import pipes
47 import re
48 +import shlex
49 import subprocess
50 import sys
51 import tempfile
52 @@ -124,7 +124,7 @@
53 if bq_result_table:
54 cmd += 'BQ_RESULT_TABLE="%s" ' % bq_result_table
55 cmd += 'tools/run_tests/performance/run_qps_driver.sh '
56 - cmd += '--scenarios_json=%s ' % pipes.quote(
57 + cmd += '--scenarios_json=%s ' % shlex.quote(
58 json.dumps({'scenarios': [scenario_json]}))
59 cmd += '--scenario_result_file=scenario_result.json '
60 if server_cpu_load != 0:
61 @@ -132,7 +132,7 @@
62 if remote_host:
63 user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host)
64 cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && "%s' % (
65 - user_at_host, pipes.quote(cmd))
66 + user_at_host, shlex.quote(cmd))
67
68 return jobset.JobSpec(cmdline=[cmd],
69 shortname='%s' % scenario_json['name'],
70 @@ -149,7 +149,7 @@
71 if remote_host:
72 user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host)
73 cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && "%s' % (
74 - user_at_host, pipes.quote(cmd))
75 + user_at_host, shlex.quote(cmd))
76
77 return jobset.JobSpec(cmdline=[cmd],
78 shortname='shutdown_workers',
79 @@ -180,7 +180,7 @@
80 if client_host:
81 user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, client_host)
82 cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && "%s' % (
83 - user_at_host, pipes.quote(cmd))
84 + user_at_host, shlex.quote(cmd))
85
86 return jobset.JobSpec(cmdline=[cmd],
87 shortname='netperf',
88 --- a/tools/run_tests/run_tests.py
89 +++ b/tools/run_tests/run_tests.py
90 @@ -26,10 +26,10 @@
91 import multiprocessing
92 import os
93 import os.path
94 -import pipes
95 import platform
96 import random
97 import re
98 +import shlex
99 import socket
100 import subprocess
101 import sys
102 @@ -415,7 +415,7 @@
103 cmdline = [binary] + target['args']
104 shortname = target.get(
105 'shortname',
106 - ' '.join(pipes.quote(arg) for arg in cmdline))
107 + ' '.join(shlex.quote(arg) for arg in cmdline))
108 shortname += shortname_ext
109 out.append(
110 self.config.job_spec(