diff mbox series

[2.8] fetch2/git: Use quote from shlex, not pipes

Message ID 20241128081341.2190513-1-martin.jansa@gmail.com
State New
Headers show
Series [2.8] fetch2/git: Use quote from shlex, not pipes | expand

Commit Message

Martin Jansa Nov. 28, 2024, 8:13 a.m. UTC
From: Richard Purdie <richard.purdie@linuxfoundation.org>

The pipes module is removed in python 3.13. It was already using the
quote function from shlex so use that directly instead.

The module already imports shlex too so it is an easy substitution.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Richard Purdie Nov. 28, 2024, 11:34 a.m. UTC | #1
On Thu, 2024-11-28 at 09:13 +0100, Martin Jansa wrote:
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> 
> The pipes module is removed in python 3.13. It was already using the
> quote function from shlex so use that directly instead.
> 
> The module already imports shlex too so it is an easy substitution.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/fetch2/git.py | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

I've put that on the branch and will let Steve pick it up from there
for poky.

Cheers,

Richard
Steve Sakoman Nov. 28, 2024, 1:37 p.m. UTC | #2
On Thu, Nov 28, 2024 at 3:34 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Thu, 2024-11-28 at 09:13 +0100, Martin Jansa wrote:
> > From: Richard Purdie <richard.purdie@linuxfoundation.org>
> >
> > The pipes module is removed in python 3.13. It was already using the
> > quote function from shlex so use that directly instead.
> >
> > The module already imports shlex too so it is an easy substitution.
> >
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
> >  lib/bb/fetch2/git.py | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
>
> I've put that on the branch and will let Steve pick it up from there
> for poky.

Done!

Steve
diff mbox series

Patch

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index c7ff769fd..602914460 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -926,9 +926,8 @@  class Git(FetchMethod):
             commits = None
         else:
             if not os.path.exists(rev_file) or not os.path.getsize(rev_file):
-                from pipes import quote
                 commits = bb.fetch2.runfetchcmd(
-                        "git rev-list %s -- | wc -l" % quote(rev),
+                        "git rev-list %s -- | wc -l" % shlex.quote(rev),
                         d, quiet=True).strip().lstrip('0')
                 if commits:
                     open(rev_file, "w").write("%d\n" % int(commits))