All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm/fvp: Backport shlex.join from Python 3.8
@ 2022-12-01 12:44 Peter Hoyes
  2022-12-01 16:03 ` Jon Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Hoyes @ 2022-12-01 12:44 UTC (permalink / raw)
  To: meta-arm; +Cc: Peter Hoyes

From: Peter Hoyes <Peter.Hoyes@arm.com>

721bec25 "arm/fvp: Join cli arguments in verbose logging" changed the
verbose output of FVPRunner to print the generated arguments using
shlex.join instead of as a list. However, this function is only
available in Python >= 3.8, whereas OE-core currently supports Python
3.6.

To fix this, backport its one-line implementation to a local function
shlex_join and update the call site.

Issue-Id: SCM-5314
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Change-Id: I56cab9dddcd0a91272464be15742a6ee726dad41
---
 meta-arm/lib/fvp/runner.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta-arm/lib/fvp/runner.py b/meta-arm/lib/fvp/runner.py
index f55c579d..4fd624ba 100644
--- a/meta-arm/lib/fvp/runner.py
+++ b/meta-arm/lib/fvp/runner.py
@@ -70,6 +70,13 @@ class ConsolePortParser:
                 pass
 
 
+# This function is backported from Python 3.8. Remove it and replace call sites
+# with shlex.join once OE-core support for earlier Python versions is dropped.
+def shlex_join(split_command):
+    """Return a shell-escaped string from *split_command*."""
+    return ' '.join(shlex.quote(arg) for arg in split_command)
+
+
 class FVPRunner:
     def __init__(self, logger):
         self._logger = logger
@@ -88,7 +95,7 @@ class FVPRunner:
             if name in os.environ:
                 env[name] = os.environ[name]
 
-        self._logger.debug(f"Constructed FVP call: {shlex.join(cli)}")
+        self._logger.debug(f"Constructed FVP call: {shlex_join(cli)}")
         self._fvp_process = subprocess.Popen(
             cli,
             stdin=subprocess.DEVNULL, stdout=stdout, stderr=subprocess.STDOUT,
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm/fvp: Backport shlex.join from Python 3.8
  2022-12-01 12:44 [PATCH] arm/fvp: Backport shlex.join from Python 3.8 Peter Hoyes
@ 2022-12-01 16:03 ` Jon Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Mason @ 2022-12-01 16:03 UTC (permalink / raw)
  To: meta-arm, Peter Hoyes; +Cc: Peter Hoyes

On Thu, 1 Dec 2022 12:44:16 +0000, Peter Hoyes wrote:
> 721bec25 "arm/fvp: Join cli arguments in verbose logging" changed the
> verbose output of FVPRunner to print the generated arguments using
> shlex.join instead of as a list. However, this function is only
> available in Python >= 3.8, whereas OE-core currently supports Python
> 3.6.
> 
> To fix this, backport its one-line implementation to a local function
> shlex_join and update the call site.

Applied, thanks!

[1/1] arm/fvp: Backport shlex.join from Python 3.8
      commit: 02b430d045b50d5e5cab9a52b786d1134ba17c19

Best regards,
-- 
Jon Mason <jon.mason@arm.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-01 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 12:44 [PATCH] arm/fvp: Backport shlex.join from Python 3.8 Peter Hoyes
2022-12-01 16:03 ` Jon Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.