Skip to contentSkip to conversation

Mesa >= 23.3.x and python 2.6 ...

PATCH Stefan Dirsch 4 participants 10 messages Jan 18, 2024 – Jan 21, 2024

lore
Share & tools
lore
#0 lore raw

Hi

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

It fails with

[   95s] Traceback (most recent call last):
[   95s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[   95s]     import intel_genxml
[   95s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_
genxml.py", line 5
[   95s]     from __future__ import annotations
[   95s]     ^
[   95s] SyntaxError: future feature annotations is not defined

When removing __future__ line like this

src/intel/genxml/intel_genxml.py 2024-01-12 10:26:38.682317490 +0100 renamed from src/intel/genxml/intel_genxml.py.orig 2024-01-12 10:26:26.314070540 +0100 +0 -1
@@ -2,7 +2,6 @@
 # Copyright © 2019, 2022 Intel Corporation
 # SPDX-License-Identifier: MIT
 
-from __future__ import annotations
 from collections import OrderedDict
 import copy
 import io

this results in the following failure.

[  113s] Traceback (most recent call last):
[  113s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[  113s]     import intel_genxml
[  113s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_

genxml.py", line 51, in <module>
[ 113s] def add_struct_refs(items: typing.OrderedDict[str, bool], node: et.
Element) -> None:
[ 113s] AttributeError: module 'typing' has no attribute 'OrderedDict'

I'm wondering if Mesa developers are interested in still supporting python 3.6?

Unfortunately currently it's not an option for SUSE's enterprise product to update to a newer python (would be probably 3.12) (due to many customers still relying on python 3.6 and we lack the ressources of adding and maintaining a (full!) second python development stack). :-(

If the answer to the question above is a no. :-( How hard would it be to adjust the code to python 3.6? Any suggestions to how it could be done? Or is there any other workaround available?

I had a quick look between 23.2.1 and 23.3.3 and I've seen that

from __future__ import annotations

and

typing.OrderedDict

have already been used in 23.2.1 (although it was in gen_sort_tags.py and now has been moved to new intel_genxml.py). So not sure why this fails now or was working before ...

Any help here would be appreciated. SUSE is definitely interested in shipping the latest Mesa with our latest enterprise product.

Thanks,
Stefan

Public Key available
------------------------------------------------------

Stefan Dirsch (Res. & Dev.)   SUSE Software Solutions Germany GmbH
Tel: 0911-740 53 0            Frankenstraße 146
FAX: 0911-740 53 479          D-90461 Nürnberg
http://www.suse.de            Germany 

----------------------------------------------------------------
Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman (HRB 36809, AG Nürnberg)
----------------------------------------------------------------

#1 lore raw
Quoted 4 lines · Stefan Dirsch

Hi

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

I've meant python 3.6 of course!

CU,
Stefan

Public Key available
------------------------------------------------------

Stefan Dirsch (Res. & Dev.)   SUSE Software Solutions Germany GmbH
Tel: 0911-740 53 0            Frankenstraße 146
FAX: 0911-740 53 479          D-90461 Nürnberg
http://www.suse.de            Germany 

----------------------------------------------------------------
Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman (HRB 36809, AG Nürnberg)
----------------------------------------------------------------

#2 lore raw
In reply to Stefan Dirsch
Quoted 2 lines · Stefan Dirsch

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

For anyone who got this far and was completely incredulous... this (and the subject) is typo'd -- the problem is about Python 3.6, not 2.6.

#3 lore raw
Quoted 7 lines · Matt Turner
Quoted 2 lines · Stefan Dirsch

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

For anyone who got this far and was completely incredulous... this (and the subject) is typo'd -- the problem is about Python 3.6, not 2.6.

I'm pretty sure you were the first and only one. :-( I've corrected it in the body by doing a reply to my own message, but how do I correct a typo in the subject ... I'll try to send the message again with also the correct subject. Then I'll be blamed for bringing up the same topic twice and spamming the list. Sigh.

Thanks for having a look at the message nevertheless!

Thanks,
Stefan

Public Key available
------------------------------------------------------

Stefan Dirsch (Res. & Dev.)   SUSE Software Solutions Germany GmbH
Tel: 0911-740 53 0            Frankenstraße 146
FAX: 0911-740 53 479          D-90461 Nürnberg
http://www.suse.de            Germany 

----------------------------------------------------------------
Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman (HRB 36809, AG Nürnberg)
----------------------------------------------------------------

#4 lore raw

Re: Mesa >= 23.3.x and python 3.6 (was a typo 2.6) …

Quoted 11 lines · Stefan Dirsch
Quoted 9 lines · Matt Turner
Quoted 3 lines · Stefan Dirsch

I noticed that with version 23.3.x Mesa no longer can be built with python
2.6. It still worked with Mesa 23.2.1.

For anyone who got this far and was completely incredulous... this (and the subject) is typo'd -- the problem is about Python 3.6, not 2.6.

Quoted 8 lines

I'm pretty sure you were the first and only one. :-( I've corrected it in the
body by doing a reply to my own message, but how do I correct a typo in the
subject ... I'll try to send the message again with also the correct subject. Then I'll be blamed for bringing up the same topic twice and spamming
the list. Sigh.

Don't worry, just fix the title while replying. You can also add something like "(was a typo 2.6)" as I just did in this email, so that people who read by thread would be aware this isn't about python2 😊

#5 lore raw
In reply to Stefan Dirsch
Quoted 4 lines · Stefan Dirsch

Hi

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

As mentioned in other emails, this was typo where 3.6 was intended.

Quoted 12 lines

It fails with

[   95s] Traceback (most recent call last):
[   95s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[   95s]     import intel_genxml
[   95s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_
genxml.py", line 5
[   95s]     from __future__ import annotations
[   95s]     ^
[   95s] SyntaxError: future feature annotations is not defined

I guess this code first appeared in Dylan's:

4fd2e15855d ("intel/genxml: add type annotations to gen_sort_tags.py")

and then became part of the standard tests a few commits later in:

1f0a0a46d97 ("meson: run genxml sort tests")

back in Oct 2022. So, I guess at that point 'ninja test' would have failed with Python 3.6.

Then, I suppose I propagated this to being used on every build in:

0495f952d48 ("intel/genxml: Add genxml_import.py script")

in Sept 2023.

Maybe Dylan knows how we might make this compatible with Python 3.6, assuming we want to. :)

https://devguide.python.org/versions/

-Jordan

#6 lore raw

Hi Jordan

Thanks for digging into this!

Quoted 29 lines · Jordan Justen
Quoted 4 lines · Stefan Dirsch

Hi

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

As mentioned in other emails, this was typo where 3.6 was intended.

Quoted 12 lines

It fails with

[   95s] Traceback (most recent call last):
[   95s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[   95s]     import intel_genxml
[   95s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_
genxml.py", line 5
[   95s]     from __future__ import annotations
[   95s]     ^
[   95s] SyntaxError: future feature annotations is not defined

I guess this code first appeared in Dylan's:

4fd2e15855d ("intel/genxml: add type annotations to gen_sort_tags.py")

and then became part of the standard tests a few commits later in:

1f0a0a46d97 ("meson: run genxml sort tests")

Quoted 8 lines

back in Oct 2022. So, I guess at that point 'ninja test' would have failed with Python 3.6.

Then, I suppose I propagated this to being used on every build in:

0495f952d48 ("intel/genxml: Add genxml_import.py script")

in Sept 2023.

Thanks. This explains why I've found this code already in older releases, but it didn't fail for me yet. You said tests. Is this just a test, I could disable (as dirty hack)? I was assuming it would generate code ...

Quoted 4 lines

Maybe Dylan knows how we might make this compatible with Python 3.6, assuming we want to. :)

https://devguide.python.org/versions/

Yes, I know. It's EOL since a long time now ... sigh

Thanks,
Stefan

Public Key available
------------------------------------------------------

Stefan Dirsch (Res. & Dev.)   SUSE Software Solutions Germany GmbH
Tel: 0911-740 53 0            Frankenstraße 146
FAX: 0911-740 53 479          D-90461 Nürnberg
http://www.suse.de            Germany 

----------------------------------------------------------------
Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman (HRB 36809, AG Nürnberg)
----------------------------------------------------------------

#7 lore raw
Quoted 39 lines · Stefan Dirsch

Hi Jordan

Thanks for digging into this!

Quoted 34 lines · Jordan Justen
Quoted 4 lines · Stefan Dirsch

Hi

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

As mentioned in other emails, this was typo where 3.6 was intended.

Quoted 12 lines

It fails with

[   95s] Traceback (most recent call last):
[   95s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[   95s]     import intel_genxml
[   95s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_
genxml.py", line 5
[   95s]     from __future__ import annotations
[   95s]     ^
[   95s] SyntaxError: future feature annotations is not defined

I guess this code first appeared in Dylan's:

4fd2e15855d ("intel/genxml: add type annotations to gen_sort_tags.py")

and then became part of the standard tests a few commits later in:

1f0a0a46d97 ("meson: run genxml sort tests")

back in Oct 2022. So, I guess at that point 'ninja test' would have failed with Python 3.6.

Then, I suppose I propagated this to being used on every build in:

Quoted 7 lines
Quoted 3 lines

0495f952d48 ("intel/genxml: Add genxml_import.py script")

in Sept 2023.

Thanks. This explains why I've found this code already in older releases, but it didn't fail for me yet. You said tests. Is this just a test, I could disable (as dirty hack)? I was assuming it would generate code ...

In 0495f952d48, I moved in to a common file, and essentially, now it's used by our script that runs during the build in addition to the test.

It was "fun" finding a way to get python 3.6 :), but after that, I think I found a way to make Python 3.6 work. I guess you can try it out:

https://gitlab.freedesktop.org/jljusten/mesa/-/commits/intel-genxml-python3.6

In my light testing, Python 3.6 through 3.13 seemed to work. Python 3.5 did *not* work.

-Jordan

#8 lore raw

Hi Jordan

Quoted 51 lines · Jordan Justen
Quoted 39 lines · Stefan Dirsch

Hi Jordan

Thanks for digging into this!

Quoted 34 lines · Jordan Justen
Quoted 4 lines · Stefan Dirsch

Hi

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

As mentioned in other emails, this was typo where 3.6 was intended.

Quoted 12 lines

It fails with

[   95s] Traceback (most recent call last):
[   95s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[   95s]     import intel_genxml
[   95s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_
genxml.py", line 5
[   95s]     from __future__ import annotations
[   95s]     ^
[   95s] SyntaxError: future feature annotations is not defined

I guess this code first appeared in Dylan's:

4fd2e15855d ("intel/genxml: add type annotations to gen_sort_tags.py")

and then became part of the standard tests a few commits later in:

1f0a0a46d97 ("meson: run genxml sort tests")

back in Oct 2022. So, I guess at that point 'ninja test' would have failed with Python 3.6.

Then, I suppose I propagated this to being used on every build in:

Quoted 7 lines
Quoted 3 lines

0495f952d48 ("intel/genxml: Add genxml_import.py script")

in Sept 2023.

Thanks. This explains why I've found this code already in older releases, but it didn't fail for me yet. You said tests. Is this just a test, I could disable (as dirty hack)? I was assuming it would generate code ...

In 0495f952d48, I moved in to a common file, and essentially, now it's used by our script that runs during the build in addition to the test.

Quoted 8 lines

It was "fun" finding a way to get python 3.6 :), but after that, I think I found a way to make Python 3.6 work. I guess you can try it out:

https://gitlab.freedesktop.org/jljusten/mesa/-/commits/intel-genxml-python3.6

In my light testing, Python 3.6 through 3.13 seemed to work. Python 3.5 did *not* work.

Wow! Thanks a lot! Indeed these two patches fix this build issue for me! :-)

In addition I needed to add the attached patch to fix some more errors I saw with a python 3.6 build. With that I can build again Mesa 23.3.3.

Thanks,
Stefan

Public Key available
------------------------------------------------------

Stefan Dirsch (Res. & Dev.)   SUSE Software Solutions Germany GmbH
Tel: 0911-740 53 0            Frankenstraße 146
FAX: 0911-740 53 479          D-90461 Nürnberg
http://www.suse.de            Germany 

----------------------------------------------------------------
Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman (HRB 36809, AG Nürnberg)
----------------------------------------------------------------

src/nouveau/nvidia-headers/class_parser.py renamed from src/nouveau/nvidia-headers/class_parser.py.orig +17 -7
@@ -9,6 +9,16 @@
 
 from mako.template import Template
 
+def removeprefix(s, prefix):
+    if s.startswith(prefix):
+        return s[len(prefix):]
+    return s
+
+def removesuffix(s, suffix):
+    if s.endswith(suffix):
+        return s[:-len(suffix)]
+    return s
+
 METHOD_ARRAY_SIZES = {
     'BIND_GROUP_CONSTANT_BUFFER'        : 16,
     'CALL_MME_DATA'                     : 256,
@@ -273,7 +283,7 @@
                 if ":" in list[2]:
                     state = 1
                 elif teststr in list[1]:
-                    curmthd.field_defs[curfield][list[1].removeprefix(teststr)] = list[2]
+                    curmthd.field_defs[curfield][removeprefix(list[1], teststr)] = list[2]
                 else:
                     state = 1
 
@@ -283,7 +293,7 @@
                     if ("0x" in list[2]):
                         state = 1
                     else:
-                        field = list[1].removeprefix(teststr)
+                        field = removeprefix(list[1], teststr)
                         bitfield = list[2].split(":")
                         curmthd.field_name_start[field] = bitfield[1]
                         curmthd.field_name_end[field] = bitfield[0]
@@ -304,13 +314,13 @@
                 is_array = 0
                 if (':' in list[2]):
                     continue
-                name = list[1].removeprefix(teststr)
+                name = removeprefix(list[1], teststr)
                 if name.endswith("(i)"):
                     is_array = 1
-                    name = name.removesuffix("(i)")
+                    name = removesuffix(name, "(i)")
                 if name.endswith("(j)"):
                     is_array = 1
-                    name = name.removesuffix("(j)")
+                    name = removesuffix(name, "(j)")
                 x = method()
                 x.name = name
                 x.addr = list[2]
@@ -336,8 +346,8 @@
 
     clheader = os.path.basename(args.in_h)
     nvcl = clheader
-    nvcl = nvcl.removeprefix("cl")
-    nvcl = nvcl.removesuffix(".h")
+    nvcl = removeprefix(nvcl, "cl")
+    nvcl = removesuffix(nvcl, ".h")
     nvcl = nvcl.upper()
     nvcl = "NV" + nvcl
 
src/freedreno/registers/gen_header.py renamed from src/freedreno/registers/gen_header.py.orig +1 -1
@@ -781,7 +781,7 @@ def main():
 	parser.add_argument('--rnn', type=str, required=True)
 	parser.add_argument('--xml', type=str, required=True)
 
-	subparsers = parser.add_subparsers(required=True)
+	subparsers = parser.add_subparsers()
 
 	parser_c_defines = subparsers.add_parser('c-defines')
 	parser_c_defines.set_defaults(func=dump_c_defines)
#9 lore raw

Re: Mesa >= 23.3.x no longer supporting python 3.6 ...

In reply to Stefan Dirsch
Quoted 4 lines · Stefan Dirsch

Hi

I noticed that with version 23.3.x Mesa no longer can be built with python 2.6. It still worked with Mesa 23.2.1.

Of course I've meant python 3.6. Sorry for the confusion!

Quoted 53 lines

It fails with

[   95s] Traceback (most recent call last):
[   95s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[   95s]     import intel_genxml
[   95s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_
genxml.py", line 5
[   95s]     from __future__ import annotations
[   95s]     ^
[   95s] SyntaxError: future feature annotations is not defined

When removing __future__ line like this

src/intel/genxml/intel_genxml.py 2024-01-12 10:26:38.682317490 +0100 renamed from src/intel/genxml/intel_genxml.py.orig 2024-01-12 10:26:26.314070540 +0100 +0 -1
@@ -2,7 +2,6 @@
 # Copyright © 2019, 2022 Intel Corporation
 # SPDX-License-Identifier: MIT
 
-from __future__ import annotations
 from collections import OrderedDict
 import copy
 import io

this results in the following failure.

[  113s] Traceback (most recent call last):
[  113s]   File "../src/intel/genxml/gen_bits_header.py", line 23, in <module>
[  113s]     import intel_genxml
[  113s]   File "/home/abuild/rpmbuild/BUILD/mesa-23.3.3/src/intel/genxml/intel_

genxml.py", line 51, in <module>
[ 113s] def add_struct_refs(items: typing.OrderedDict[str, bool], node: et.
Element) -> None:
[ 113s] AttributeError: module 'typing' has no attribute 'OrderedDict'

I'm wondering if Mesa developers are interested in still supporting python 3.6?

Unfortunately currently it's not an option for SUSE's enterprise product to update to a newer python (would be probably 3.12) (due to many customers still relying on python 3.6 and we lack the ressources of adding and maintaining a (full!) second python development stack). :-(

If the answer to the question above is a no. :-( How hard would it be to adjust the code to python 3.6? Any suggestions to how it could be done? Or is there any other workaround available?

I had a quick look between 23.2.1 and 23.3.3 and I've seen that

from __future__ import annotations

and

Quoted 8 lines

typing.OrderedDict

have already been used in 23.2.1 (although it was in gen_sort_tags.py and now has been moved to new intel_genxml.py). So not sure why this fails now or was working before ...

Any help here would be appreciated. SUSE is definitely interested in shipping the latest Mesa with our latest enterprise product.

Thanks,
Stefan

Public Key available
------------------------------------------------------

Stefan Dirsch (Res. & Dev.)   SUSE Software Solutions Germany GmbH
Tel: 0911-740 53 0            Frankenstraße 146
FAX: 0911-740 53 479          D-90461 Nürnberg
http://www.suse.de            Germany 

----------------------------------------------------------------
Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman (HRB 36809, AG Nürnberg)
----------------------------------------------------------------