[libcamera-devel,00/10] utils: raspberrypi: ctt: Improve JSON pretty printer
mbox series

Message ID 20200703001422.24324-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • utils: raspberrypi: ctt: Improve JSON pretty printer
Related show

Message

Laurent Pinchart July 3, 2020, 12:14 a.m. UTC
Hello,

This patch series improves the JSON pretty printer in the Raspberry Pi
ctt tool. In particular it gets rid of blank lines in empty
dictionaries, addressing Jacopo's comment in reply to "[PATCH v2]
libcamera: ipa: raspberrypi: Enable focus measure without recompile".

The patches have been tested on the JSON files in the
src/ipa/raspberrypi/data/ directory.

Laurent Pinchart (10):
  utils: raspberrypi: ctt: json_pretty_print: Fix printer test
  utils: raspberrypi: ctt: json_pretty_print: Turn printer into a class
  utils: raspberrypi: ctt: json_pretty_print: Make output file a class
    member
  utils: raspberrypi: ctt: json_pretty_print: Make test output to stdout
  utils: raspberrypi: ctt: json_pretty_print: Skip all spaces
  utils: raspberrypi: ctt: json_pretty_print: Add character write method
  utils: raspberrypi: ctt: json_pretty_print: Fix indentation handling
  utils: raspberrypi: ctt: json_pretty_print: Collapse newlines
  utils: raspberrypi: ctt: json_pretty_print: Avoid spaces at end of
    lines
  utils: raspberrypi: ctt: json_pretty_print: Add newline at end of
    output

 .../raspberrypi/ctt/ctt_pretty_print_json.py  | 143 +++++++++++-------
 1 file changed, 87 insertions(+), 56 deletions(-)

Comments

David Plowman July 3, 2020, 2:18 p.m. UTC | #1
Hi Laurent

Thanks for doing all this, that was a totally unexpected but nice
surprise! Anyway, I've downloaded and tried the whole set, and had
just a couple of very minor questions.

1. Can we be bothered to reformat the existing json files? Personally,
I don't mind either way.

2. I found ctt_pretty_print.py did not have executable permissions. Is
that just because I applied the patches to my tree or is it something
we could fix up?

But otherwise, can I add

Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>

for the whole lot?

Thanks again and best regards
David

On Fri, 3 Jul 2020 at 01:14, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hello,
>
> This patch series improves the JSON pretty printer in the Raspberry Pi
> ctt tool. In particular it gets rid of blank lines in empty
> dictionaries, addressing Jacopo's comment in reply to "[PATCH v2]
> libcamera: ipa: raspberrypi: Enable focus measure without recompile".
>
> The patches have been tested on the JSON files in the
> src/ipa/raspberrypi/data/ directory.
>
> Laurent Pinchart (10):
>   utils: raspberrypi: ctt: json_pretty_print: Fix printer test
>   utils: raspberrypi: ctt: json_pretty_print: Turn printer into a class
>   utils: raspberrypi: ctt: json_pretty_print: Make output file a class
>     member
>   utils: raspberrypi: ctt: json_pretty_print: Make test output to stdout
>   utils: raspberrypi: ctt: json_pretty_print: Skip all spaces
>   utils: raspberrypi: ctt: json_pretty_print: Add character write method
>   utils: raspberrypi: ctt: json_pretty_print: Fix indentation handling
>   utils: raspberrypi: ctt: json_pretty_print: Collapse newlines
>   utils: raspberrypi: ctt: json_pretty_print: Avoid spaces at end of
>     lines
>   utils: raspberrypi: ctt: json_pretty_print: Add newline at end of
>     output
>
>  .../raspberrypi/ctt/ctt_pretty_print_json.py  | 143 +++++++++++-------
>  1 file changed, 87 insertions(+), 56 deletions(-)
>
> --
> Regards,
>
> Laurent Pinchart
>
Laurent Pinchart July 3, 2020, 4:12 p.m. UTC | #2
Hi David,

On Fri, Jul 03, 2020 at 03:18:05PM +0100, David Plowman wrote:
> Hi Laurent
> 
> Thanks for doing all this, that was a totally unexpected but nice
> surprise! Anyway, I've downloaded and tried the whole set, and had
> just a couple of very minor questions.
> 
> 1. Can we be bothered to reformat the existing json files? Personally,
> I don't mind either way.

I don't mind either way either. If you think they should be reformated,
please feel free to send patches.

> 2. I found ctt_pretty_print.py did not have executable permissions. Is
> that just because I applied the patches to my tree or is it something
> we could fix up?

It didn't have executable permissions to start with, so I haven't
changed that. As executing it directly is really meant to debug the
code, I'm not sure we should change the permissions. It may give a wrong
impression that it's meant to be a standalone tool directly useful to
the users.

> But otherwise, can I add
> 
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
> Tested-by: David Plowman <david.plowman@raspberrypi.com>
> 
> for the whole lot?

Sure, thanks you :-) I've now pushed the patches.

> On Fri, 3 Jul 2020 at 01:14, Laurent Pinchart wrote:
> >
> > Hello,
> >
> > This patch series improves the JSON pretty printer in the Raspberry Pi
> > ctt tool. In particular it gets rid of blank lines in empty
> > dictionaries, addressing Jacopo's comment in reply to "[PATCH v2]
> > libcamera: ipa: raspberrypi: Enable focus measure without recompile".
> >
> > The patches have been tested on the JSON files in the
> > src/ipa/raspberrypi/data/ directory.
> >
> > Laurent Pinchart (10):
> >   utils: raspberrypi: ctt: json_pretty_print: Fix printer test
> >   utils: raspberrypi: ctt: json_pretty_print: Turn printer into a class
> >   utils: raspberrypi: ctt: json_pretty_print: Make output file a class
> >     member
> >   utils: raspberrypi: ctt: json_pretty_print: Make test output to stdout
> >   utils: raspberrypi: ctt: json_pretty_print: Skip all spaces
> >   utils: raspberrypi: ctt: json_pretty_print: Add character write method
> >   utils: raspberrypi: ctt: json_pretty_print: Fix indentation handling
> >   utils: raspberrypi: ctt: json_pretty_print: Collapse newlines
> >   utils: raspberrypi: ctt: json_pretty_print: Avoid spaces at end of
> >     lines
> >   utils: raspberrypi: ctt: json_pretty_print: Add newline at end of
> >     output
> >
> >  .../raspberrypi/ctt/ctt_pretty_print_json.py  | 143 +++++++++++-------
> >  1 file changed, 87 insertions(+), 56 deletions(-)
Kieran Bingham July 6, 2020, 9:11 a.m. UTC | #3
On 03/07/2020 15:18, David Plowman wrote:
> Hi Laurent
> 
> Thanks for doing all this, that was a totally unexpected but nice
> surprise! Anyway, I've downloaded and tried the whole set, and had
> just a couple of very minor questions.
> 
> 1. Can we be bothered to reformat the existing json files? Personally,
> I don't mind either way.

Presumably, that's only a run of this script now ;-)

And we could then tie it into checkstyle.py too...

But maybe it doesn't matter too much.

--
Kieran


> 2. I found ctt_pretty_print.py did not have executable permissions. Is
> that just because I applied the patches to my tree or is it something
> we could fix up?
> 
> But otherwise, can I add
> 
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
> Tested-by: David Plowman <david.plowman@raspberrypi.com>
> 
> for the whole lot?
> 
> Thanks again and best regards
> David
> 
> On Fri, 3 Jul 2020 at 01:14, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
>>
>> Hello,
>>
>> This patch series improves the JSON pretty printer in the Raspberry Pi
>> ctt tool. In particular it gets rid of blank lines in empty
>> dictionaries, addressing Jacopo's comment in reply to "[PATCH v2]
>> libcamera: ipa: raspberrypi: Enable focus measure without recompile".
>>
>> The patches have been tested on the JSON files in the
>> src/ipa/raspberrypi/data/ directory.
>>
>> Laurent Pinchart (10):
>>   utils: raspberrypi: ctt: json_pretty_print: Fix printer test
>>   utils: raspberrypi: ctt: json_pretty_print: Turn printer into a class
>>   utils: raspberrypi: ctt: json_pretty_print: Make output file a class
>>     member
>>   utils: raspberrypi: ctt: json_pretty_print: Make test output to stdout
>>   utils: raspberrypi: ctt: json_pretty_print: Skip all spaces
>>   utils: raspberrypi: ctt: json_pretty_print: Add character write method
>>   utils: raspberrypi: ctt: json_pretty_print: Fix indentation handling
>>   utils: raspberrypi: ctt: json_pretty_print: Collapse newlines
>>   utils: raspberrypi: ctt: json_pretty_print: Avoid spaces at end of
>>     lines
>>   utils: raspberrypi: ctt: json_pretty_print: Add newline at end of
>>     output
>>
>>  .../raspberrypi/ctt/ctt_pretty_print_json.py  | 143 +++++++++++-------
>>  1 file changed, 87 insertions(+), 56 deletions(-)
>>
>> --
>> Regards,
>>
>> Laurent Pinchart
>>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>