Skip to contentSkip to conversation

drm/msm: Fix gen_header.py for python earlier than v3.9

PATCH In review Jon Hunter 2 participants 4 messages May 8, 2024 – May 30, 2024

Subsystems (4)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 drm/msm: Fix gen_header.py for python earlier than v3.9

Building the kernel with python3 versions earlier than v3.9 fails with ...

Traceback (most recent call last):
File "drivers/gpu/drm/msm/registers/gen_header.py", line 970, in <module>

     main()

File "drivers/gpu/drm/msm/registers/gen_header.py", line 951, in main
parser.add_argument('--validate', action=argparse.BooleanOptionalAction)
AttributeError: module 'argparse' has no attribute 'BooleanOptionalAction'

The argparse attribute 'BooleanOptionalAction' is only supported for python v3.9 and later. Fix support for earlier python3 versions by explicitly defining '--validate' and '--no-validate' arguments.

---
 drivers/gpu/drm/msm/registers/gen_header.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/registers/gen_header.py +2 -1
index fc3bfdc991d2..64f67d2e3f1c 100644
@@ -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', dest='validate', action='store_true')
+	parser.add_argument('--no-validate', dest='validate', action='store_false')
 
 	subparsers = parser.add_subparsers()
 	subparsers.required = True
Signature · 1 line
2.34.1
#1 lore raw
Quoted 9 lines · Jon Hunter

Building the kernel with python3 versions earlier than v3.9 fails with ...

Traceback (most recent call last):
File "drivers/gpu/drm/msm/registers/gen_header.py", line 970, in <module>
main()
File "drivers/gpu/drm/msm/registers/gen_header.py", line 951, in main
parser.add_argument('--validate', action=argparse.BooleanOptionalAction)
AttributeError: module 'argparse' has no attribute 'BooleanOptionalAction'

Quoted 9 lines

The argparse attribute 'BooleanOptionalAction' is only supported for python v3.9 and later. Fix support for earlier python3 versions by explicitly defining '--validate' and '--no-validate' arguments.

---
  drivers/gpu/drm/msm/registers/gen_header.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks for your patch, I had sent something similar y'day.

If you are alright with https://patchwork.freedesktop.org/patch/593057/, we can use that one.

Quoted 14 lines
drivers/gpu/drm/msm/registers/gen_header.py +2 -1
index fc3bfdc991d2..64f67d2e3f1c 100644
@@ -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', dest='validate', action='store_true')
+	parser.add_argument('--no-validate', dest='validate', action='store_false')
 
  	subparsers = parser.add_subparsers()
  	subparsers.required = True
author maintainer
#2 lore raw
Quoted 22 lines · Abhinav Kumar
Quoted 9 lines · Jon Hunter

Building the kernel with python3 versions earlier than v3.9 fails with ...

  Traceback (most recent call last):
    File "drivers/gpu/drm/msm/registers/gen_header.py", line 970, in <module> main()
    File "drivers/gpu/drm/msm/registers/gen_header.py", line 951, in main parser.add_argument('--validate', action=argparse.BooleanOptionalAction)
  AttributeError: module 'argparse' has no attribute 'BooleanOptionalAction'

Quoted 9 lines

The argparse attribute 'BooleanOptionalAction' is only supported for python v3.9 and later. Fix support for earlier python3 versions by explicitly defining '--validate' and '--no-validate' arguments.

---
  drivers/gpu/drm/msm/registers/gen_header.py | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 3 lines

Thanks for your patch, I had sent something similar y'day.

If you are alright with https://patchwork.freedesktop.org/patch/593057/, we can use that one.

Yes that's fine with me.

Thanks
Jon

Signature · 1 line
nvpublic
author maintainer
#3 lore raw

Abhinav,

Quoted 24 lines · Jon Hunter
Quoted 22 lines · Abhinav Kumar
Quoted 18 lines · Jon Hunter

Building the kernel with python3 versions earlier than v3.9 fails with ...

  Traceback (most recent call last):
    File "drivers/gpu/drm/msm/registers/gen_header.py", line 970, in <module> main()
    File "drivers/gpu/drm/msm/registers/gen_header.py", line 951, in main parser.add_argument('--validate', action=argparse.BooleanOptionalAction)
  AttributeError: module 'argparse' has no attribute 'BooleanOptionalAction'

The argparse attribute 'BooleanOptionalAction' is only supported for python v3.9 and later. Fix support for earlier python3 versions by explicitly defining '--validate' and '--no-validate' arguments.

---
  drivers/gpu/drm/msm/registers/gen_header.py | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 3 lines

Thanks for your patch, I had sent something similar y'day.

If you are alright with https://patchwork.freedesktop.org/patch/593057/, we can use that one.

Yes that's fine with me.

Any update on this? All our farm builders are unable to build either -next or mainline currently.

Jon

Signature · 1 line
nvpublic