diff options
| author | Ola x Nilsson <olani@axis.com> | 2023-04-13 08:46:31 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-11-15 06:05:32 -0800 |
| commit | b3366f02c20a29eb186d731d86c8b24e2790479e (patch) | |
| tree | ff2d507253e5d5c6fe3ae1011ae8dc310dbe147e /meta/lib | |
| parent | f13a22028849324f1003fce2b92fbb30f131d601 (diff) | |
| download | poky-b3366f02c20a29eb186d731d86c8b24e2790479e.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: 8eec5c4417301ea3b38e6662e7b29c9071f233e1)
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>
Diffstat (limited to 'meta/lib')
| -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 4ec9caed45..e607148ec7 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
| @@ -2,9 +2,11 @@ | |||
| 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 | import subprocess | ||
| 8 | 10 | ||
| 9 | class NotFoundError(bb.BBHandledException): | 11 | class NotFoundError(bb.BBHandledException): |
| 10 | def __init__(self, path): | 12 | def __init__(self, path): |
| @@ -25,8 +27,6 @@ class CmdError(bb.BBHandledException): | |||
| 25 | 27 | ||
| 26 | 28 | ||
| 27 | def runcmd(args, dir = None): | 29 | def runcmd(args, dir = None): |
| 28 | import pipes | ||
| 29 | |||
| 30 | if dir: | 30 | if dir: |
| 31 | olddir = os.path.abspath(os.curdir) | 31 | olddir = os.path.abspath(os.curdir) |
| 32 | if not os.path.exists(dir): | 32 | if not os.path.exists(dir): |
| @@ -35,7 +35,7 @@ def runcmd(args, dir = None): | |||
| 35 | # print("cwd: %s -> %s" % (olddir, dir)) | 35 | # print("cwd: %s -> %s" % (olddir, dir)) |
| 36 | 36 | ||
| 37 | try: | 37 | try: |
| 38 | args = [ pipes.quote(str(arg)) for arg in args ] | 38 | args = [ shlex.quote(str(arg)) for arg in args ] |
| 39 | cmd = " ".join(args) | 39 | cmd = " ".join(args) |
| 40 | # print("cmd: %s" % cmd) | 40 | # print("cmd: %s" % cmd) |
| 41 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | 41 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
| @@ -215,7 +215,7 @@ class PatchTree(PatchSet): | |||
| 215 | with open(self.seriespath, 'w') as f: | 215 | with open(self.seriespath, 'w') as f: |
| 216 | for p in patches: | 216 | for p in patches: |
| 217 | f.write(p) | 217 | f.write(p) |
| 218 | 218 | ||
| 219 | def Import(self, patch, force = None): | 219 | def Import(self, patch, force = None): |
| 220 | """""" | 220 | """""" |
| 221 | PatchSet.Import(self, patch, force) | 221 | PatchSet.Import(self, patch, force) |
| @@ -919,4 +919,3 @@ def should_apply(parm, d): | |||
| 919 | return False, "applies to later version" | 919 | return False, "applies to later version" |
| 920 | 920 | ||
| 921 | return True, None | 921 | return True, None |
| 922 | |||
