diff options
author | Steve Sakoman <steve@sakoman.com> | 2023-10-24 04:25:53 -1000 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-10-27 04:21:19 -1000 |
commit | 1d15d166d060bb09b75a1359467d66ca0eb5c3ee (patch) | |
tree | 2b62e793d53b5548775b7aabc150a93c14d8597d | |
parent | 5c342965c44dace8a376235fd5bd4ad5d4374cd2 (diff) | |
download | poky-1d15d166d060bb09b75a1359467d66ca0eb5c3ee.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: a6ef13bdad40826d76a3331cd0878bb22510f375)
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
(cherry picked from commit 5f33c7b99a991c380d1813da8248ba5470ca4d4e)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/lib/oe/patch.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 7cd8436da5..feb6ee7082 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -2,6 +2,9 @@ | |||
2 | # SPDX-License-Identifier: GPL-2.0-only | 2 | # SPDX-License-Identifier: GPL-2.0-only |
3 | # | 3 | # |
4 | 4 | ||
5 | import os | ||
6 | import shlex | ||
7 | import subprocess | ||
5 | import oe.path | 8 | import oe.path |
6 | import oe.types | 9 | import oe.types |
7 | 10 | ||
@@ -24,7 +27,6 @@ class CmdError(bb.BBHandledException): | |||
24 | 27 | ||
25 | 28 | ||
26 | def runcmd(args, dir = None): | 29 | def runcmd(args, dir = None): |
27 | import pipes | ||
28 | import subprocess | 30 | import subprocess |
29 | 31 | ||
30 | if dir: | 32 | if dir: |
@@ -35,7 +37,7 @@ def runcmd(args, dir = None): | |||
35 | # print("cwd: %s -> %s" % (olddir, dir)) | 37 | # print("cwd: %s -> %s" % (olddir, dir)) |
36 | 38 | ||
37 | try: | 39 | try: |
38 | args = [ pipes.quote(str(arg)) for arg in args ] | 40 | args = [ shlex.quote(str(arg)) for arg in args ] |
39 | cmd = " ".join(args) | 41 | cmd = " ".join(args) |
40 | # print("cmd: %s" % cmd) | 42 | # print("cmd: %s" % cmd) |
41 | (exitstatus, output) = subprocess.getstatusoutput(cmd) | 43 | (exitstatus, output) = subprocess.getstatusoutput(cmd) |