[Mesa-dev] Make the output of the Python build scripts more reproducible

2018-06-27 Thread Mathieu Bridon
I ported the Mesa build system to Python 3. The result of this work can be seen on my fork: https://gitlab.freedesktop.org/bochecha/mesa/tree/python3 When porting, I tried to ensure that the generated files are identical to the ones generated by a build on master. This was made difficult by

[Mesa-dev] [PATCH 2/2] build: Specify the JSON separators

2018-06-27 Thread Mathieu Bridon
On Python 2, the default JSON separators are ', ' for items and ': ' for dicts. On Python 3, the default is the same when no indent is specified, but if one is (and we do specify one) then the default items separator becomes ',' (the dict separator remains unchanged). This change explicitly

[Mesa-dev] [PATCH 1/2] build: Stabilize some script outputs

2018-06-27 Thread Mathieu Bridon
In Python, dictionaries and sets are unordered, and as a result their is no guarantee that running this script twice will produce the same output. Using ordered dicts and explicitly sorting items makes the build more reproducible, and will make it possible to verify that we're not breaking

[Mesa-dev] [PATCH v3] python: Rework bytes/unicode string handling

2018-08-10 Thread Mathieu Bridon
us concatenate unicode and byte strings directly, and that Python 2's stdout wants encoded byte strings while Python 3's want unicode strings. With these changes, the script gives the same output on both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/util/xmlpool/gen_xmlpool.py | 41

[Mesa-dev] [PATCH v2 4/9] python: Do not mix bytes and unicode strings

2018-08-09 Thread Mathieu Bridon
Mixing the two is a long-standing recipe for errors in Python 2, so much so that Python 3 now completely separates them. This commit stops treating both as if they were the same, and in the process makes the script compatible with both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src

[Mesa-dev] [PATCH v2 9/9] meson: Build with Python 3

2018-08-09 Thread Mathieu Bridon
Now that all the build scripts are compatible with both Python 2 and 3, we can flip the switch and tell Meson to use the latter. Since Meson already depends on Python 3 anyway, this means we don't need two different Python stacks to build Mesa. Signed-off-by: Mathieu Bridon Reviewed-by: Eric

[Mesa-dev] [PATCH v2 6/9] python: Use key-functions when sorting containers

2018-08-09 Thread Mathieu Bridon
and Python 3. Signed-off-by: Mathieu Bridon --- src/mapi/mapi_abi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py index e4ce2b6caf..d4c48ec430 100644 --- a/src/mapi/mapi_abi.py +++ b/src/mapi/mapi_abi.py @@ -32,6 +32,7 @@

[Mesa-dev] [PATCH v2 5/9] python: Better check for integer types

2018-08-09 Thread Mathieu Bridon
Python 3 lost the long type: now everything is an int, with the right size. This commit makes the script compatible with Python 2 (where we check for both int and long) and Python 3 (where we only check for int). Signed-off-by: Mathieu Bridon --- src/compiler/nir/nir_algebraic.py

[Mesa-dev] [PATCH v2 8/9] python: Rework bytes/unicode string handling

2018-08-09 Thread Mathieu Bridon
output on both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/util/xmlpool/gen_xmlpool.py | 35 +++-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/util/xmlpool/gen_xmlpool.py b/src/util/xmlpool/gen_xmlpool.py index b0db183854..db20e2767f

[Mesa-dev] [PATCH v2 7/9] python: Simplify list sorting

2018-08-09 Thread Mathieu Bridon
Instead of copying the list, then sorting the copy in-place, we can just get a new sorted copy directly. Signed-off-by: Mathieu Bridon --- src/mapi/mapi_abi.py | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py index d4c48ec430

[Mesa-dev] [PATCH v2 2/9] python: Use the right function for the job

2018-08-09 Thread Mathieu Bridon
The code was just reimplementing itertools.combinations_with_replacement in a less efficient way. This does change the order of the results slightly, but it should be ok. Signed-off-by: Mathieu Bridon --- src/compiler/nir/nir_opt_algebraic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[Mesa-dev] [PATCH v2 3/9] python: Explicitly use a list

2018-08-09 Thread Mathieu Bridon
-by: Mathieu Bridon --- src/mesa/main/get_hash_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/get_hash_generator.py b/src/mesa/main/get_hash_generator.py index facdccd8a5..37dae45e0b 100644 --- a/src/mesa/main/get_hash_generator.py +++ b/src/mesa/main

[Mesa-dev] [PATCH v2 1/9] python: Fix inequality comparisons

2018-08-09 Thread Mathieu Bridon
this issue, in a way that is compatible with both Python 2 and 3. However, this means the __eq__ methods are now called when testing for `foo != None`, so they need to be guarded correctly. Signed-off-by: Mathieu Bridon --- src/amd/vulkan/vk_format_parse.py| 6 ++ src/gallium

Re: [Mesa-dev] [PATCH v2 2/5] meson: use python3 module to find python3

2018-08-16 Thread Mathieu Bridon
On Thu, 2018-08-16 at 11:00 +0100, Eric Engestrom wrote: > On Wednesday, 2018-08-15 09:18:05 -0700, Dylan Baker wrote: > > This handy helper is nice for OSes that are not linux or BSD like > > (mac > > and windows) as it knows how to find python3 in odd places. > > --- > > meson.build | 2 +- > >

Re: [Mesa-dev] [PATCH v2 9/9] meson: Build with Python 3

2018-08-16 Thread Mathieu Bridon
Hi Emil, On Thu, 2018-08-16 at 17:11 +0100, Emil Velikov wrote: > On 9 August 2018 at 09:27, Mathieu Bridon > wrote: > > Now that all the build scripts are compatible with both Python 2 > > and 3, we can flip the switch and tell Meson to use the latter. > > > &g

Re: [Mesa-dev] [PATCH 1/2] compiler/glsl/tests: Make tests python3 safe

2018-08-16 Thread Mathieu Bridon
On Thu, 2018-08-16 at 14:21 -0700, Dylan Baker wrote: > --- > > I didn't see any patches from anyone else, so I wrote some real > quick. Please > point to them if other patches already exist. I was about to send mine, but you were faster. >_< They ar every similar though, except that you missed

Re: [Mesa-dev] [PATCH v3] python: Rework bytes/unicode string handling

2018-08-17 Thread Mathieu Bridon
On Fri, 2018-08-17 at 13:29 +0100, Jose Fonseca wrote: > This change caused one of our MSVC build machines to fail with > > scons: Building targets ... >Generating build\windows-x86-debug\util\xmlpool\options.h ... > Traceback (most recent call last): >File

Re: [Mesa-dev] Fix the build on Windows

2018-08-17 Thread Mathieu Bridon
On Fri, 2018-08-17 at 09:23 -0600, Brian Paul wrote: > On 08/17/2018 09:16 AM, Mathieu Bridon wrote: > > This is follow up to my recent patches which made the Python build > > scripts compatible with both Python 2 and 3, then moved the Meson > > build > > system

[Mesa-dev] [PATCH 2/2] python: Open the template as text, with an explicit encoding

2018-08-17 Thread Mathieu Bridon
In commit bd27203f4d808763ac24ac94eb677cacf3e7cb99 we changed this to open in binary mode, to then explicitly decode the lines with the right encoding. Unfortunately, that broke the build on Windows, where the template file can have '\r\n' as line terminators: opening in binary mode would keep

[Mesa-dev] [PATCH 1/2] python: Help Python 2 print the line

2018-08-17 Thread Mathieu Bridon
Reviewed-by: Jose Fonseca --- src/util/xmlpool/gen_xmlpool.py | 5 + 1 file changed, 5 insertions(+) diff --git a/src/util/xmlpool/gen_xmlpool.py b/src/util/xmlpool/gen_xmlpool.py index 327709c7f8d..12177dc50f5 100644 --- a/src/util/xmlpool/gen_xmlpool.py +++

[Mesa-dev] Fix the build on Windows

2018-08-17 Thread Mathieu Bridon
This is follow up to my recent patches which made the Python build scripts compatible with both Python 2 and 3, then moved the Meson build system to using Python 3 for them. Unfortunately, one thing I hadn't tested was running them on Windows, where the changes broke the build. See the exchange

[Mesa-dev] [PATCH] python: Help Python 2 print the line

2018-08-17 Thread Mathieu Bridon
--- Jose, can you test whether this patch fixes your build issues? I don't have access to a Windows machine, and I can't reproduce your problem on Linux. src/util/xmlpool/gen_xmlpool.py | 5 + 1 file changed, 5 insertions(+) diff --git a/src/util/xmlpool/gen_xmlpool.py

Re: [Mesa-dev] [PATCH] python: Help Python 2 print the line

2018-08-17 Thread Mathieu Bridon
On Fri, 2018-08-17 at 15:30 +0100, Jose Fonseca wrote: > On 17/08/18 15:26, Mathieu Bridon wrote: > > On Fri, 2018-08-17 at 15:08 +0100, Jose Fonseca wrote: > > > On 17/08/18 15:06, Jose Fonseca wrote: > > > > On 17/08/18 14:52, Jose Fonseca wrote: > > > &g

Re: [Mesa-dev] [PATCH] python: Help Python 2 print the line

2018-08-17 Thread Mathieu Bridon
On Fri, 2018-08-17 at 15:08 +0100, Jose Fonseca wrote: > On 17/08/18 15:06, Jose Fonseca wrote: > > On 17/08/18 14:52, Jose Fonseca wrote: > > > On 17/08/18 14:30, Jose Fonseca wrote: > > > > On 17/08/18 14:22, Mathieu Bridon wrote: > > > > > --- &g

Re: [Mesa-dev] [PATCH 1/2] compiler/glsl/tests: Make tests python3 safe

2018-08-17 Thread Mathieu Bridon
On Fri, 2018-08-17 at 10:45 -0700, Dylan Baker wrote: > Quoting Mathieu Bridon (2018-08-16 15:00:39) > > On Thu, 2018-08-16 at 14:21 -0700, Dylan Baker wrote: > > > --- > > > > > > I didn't see any patches from anyone else, so I wrote some real > > &g

Re: [Mesa-dev] [PATCH v2 1/2] compiler/glsl/tests: Make tests python3 safe

2018-08-17 Thread Mathieu Bridon
On Fri, 2018-08-17 at 10:51 -0700, Dylan Baker wrote: > diff --git a/src/compiler/glsl/tests/optimization_test.py > b/src/compiler/glsl/tests/optimization_test.py > index 577d2dfc20f..65bac676963 100755 > --- a/src/compiler/glsl/tests/optimization_test.py > +++

Re: [Mesa-dev] [PATCH 2/3] configure: allow building with python3

2018-08-24 Thread Mathieu Bridon
Hi, On Thu, 2018-08-23 at 23:23 -0400, Ilia Mirkin wrote: > This breaks the build for me. It selects python3 instead of python2, > and gen_xmlpool.py bails out when trying to print \xf3 to stdout with > a LANG=C locale. In general though, Python 3 works very badly with LANG=C. Upstream Python

Re: [Mesa-dev] [PATCH 3/3] meson: Run the test with Python 3

2018-08-17 Thread Mathieu Bridon
On Fri, 2018-08-17 at 12:54 -0700, Dylan Baker wrote: > Quoting Mathieu Bridon (2018-08-17 12:32:18) > > --- > > src/compiler/glsl/glcpp/meson.build | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/src/compiler/glsl/glcpp/meson.bu

[Mesa-dev] [PATCH 3/3] meson: Run the test with Python 3

2018-08-17 Thread Mathieu Bridon
--- src/compiler/glsl/glcpp/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/glcpp/meson.build b/src/compiler/glsl/glcpp/meson.build index 09d44ddd687..769406f5331 100644 --- a/src/compiler/glsl/glcpp/meson.build +++

[Mesa-dev] [PATCH 2/3] python: Disable universal newlines

2018-08-17 Thread Mathieu Bridon
We are testing the behaviour of a tool, for different input files, each one using a different newline sequence. ('\n' on UNIX, '\r\n' on Windows, …) Unfortunately, when opening a file in text mode, Python 3 will by default enable the "universal newlines" mode, which means it replaces all the

[Mesa-dev] [PATCH 1/3] python: difflib prefers unicode strings

2018-08-17 Thread Mathieu Bridon
Python 3 does not automatically convert from bytes to unicode strings like Python 2 used to do. This commit makes sure we pass unicode strings to difflib.unified_diff, so that the script works on both Python 2 and 3. --- src/compiler/glsl/glcpp/tests/glcpp_test.py | 3 ++- 1 file changed, 2

[Mesa-dev] [PATCH] meson: Run the install script with Python 3

2018-08-22 Thread Mathieu Bridon
The script was being run directly as an executable, and it has a Python 2 shebang. --- src/gallium/targets/dri/meson.build | 1 + src/gallium/targets/va/meson.build| 1 + src/gallium/targets/vdpau/meson.build | 1 + src/gallium/targets/xvmc/meson.build | 1 +

Re: [Mesa-dev] [PATCH v3 1/2] compiler/glsl/tests: Make tests python3 safe

2018-08-22 Thread Mathieu Bridon
I just learned I was supposed to send this :) Reviewed-by: Mathieu Bridon On Fri, 2018-08-17 at 11:07 -0700, Dylan Baker wrote: > v2: - explicitly decode the output of subprocesses > - handle bytes and string types consistently rather than relying > on > python 2's coerci

Re: [Mesa-dev] [PATCH] meson: Run the install script with Python 3

2018-08-22 Thread Mathieu Bridon
On Wed, 2018-08-22 at 15:17 +0100, Emil Velikov wrote: > On 22 August 2018 at 13:09, Mathieu Bridon > wrote: > > The script was being run directly as an executable, and it has a > > Python 2 shebang. > > Please drop the execute bit and shebang - be that with th

Re: [Mesa-dev] [PATCH v3 2/2] meson: Use python3 to run glsl tests

2018-08-22 Thread Mathieu Bridon
Reviewed-by: Mathieu Bridon On Fri, 2018-08-17 at 11:07 -0700, Dylan Baker wrote: > --- > src/compiler/glsl/tests/meson.build | 11 --- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/src/compiler/glsl/tests/meson.build > b/src/compiler/glsl/tests/m

Re: [Mesa-dev] [PATCH] meson: Run the install script with Python 3

2018-08-22 Thread Mathieu Bridon
On Wed, 2018-08-22 at 16:18 +0100, Emil Velikov wrote: > On 22 August 2018 at 15:42, Mathieu Bridon > wrote: > > On Wed, 2018-08-22 at 15:17 +0100, Emil Velikov wrote: > > > On 22 August 2018 at 13:09, Mathieu Bridon > > > wrote: > > > > The scri

[Mesa-dev] [PATCH] python: Remove shebang and executable bit

2018-08-22 Thread Mathieu Bridon
Since the script is never executed directly, but launched by Meson as an argument to the Python interpreter, those are not needed any more. In addition, they are the reason this script was missed when I moved the Meson buildsystem to Python 3, so removing them helps avoiding future confusion. ---

[Mesa-dev] [PATCH v2 11/26] python: Fix rich comparisons

2018-07-17 Thread Mathieu Bridon
methods which are actually used by the build scripts. Signed-off-by: Mathieu Bridon --- src/amd/vulkan/radv_extensions.py | 5 +++-- src/intel/vulkan/anv_extensions.py | 5 +++-- src/mapi/mapi_abi.py | 15 +++ 3 files changed, 13 insertions(+), 12 deletions(-) diff

[Mesa-dev] [PATCH v3 10/26] python: Use explicit integer divisions

2018-07-25 Thread Mathieu Bridon
.2, so let's use it everywhere to make the scripts compatible with both Python 2 and 3. In addition, using __future__.division tells Python 2 to behave the same way as Python 3, which helps ensure the scripts produce the same output in both versions of Python. Signed-off-by: Mathieu Bridon Reviewed-by:

[Mesa-dev] [PATCH] build: Fix string matching

2018-07-05 Thread Mathieu Bridon
Commit f69bc797e15fe6beb9e439009fab55f7fae0b7f9 did the following: -if format.layout in ('bptc', 'astc'): +if format.layout in ('astc'): The intention was to go from matching either 'bptc' or 'astc' to matching only 'astc'. But the new code doesn't respect this intention any

[Mesa-dev] [PATCH 26/26] meson: Build with Python 3

2018-07-05 Thread Mathieu Bridon
Now that all the build scripts are compatible with both Python 2 and 3, we can flip the switch and tell Meson to use the latter. Since Meson already depends on Python 3 anyway, this means we don't need two different Python stacks to build Mesa. Signed-off-by: Mathieu Bridon --- meson.build

[Mesa-dev] [PATCH 16/26] python: Explicitly use lists

2018-07-05 Thread Mathieu Bridon
-off-by: Mathieu Bridon --- src/compiler/nir/nir_opt_algebraic.py | 2 +- src/mesa/main/get_hash_generator.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 5e07d662b0..7b2ba56990 100644

[Mesa-dev] [PATCH 24/26] python: Use the unicode_escape codec

2018-07-05 Thread Mathieu Bridon
Python 2 had string_escape and unicode_escape codecs. Python 3 only has the latter. These work the same as far as we're concerned, so let's use the future-proof one. However, the reste of the code expects unicode strings, so we need to decode them again. Signed-off-by: Mathieu Bridon --- src

[Mesa-dev] [PATCH 23/26] python: Rework bytes/unicode string handling

2018-07-05 Thread Mathieu Bridon
output on both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/util/xmlpool/gen_xmlpool.py | 35 +++-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/util/xmlpool/gen_xmlpool.py b/src/util/xmlpool/gen_xmlpool.py index b0db183854..db20e2767f

[Mesa-dev] [PATCH 11/26] python: Fix rich comparisons

2018-07-05 Thread Mathieu Bridon
-by: Mathieu Bridon --- src/amd/vulkan/radv_extensions.py | 6 +- src/intel/vulkan/anv_extensions.py | 6 +- src/mapi/mapi_abi.py | 13 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan

[Mesa-dev] [PATCH 19/26] python: Don't abuse hex()

2018-07-05 Thread Mathieu Bridon
method, which can return whatever we want, in Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/compiler/nir/nir_algebraic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 63a7cb5ad1

[Mesa-dev] [PATCH 21/26] python: Use key-functions when sorting containers

2018-07-05 Thread Mathieu Bridon
and Python 3. Signed-off-by: Mathieu Bridon --- src/mapi/mapi_abi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py index 67fdb10650..19fdc4572a 100644 --- a/src/mapi/mapi_abi.py +++ b/src/mapi/mapi_abi.py @@ -32,6 +32,7 @@

[Mesa-dev] [PATCH 22/26] python: Use open(), not file()

2018-07-05 Thread Mathieu Bridon
The latter is a constructor for file objects, but when actually opening a file, using the former is more idiomatic. In addition, file() is not a builtin any more in Python 3, so this makes the script compatible with both Python 2 and Python 3. Signed-off-by: Mathieu Bridon --- src/util/xmlpool

[Mesa-dev] [PATCH 20/26] python: Open file in binary mode

2018-07-05 Thread Mathieu Bridon
. Explicitly specifying the binary mode ('rb') makes the behaviour identical in both Python 2 and 3, returning what the XML parser expects. Signed-off-by: Mathieu Bridon --- src/intel/genxml/gen_bits_header.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/genxml

[Mesa-dev] [PATCH 14/26] python: Better get character ordinals

2018-07-05 Thread Mathieu Bridon
corresponding to each byte in the string, removing the need to call ord(). This makes the script compatible with both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/intel/genxml/gen_zipped_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/genxml

[Mesa-dev] [PATCH 18/26] python: Better check for integer types

2018-07-05 Thread Mathieu Bridon
Python 3 lost the long type: now everything is an int, with the right size. This commit makes the script compatible with Python 2 (where we check for both int and long) and Python 3 (where we only check for int). Signed-off-by: Mathieu Bridon --- src/compiler/nir/nir_algebraic.py

[Mesa-dev] [PATCH 25/26] python: Explicitly add the 'L' suffix on Python 3

2018-07-05 Thread Mathieu Bridon
it explicitly means that both Python 2 and 3 generate the exact same C code anyway, which makes it easier to compare and check for discrepencies when moving to Python 3. Signed-off-by: Mathieu Bridon --- src/compiler/nir/nir_algebraic.py | 11 ++- 1 file changed, 10 insertions(+), 1 deletion

[Mesa-dev] [PATCH 02/26] python: Use spaces, not tabs

2018-07-05 Thread Mathieu Bridon
Python 3 doesn't allow mixing spaces and tabs in a script, contrarily to Python 2. Signed-off-by: Mathieu Bridon --- src/mapi/glapi/gen/glX_proto_size.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen

[Mesa-dev] meson: Build with Python 3

2018-07-05 Thread Mathieu Bridon
This patch series allows building Mesa with Python 3. The build scripts are kept compatible with Python 2 as well, for those platforms which don't have Python 3 yet. In fact, only the Meson build system is moved to Python 3, since it is the only one I'm 100% sure has Python 3 available. (Meson

[Mesa-dev] [PATCH 06/26] python: Better iterate over dictionaries

2018-07-05 Thread Mathieu Bridon
iterators to keys()/values()/items(). Using those names makes the scripts compatible with both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- src/compiler/nir/nir_algebraic.py| 2 +- src/compiler/nir/nir_builder_opcodes_h.py

[Mesa-dev] [PATCH 05/26] python: Stop using the string module

2018-07-05 Thread Mathieu Bridon
Most functions in the builtin string module also exist as methods of string objects. Since the functions were removed from the string module in Python 3, using the instance methods directly makes the code compatible with both Python 2 and Python 3. Signed-off-by: Mathieu Bridon --- src/mapi

[Mesa-dev] [PATCH 09/26] python: Use range() instead of xrange()

2018-07-05 Thread Mathieu Bridon
. Signed-off-by: Mathieu Bridon --- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- src/broadcom/cle/gen_pack_header.py | 2 +- src/compiler/glsl/ir_expression_operation.py | 2 +- src/compiler/nir/nir_opcodes.py | 4 ++-- src/intel/vulkan/anv_entrypoints_gen.py | 2

[Mesa-dev] [PATCH 13/26] python: Explicitly use byte strings

2018-07-05 Thread Mathieu Bridon
(); This commit fixes this by explicitly using byte strings where appropriate, so that the script works on both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/intel/genxml/gen_zipped_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/genxml

[Mesa-dev] [PATCH 08/26] python: Better use iterators

2018-07-05 Thread Mathieu Bridon
in Python 2.6, so using it makes the script compatible with Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/compiler/glsl/ir_expression_operation.py | 4 +++- src/compiler/nir/nir_algebraic.py| 4 ++-- src/mapi/glapi/gen/glX_XML.py| 17 + src

[Mesa-dev] [PATCH 15/26] python: Specify the template output encoding

2018-07-05 Thread Mathieu Bridon
compatible with both versions of Python. Signed-off-by: Mathieu Bridon --- src/compiler/nir/nir_intrinsics_c.py | 2 +- src/compiler/nir/nir_intrinsics_h.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_intrinsics_c.py b/src/compiler/nir

[Mesa-dev] [PATCH 17/26] python: Better check for string types

2018-07-05 Thread Mathieu Bridon
Python 2 byte strings were called "str", and its unicode strings were called "unicode". In Python 3, they are called "bytes" and "str". This commit makes the script compatible with Python 2 and Python 3, checking for the right types on both. Signed-off-b

[Mesa-dev] [PATCH 07/26] python: Better sort dictionary keys/values

2018-07-05 Thread Mathieu Bridon
() method. This commit moves the build scripts to using sorted() on dict keys and values, which makes them compatible with both Python 2 and Python 3. Signed-off-by: Mathieu Bridon --- src/mapi/glapi/gen/glX_proto_send.py | 3 +-- src/mapi/glapi/gen/glX_proto_size.py | 6 ++ src/mapi/glapi/gen

[Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons

2018-07-05 Thread Mathieu Bridon
this issue, in a way that is compatible with both Python 2 and 3. However, this means the __eq__ methods are now called when testing for `foo != None`, so they need to be guarded correctly. Signed-off-by: Mathieu Bridon --- src/amd/vulkan/vk_format_parse.py| 6 ++ src/gallium

[Mesa-dev] [PATCH 10/26] python: Use explicit integer divisions

2018-07-05 Thread Mathieu Bridon
In Python 2, divisions return an integer: >>> 32 / 4 8 In Python 3 though, they return floats: >>> 32 / 4 8.0 Explicitly converting to integers make the scripts compatible with both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/gallium/auxiliary/uti

[Mesa-dev] [PATCH 03/26] python: Use the Python 3 exception syntax

2018-07-05 Thread Mathieu Bridon
This is compatible with Python versions >= 2.6. Signed-off-by: Mathieu Bridon --- src/mapi/glapi/gen/glX_XML.py | 2 +- src/mapi/glapi/gen/gl_XML.py| 6 +++--- src/mapi/glapi/gen/gl_marshal.py| 2 +- src/mapi/glapi/gen/gl_marshal_h.py | 2 +- src/mesa/m

[Mesa-dev] [PATCH 04/26] python: Better check for keys in dicts

2018-07-05 Thread Mathieu Bridon
Python 3 lost the dict.has_key() method. Instead it requires using the "in" operator. This is also compatible with Python 2. Signed-off-by: Mathieu Bridon --- src/mapi/glapi/gen/glX_XML.py| 2 +- src/mapi/glapi/gen/glX_proto_send.py | 2 +- src/mapi/glapi/gen/glX_proto_si

Re: [Mesa-dev] [PATCH 01/26] python: Use the print function

2018-07-05 Thread Mathieu Bridon
On Thu, 2018-07-05 at 08:40 -0700, Dylan Baker wrote: > This is a really big patch that should be mostly mechanical, It's mostly me running `2to3 --fix=print` on all those Python scripts, and adding the `from __future__ import print_function` so that it's compatible with Python 2. In a few rare

Re: [Mesa-dev] [PATCH 15/26] python: Specify the template output encoding

2018-07-06 Thread Mathieu Bridon
On Thu, 2018-07-05 at 09:14 -0700, Dylan Baker wrote: > Does it make more sense to encode, or to use io.open and open the > file in text mode? I've gone back and forth on this myself several > times. Same here, both seem equally valid and I can't really make my mind up on which one to pick. The

[Mesa-dev] [PATCH 07/26] python: Better sort dictionary keys/values

2018-07-06 Thread Mathieu Bridon
() method. This commit moves the build scripts to using sorted() on dict keys and values, which makes them compatible with both Python 2 and Python 3. Signed-off-by: Mathieu Bridon --- src/mapi/glapi/gen/glX_proto_send.py | 3 +-- src/mapi/glapi/gen/glX_proto_size.py | 6 ++ src/mapi/glapi/gen

Re: [Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons

2018-07-06 Thread Mathieu Bridon
On Thu, 2018-07-05 at 09:10 -0700, Dylan Baker wrote: > Quoting Mathieu Bridon (2018-07-05 06:17:43) > > +def __ne__(self, other): > > +return not self.__eq__(other) > > This can be written as "not (self == other)", right? It can, yes. The `==` oper

Re: [Mesa-dev] [PATCH 06/26] python: Better iterate over dictionaries

2018-07-06 Thread Mathieu Bridon
On Thu, 2018-07-05 at 08:48 -0700, Dylan Baker wrote: > I've asked a couple of people who have (in the past at least) had a > hard requirement on python 2.x if moving to 3.x will be okay for > them. If it's not then we may need to do something else here. I've > used six in the past (although I

[Mesa-dev] [PATCH 04/26] python: Better check for keys in dicts

2018-07-06 Thread Mathieu Bridon
Python 3 lost the dict.has_key() method. Instead it requires using the "in" operator. This is also compatible with Python 2. Signed-off-by: Mathieu Bridon --- src/mapi/glapi/gen/glX_XML.py| 2 +- src/mapi/glapi/gen/glX_proto_send.py | 2 +- src/mapi/glapi/gen/glX_proto_si

Re: [Mesa-dev] [PATCH 16/26] python: Explicitly use lists

2018-07-06 Thread Mathieu Bridon
On Thu, 2018-07-05 at 09:31 -0700, Dylan Baker wrote: > Quoting Mathieu Bridon (2018-07-05 06:17:47) > > On Python 2, the builtin functions filter() and zip() would return > > lists. > > > > On Python 3, they return iterators. > > > > Since we want to use

[Mesa-dev] [PATCH 06/26] python: Better iterate over dictionaries

2018-07-06 Thread Mathieu Bridon
iterators to keys()/values()/items(). Using those names makes the scripts compatible with both Python 2 and 3. Signed-off-by: Mathieu Bridon --- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- src/compiler/nir/nir_algebraic.py| 2 +- src/compiler/nir/nir_builder_opcodes_h.py

[Mesa-dev] [PATCH 03/26] python: Stop using the Python 2 exception syntax

2018-07-06 Thread Mathieu Bridon
We could have made this compatible with Python 3 by using: except Exception as e: But since none of this code actually uses the exception objects, let's just drop them entirely. Signed-off-by: Mathieu Bridon --- src/mapi/glapi/gen/glX_XML.py | 2 +- src/mapi/glapi/gen/gl_XML.py

[Mesa-dev] [PATCH 09/26] python: Use range() instead of xrange()

2018-07-06 Thread Mathieu Bridon
. Signed-off-by: Mathieu Bridon --- src/amd/vulkan/radv_entrypoints_gen.py | 2 +- src/broadcom/cle/gen_pack_header.py | 2 +- src/compiler/glsl/ir_expression_operation.py | 2 +- src/compiler/nir/nir_opcodes.py | 4 ++-- src/intel/vulkan/anv_entrypoints_gen.py | 2

[Mesa-dev] [PATCH v2 10/26] python: Use explicit integer divisions

2018-07-11 Thread Mathieu Bridon
et's use it everywhere to make the scripts compatible with both Python 2 and 3. In addition, using __future__.division tells Python 2 to behave the same way as Python 3, which helps ensure the scripts produce the same output in both versions of Python. Signed-off-by: Mathieu Bridon --- src/gallium/auxili

[Mesa-dev] [PATCH 11/26] python: Fix rich comparisons

2018-07-11 Thread Mathieu Bridon
-by: Mathieu Bridon --- src/amd/vulkan/radv_extensions.py | 6 +- src/intel/vulkan/anv_extensions.py | 6 +- src/mapi/mapi_abi.py | 13 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan

Re: [Mesa-dev] Lets talk about autotools

2018-09-20 Thread Mathieu Bridon
On Thu, 2018-09-20 at 15:56 +0100, Eric Engestrom wrote: > On Thursday, 2018-09-20 15:28:09 +0100, Emil Velikov wrote: > > Hi Chuck, > > > > On 18 September 2018 at 16:00, Chuck Atkins < > > chuck.atk...@kitware.com> wrote: > > > First, I'm fully in support of killing off autotools woo-hoo to > >

Re: [Mesa-dev] Lets talk about autotools

2018-09-17 Thread Mathieu Bridon
desOn Mon, 2018-09-17 at 10:11 -0700, Matt Turner wrote: > On Mon, Sep 17, 2018 at 9:46 AM Dylan Baker > wrote: > > > > I feel like for !windows meson is in good enough shape at this > > point that we can start having the discussion about deleting the > > autotools build. > > So, is there

Re: [Mesa-dev] Lets talk about autotools

2018-09-18 Thread Mathieu Bridon
On Mon, 2018-09-17 at 20:56 -0400, Ilia Mirkin wrote: > I'd also encourage writing a new "configure" script which > echo's instructions on how to operate meson -- it's really not > obvious, with alternating --prefix=bla -Dfoo=bla argument styles. > People know how to use autotools, but meson is a