[libvirt PATCH 02/11] scripts: group-qemu-caps: store paths in helper variables

Michal Prívozník mprivozn at redhat.com
Wed Aug 25 13:44:28 UTC 2021


On 8/25/21 2:19 PM, Pavel Hrdina wrote:
> On Tue, Aug 24, 2021 at 04:25:05PM +0200, Ján Tomko wrote:
>> Avoid repetition and specifying the path to the header file twice.
>>
>> Signed-off-by: Ján Tomko <jtomko at redhat.com>
>> ---
>>  scripts/group-qemu-caps.py | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/scripts/group-qemu-caps.py b/scripts/group-qemu-caps.py
>> index ec10f24384..bd22dd992a 100755
>> --- a/scripts/group-qemu-caps.py
>> +++ b/scripts/group-qemu-caps.py
>> @@ -133,12 +133,15 @@ args = parser.parse_args()
>>  
>>  errs = False
>>  
>> -capsflags = load_caps_flags(args.prefix + 'src/qemu/qemu_capabilities.h',
>> +header_path = args.prefix + 'src/qemu/qemu_capabilities.h'
>> +source_path = args.prefix + 'src/qemu/qemu_capabilities.c'
> 
> I know that it's preexisting but this is not recommended way how to
> concatenate two or more strings in python.
> 
> I would use
> 
>     os.path.join(args.prefix, 'src/qemu/qemu_capabilities.h')
> 
> instead, or even better:
> 
>     os.path.join(args.prefix, 'src', 'qemu', 'qemu_capabilities.h')

(another non-pythonist here)

Is it so that the path is constructed correctly on OSes which use
backslash instead of forward slash?

Michal




More information about the libvir-list mailing list