diff mbox series

meson: Use subprocess.check_output()

Message ID 20230812091111.13411-1-akihiko.odaki@daynix.com
State New
Headers show
Series meson: Use subprocess.check_output() | expand

Commit Message

Akihiko Odaki Aug. 12, 2023, 9:11 a.m. UTC
subprocess.check_output() is a more concise way to execute a subprocess
here.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
Based-on: <20230812061540.5398-1-akihiko.odaki@daynix.com>
("[PATCH] meson: Fix MESONINTROSPECT parsing")

 scripts/symlink-install-tree.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Michael Tokarev Aug. 12, 2023, 9:51 a.m. UTC | #1
12.08.2023 12:11, Akihiko Odaki wrote:
> subprocess.check_output() is a more concise way to execute a subprocess
> here.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> Based-on: <20230812061540.5398-1-akihiko.odaki@daynix.com>
> ("[PATCH] meson: Fix MESONINTROSPECT parsing")
> 
>   scripts/symlink-install-tree.py | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py
> index b72563895c..56d603588f 100644
> --- a/scripts/symlink-install-tree.py
> +++ b/scripts/symlink-install-tree.py
> @@ -15,8 +15,7 @@ def destdir_join(d1: str, d2: str) -> str:
>       return str(PurePath(d1, *PurePath(d2).parts[1:]))
>   
>   introspect = os.environ.get('MESONINTROSPECT')
> -out = subprocess.run([*shlex.split(introspect), '--installed'],
> -                     stdout=subprocess.PIPE, check=True).stdout
> +out = subprocess.check_output([*shlex.split(introspect), '--installed'])
>   for source, dest in json.loads(out).items():
>       bundle_dest = destdir_join('qemu-bundle', dest)
>       path = os.path.dirname(bundle_dest)

Yes, this works too and is shorter and easier to read.

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Michael Tokarev <mjt@tls.msk.ru>

Thanks!

/mjt
Thomas Huth Aug. 23, 2023, 8:33 a.m. UTC | #2
On 12/08/2023 11.11, Akihiko Odaki wrote:
> subprocess.check_output() is a more concise way to execute a subprocess
> here.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> Based-on: <20230812061540.5398-1-akihiko.odaki@daynix.com>
> ("[PATCH] meson: Fix MESONINTROSPECT parsing")

Since that other patch has never been merged, this patch here does not apply 
to master ... could you maybe respin it for the plain master branch?

  Thomas
Michael Tokarev Aug. 23, 2023, 8:36 a.m. UTC | #3
23.08.2023 11:33, Thomas Huth wrote:
> On 12/08/2023 11.11, Akihiko Odaki wrote:
>> subprocess.check_output() is a more concise way to execute a subprocess
>> here.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>> Based-on: <20230812061540.5398-1-akihiko.odaki@daynix.com>
>> ("[PATCH] meson: Fix MESONINTROSPECT parsing")
> 
> Since that other patch has never been merged, this patch here does not apply to master ... could you maybe respin it for the plain master branch?

Both patches should be applied, that one first, this one second.
I don't think it needs a respin, just a proper patch series.

/mjt
Thomas Huth Aug. 23, 2023, 8:42 a.m. UTC | #4
On 23/08/2023 10.36, Michael Tokarev wrote:
> 23.08.2023 11:33, Thomas Huth wrote:
>> On 12/08/2023 11.11, Akihiko Odaki wrote:
>>> subprocess.check_output() is a more concise way to execute a subprocess
>>> here.
>>>
>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>> ---
>>> Based-on: <20230812061540.5398-1-akihiko.odaki@daynix.com>
>>> ("[PATCH] meson: Fix MESONINTROSPECT parsing")
>>
>> Since that other patch has never been merged, this patch here does not 
>> apply to master ... could you maybe respin it for the plain master branch?
> 
> Both patches should be applied, that one first, this one second.
> I don't think it needs a respin, just a proper patch series.

Ok, I'll try to pick both patches for my next pull request.

  Thomas
Thomas Huth Aug. 23, 2023, 8:45 a.m. UTC | #5
On 23/08/2023 10.42, Thomas Huth wrote:
> On 23/08/2023 10.36, Michael Tokarev wrote:
>> 23.08.2023 11:33, Thomas Huth wrote:
>>> On 12/08/2023 11.11, Akihiko Odaki wrote:
>>>> subprocess.check_output() is a more concise way to execute a subprocess
>>>> here.
>>>>
>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>> ---
>>>> Based-on: <20230812061540.5398-1-akihiko.odaki@daynix.com>
>>>> ("[PATCH] meson: Fix MESONINTROSPECT parsing")
>>>
>>> Since that other patch has never been merged, this patch here does not 
>>> apply to master ... could you maybe respin it for the plain master branch?
>>
>> Both patches should be applied, that one first, this one second.
>> I don't think it needs a respin, just a proper patch series.
> 
> Ok, I'll try to pick both patches for my next pull request.

Ah, no, Akihiko said "Please do NOT merge this" on the other patch, so let's 
wait 'til the issue with Windows has been resolved first.

  Thomas
diff mbox series

Patch

diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py
index b72563895c..56d603588f 100644
--- a/scripts/symlink-install-tree.py
+++ b/scripts/symlink-install-tree.py
@@ -15,8 +15,7 @@  def destdir_join(d1: str, d2: str) -> str:
     return str(PurePath(d1, *PurePath(d2).parts[1:]))
 
 introspect = os.environ.get('MESONINTROSPECT')
-out = subprocess.run([*shlex.split(introspect), '--installed'],
-                     stdout=subprocess.PIPE, check=True).stdout
+out = subprocess.check_output([*shlex.split(introspect), '--installed'])
 for source, dest in json.loads(out).items():
     bundle_dest = destdir_join('qemu-bundle', dest)
     path = os.path.dirname(bundle_dest)