2024-05-07 23:22:23

by Abhinav Kumar

[permalink] [raw]
Subject: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
compilation is broken on machines having python versions older than 3.9
due to dependency on argparse.BooleanOptionalAction.

Switch to use simple bool for the validate flag to remove the dependency.

Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
Signed-off-by: Abhinav Kumar <[email protected]>
---
drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
index fc3bfdc991d2..3926485bb197 100644
--- a/drivers/gpu/drm/msm/registers/gen_header.py
+++ b/drivers/gpu/drm/msm/registers/gen_header.py
@@ -538,7 +538,7 @@ class Parser(object):
self.variants.add(reg.domain)

def do_validate(self, schemafile):
- if self.validate == False:
+ if not self.validate:
return

try:
@@ -948,7 +948,8 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--rnn', type=str, required=True)
parser.add_argument('--xml', type=str, required=True)
- parser.add_argument('--validate', action=argparse.BooleanOptionalAction)
+ parser.add_argument('--validate', default=False, action='store_true')
+ parser.add_argument('--no-validate', dest='validate', action='store_false')

subparsers = parser.add_subparsers()
subparsers.required = True
--
2.44.0



2024-05-08 08:44:13

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

On Tue, 07 May 2024, Abhinav Kumar <[email protected]> wrote:
> Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
> compilation is broken on machines having python versions older than 3.9
> due to dependency on argparse.BooleanOptionalAction.

Is it now okay to require Python for the build? Not listed in
Documentation/process/changes.rst.

BR,
Jani.



>
> Switch to use simple bool for the validate flag to remove the dependency.
>
> Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
> Signed-off-by: Abhinav Kumar <[email protected]>
> ---
> drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
> index fc3bfdc991d2..3926485bb197 100644
> --- a/drivers/gpu/drm/msm/registers/gen_header.py
> +++ b/drivers/gpu/drm/msm/registers/gen_header.py
> @@ -538,7 +538,7 @@ class Parser(object):
> self.variants.add(reg.domain)
>
> def do_validate(self, schemafile):
> - if self.validate == False:
> + if not self.validate:
> return
>
> try:
> @@ -948,7 +948,8 @@ def main():
> parser = argparse.ArgumentParser()
> parser.add_argument('--rnn', type=str, required=True)
> parser.add_argument('--xml', type=str, required=True)
> - parser.add_argument('--validate', action=argparse.BooleanOptionalAction)
> + parser.add_argument('--validate', default=False, action='store_true')
> + parser.add_argument('--no-validate', dest='validate', action='store_false')
>
> subparsers = parser.add_subparsers()
> subparsers.required = True

--
Jani Nikula, Intel

2024-05-08 16:56:00

by Abhinav Kumar

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm



On 5/8/2024 1:43 AM, Jani Nikula wrote:
> On Tue, 07 May 2024, Abhinav Kumar <[email protected]> wrote:
>> Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
>> compilation is broken on machines having python versions older than 3.9
>> due to dependency on argparse.BooleanOptionalAction.
>
> Is it now okay to require Python for the build? Not listed in
> Documentation/process/changes.rst.
>
> BR,
> Jani.
>

The change to move gen_header.py to kernel is already part of the v6.10
pull request.

This change only fixes the version dependency.

But, I agree we should update the changes.rst (better late than never).

Dmitry, can you pls suggest which version we want to list there?

I am hoping that after this change there are no further dependencies on
python versions, so anything > EOL should be fine.

I am leaning towards v3.8

>
>
>>
>> Switch to use simple bool for the validate flag to remove the dependency.
>>
>> Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
>> Signed-off-by: Abhinav Kumar <[email protected]>
>> ---
>> drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
>> index fc3bfdc991d2..3926485bb197 100644
>> --- a/drivers/gpu/drm/msm/registers/gen_header.py
>> +++ b/drivers/gpu/drm/msm/registers/gen_header.py
>> @@ -538,7 +538,7 @@ class Parser(object):
>> self.variants.add(reg.domain)
>>
>> def do_validate(self, schemafile):
>> - if self.validate == False:
>> + if not self.validate:
>> return
>>
>> try:
>> @@ -948,7 +948,8 @@ def main():
>> parser = argparse.ArgumentParser()
>> parser.add_argument('--rnn', type=str, required=True)
>> parser.add_argument('--xml', type=str, required=True)
>> - parser.add_argument('--validate', action=argparse.BooleanOptionalAction)
>> + parser.add_argument('--validate', default=False, action='store_true')
>> + parser.add_argument('--no-validate', dest='validate', action='store_false')
>>
>> subparsers = parser.add_subparsers()
>> subparsers.required = True
>

2024-05-08 22:01:14

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

Quoting Jani Nikula (2024-05-08 01:43:56)
> On Tue, 07 May 2024, Abhinav Kumar <[email protected]> wrote:
> > Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
> > compilation is broken on machines having python versions older than 3.9
> > due to dependency on argparse.BooleanOptionalAction.
>
> Is it now okay to require Python for the build? Not listed in
> Documentation/process/changes.rst.
>

I doubt it is ok. Perl scripts have been replaced with shell scripts in
the past to speed up the build process. See commit e0e2fa4b515c
("headers_install.pl: convert to headers_install.sh") as an example.

2024-05-09 00:28:44

by Doug Anderson

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

Hi,

On Tue, May 7, 2024 at 4:05 PM Abhinav Kumar <quic_abhinavk@quicinccom> wrote:
>
> Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
> compilation is broken on machines having python versions older than 3.9
> due to dependency on argparse.BooleanOptionalAction.
>
> Switch to use simple bool for the validate flag to remove the dependency.
>
> Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
> Signed-off-by: Abhinav Kumar <[email protected]>
> ---
> drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

No idea if we're supposed to allow python as a build dependency. That
being said, I can confirm that this fixes the problem for me since I
ran into it too [1].

Tested-by: Douglas Anderson <[email protected]>

[1] https://lore.kernel.org/r/CAD=FV=XnpS-=CookKxzFM8og9WCSEMxfESmfTYH811438qg4ng@mail.gmail.com

2024-05-09 02:06:18

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

On Thu, May 9, 2024 at 9:28 AM Doug Anderson <[email protected]> wrote:
>
> Hi,
>
> On Tue, May 7, 2024 at 4:05 PM Abhinav Kumar <quic_abhinavk@quicinccom> wrote:
> >
> > Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
> > compilation is broken on machines having python versions older than 3.9
> > due to dependency on argparse.BooleanOptionalAction.
> >
> > Switch to use simple bool for the validate flag to remove the dependency.
> >
> > Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
> > Signed-off-by: Abhinav Kumar <[email protected]>
> > ---
> > drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
>
> No idea if we're supposed to allow python as a build dependency. That
> being said, I can confirm that this fixes the problem for me since I
> ran into it too [1].
>
> Tested-by: Douglas Anderson <[email protected]>
>
> [1] https://lore.kernel.org/r/CAD=FV=XnpS-=CookKxzFM8og9WCSEMxfESmfTYH811438qg4ng@mail.gmail.com
>


I do not like Perl.

IMHO, Python should be OK if Perl is OK.
I agree that the required version should be
documented changes.rst, at least.






--
Best Regards
Masahiro Yamada

2024-05-09 13:07:57

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

On Wed, 8 May 2024 at 02:05, Abhinav Kumar <[email protected]> wrote:
>
> Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
> compilation is broken on machines having python versions older than 3.9
> due to dependency on argparse.BooleanOptionalAction.
>
> Switch to use simple bool for the validate flag to remove the dependency.
>
> Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
> Signed-off-by: Abhinav Kumar <[email protected]>
> ---
> drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Dmitry Baryshkov <[email protected]>


--
With best wishes
Dmitry

2024-05-20 18:59:03

by Doug Anderson

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

Hi,

On Tue, May 7, 2024 at 4:05 PM Abhinav Kumar <quic_abhinavk@quicinccom> wrote:
>
> Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
> compilation is broken on machines having python versions older than 3.9
> due to dependency on argparse.BooleanOptionalAction.
>
> Switch to use simple bool for the validate flag to remove the dependency.
>
> Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
> Signed-off-by: Abhinav Kumar <[email protected]>
> ---
> drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

FWIW, it looks like the commit this is fixing is now present in
Linus's tree. Is there any plan to land this fix? It would be nifty if
it could somehow make it in time for -rc1 so I don't need to track
down this patch every time I need to build a subsystem tree for the
next several weeks...

-Doug

2024-05-30 16:55:02

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: remove python 3.9 dependency for compiling msm

On Wed May 8, 2024 at 1:04 AM CEST, Abhinav Kumar wrote:
> Since commit 5acf49119630 ("drm/msm: import gen_header.py script from Mesa"),
> compilation is broken on machines having python versions older than 3.9
> due to dependency on argparse.BooleanOptionalAction.
>
> Switch to use simple bool for the validate flag to remove the dependency.
>
> Fixes: 5acf49119630 ("drm/msm: import gen_header.py script from Mesa")
> Signed-off-by: Abhinav Kumar <[email protected]>
> ---
> drivers/gpu/drm/msm/registers/gen_header.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

Irrespective of whether we want to allow Python as a build dependency or
not, it already is since v6.10-rc1, so in the meantime I'm going to
apply this to drm-misc-fixes to unbreak things.

If we decide that we don't want the extra dependency we need revert the
whole generation infrastructure.

Thierry


Attachments:
signature.asc (849.00 B)