diff options
author | Ola x Nilsson <olani@axis.com> | 2023-04-13 08:46:31 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-04-14 16:44:24 +0100 |
commit | 2f958e043a6348c09c3b8bb0f6dececf17c04dae (patch) | |
tree | 6a7e584f70a14def4d1e928939e6546fd0bb5968 | |
parent | 1a5d7fa52746e2a1ba172017751bc0037e2f6c63 (diff) | |
download | poky-2f958e043a6348c09c3b8bb0f6dececf17c04dae.tar.gz |
patch.py: Use shlex instead of deprecated pipe
The pipe library is deprecated in Python 3.11 and will be removed in
Python 3.13. pipe.quote is just an import of shlex.quote anyway.
Clean up imports while we're at it.
(From OE-Core rev: 5f33c7b99a991c380d1813da8248ba5470ca4d4e)
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/patch.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index d047b3b947..5990896fdc 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -4,9 +4,11 @@ | |||
4 | # SPDX-License-Identifier: GPL-2.0-only | 4 | # SPDX-License-Identifier: GPL-2.0-only |
5 | # | 5 | # |
6 | 6 | ||
7 | import os | ||
8 | import shlex | ||
9 | import subprocess | ||
7 | import oe.path | 10 | import oe.path |
8 | import oe.types | 11 | import oe.types |
9 | import subprocess | ||
10 | 12 | ||
11 | class NotFoundError(bb.BBHandledException): | 13 | class NotFoundError(bb.BBHandledException): |
12 | def __init__(self, path): | 14 | def __init__(self, path): |
@@ -27,8 +29,6 @@ class CmdError(bb.BBHandledException): | |||
27 | 29 | ||
28 | 30 | ||
29 | def runcmd(args, dir = None): | 31 | def runcmd(args, dir = None): |
30 | import pipes | ||
31 | |||
32 | if dir: | 32 | if dir: |
33 | olddir = os.path.abspath(os.curdir) | 33 | olddir = os.path.abspath(os.curdir) |
34 | if not os.path.exists(dir): | 34 | if not os.path.exists(dir): |
@@ -37,7 +37,7 @@ def runcmd(args, dir = None): | |||
37 | # print("cwd: %s -> %s" % (olddir, dir)) | 37 | # print("cwd: %s -> %s" % (olddir, dir)) |
38 | 38 | ||
39 | try: | 39 | try: |
40 | args = [ pipes.quote(str(arg)) for arg in args ] | 40 | args = [ shlex.quote(str(arg)) for arg in args ] |
41 | cmd = " ".join(args) | 41 | cmd = " ".join(args) |
42 | # print("cmd: %s" % cmd) | 42 | # print("cmd: %s" % cmd) |
43 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | 43 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
@@ -217,7 +217,7 @@ class PatchTree(PatchSet): | |||
217 | with open(self.seriespath, 'w') as f: | 217 | with open(self.seriespath, 'w') as f: |
218 | for p in patches: | 218 | for p in patches: |
219 | f.write(p) | 219 | f.write(p) |
220 | 220 | ||
221 | def Import(self, patch, force = None): | 221 | def Import(self, patch, force = None): |
222 | """""" | 222 | """""" |
223 | PatchSet.Import(self, patch, force) | 223 | PatchSet.Import(self, patch, force) |
@@ -952,4 +952,3 @@ def should_apply(parm, d): | |||
952 | return False, "applies to later version" | 952 | return False, "applies to later version" |
953 | 953 | ||
954 | return True, None | 954 | return True, None |
955 | |||