Mesa (main): python: drop python2 support

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 14 22:06:58 UTC 2021


Module: Mesa
Branch: main
Commit: f1eae2f8bbe1225f17594e4b1e5221555a0e5f96
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1eae2f8bbe1225f17594e4b1e5221555a0e5f96

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Sun Feb  2 18:25:47 2020 +0000

python: drop python2 support

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
Acked-by: Jose Fonseca <jfonseca at vmware.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3674>

---

 bin/install_megadrivers.py                             |  1 -
 bin/meson_get_version.py                               |  1 -
 src/amd/common/gfx10_format_table.py                   |  2 --
 src/amd/common/sid_tables.py                           |  2 --
 src/amd/registers/canonicalize.py                      |  2 --
 src/amd/registers/makeregheader.py                     |  2 --
 src/amd/registers/mergedbs.py                          |  2 --
 src/amd/registers/parseheader.py                       |  2 --
 src/amd/registers/regdb.py                             |  2 --
 src/broadcom/cle/gen_pack_header.py                    |  3 ---
 src/compiler/glsl/glcpp/tests/glcpp_test.py            |  1 -
 src/compiler/glsl/tests/lower_precision_test.py        |  1 -
 src/compiler/glsl/tests/optimization_test.py           |  1 -
 src/compiler/glsl/tests/sexps.py                       |  8 ++------
 src/compiler/glsl/tests/warnings_test.py               |  1 -
 src/compiler/nir/nir_algebraic.py                      | 18 ++++--------------
 src/compiler/nir/nir_builder_opcodes_h.py              |  2 --
 src/compiler/nir/nir_constant_expressions.py           |  2 --
 src/compiler/nir/nir_opcodes_c.py                      |  2 --
 src/compiler/nir/nir_opcodes_h.py                      |  2 --
 src/compiler/nir/nir_opt_algebraic.py                  |  2 --
 src/freedreno/ir3/ir3_nir_imul.py                      |  2 --
 src/freedreno/ir3/ir3_nir_trig.py                      |  2 --
 src/gallium/auxiliary/indices/u_indices_gen.py         |  2 --
 src/gallium/auxiliary/indices/u_unfilled_gen.py        |  2 --
 src/gallium/drivers/r600/egd_tables.py                 |  2 --
 .../drivers/swr/rasterizer/codegen/gen_archrast.py     |  1 -
 .../drivers/swr/rasterizer/codegen/gen_backends.py     |  2 --
 .../drivers/swr/rasterizer/codegen/gen_common.py       |  1 -
 .../drivers/swr/rasterizer/codegen/gen_knobs.py        |  1 -
 .../swr/rasterizer/codegen/gen_llvm_ir_macros.py       |  1 -
 .../drivers/swr/rasterizer/codegen/gen_llvm_types.py   |  1 -
 src/intel/compiler/brw_nir_trig_workarounds.py         |  2 --
 src/intel/genxml/gen_bits_header.py                    |  4 ----
 src/intel/genxml/gen_pack_header.py                    |  3 ---
 src/intel/genxml/gen_zipped_file.py                    |  1 -
 src/intel/isl/gen_format_layout.py                     |  8 ++------
 src/mapi/glapi/gen/glX_proto_common.py                 |  2 --
 src/mapi/glapi/gen/glX_proto_send.py                   |  2 --
 src/mapi/glapi/gen/glX_proto_size.py                   |  2 --
 src/mapi/glapi/gen/gl_SPARC_asm.py                     |  2 --
 src/mapi/glapi/gen/gl_XML.py                           |  2 --
 src/mapi/glapi/gen/gl_apitemp.py                       |  2 --
 src/mapi/glapi/gen/gl_enums.py                         |  2 --
 src/mapi/glapi/gen/gl_genexec.py                       |  2 --
 src/mapi/glapi/gen/gl_gentable.py                      |  2 --
 src/mapi/glapi/gen/gl_marshal.py                       |  2 --
 src/mapi/glapi/gen/gl_marshal_h.py                     |  2 --
 src/mapi/glapi/gen/gl_procs.py                         |  2 --
 src/mapi/glapi/gen/gl_table.py                         |  2 --
 src/mapi/glapi/gen/gl_x86-64_asm.py                    |  2 --
 src/mapi/glapi/gen/gl_x86_asm.py                       |  2 --
 src/mapi/glapi/gen/remap_helper.py                     |  2 --
 src/mapi/glapi/gen/typeexpr.py                         |  2 --
 src/mapi/mapi_abi.py                                   |  2 --
 src/mesa/main/format_info.py                           |  2 --
 src/mesa/main/get_hash_generator.py                    |  2 --
 src/util/format/u_format_pack.py                       | 13 ++-----------
 src/util/format/u_format_parse.py                      |  1 -
 src/util/format/u_format_table.py                      |  2 --
 src/util/format_srgb.py                                |  2 --
 src/util/xxd.py                                        |  1 -
 src/vulkan/util/gen_enum_to_str.py                     |  1 -
 63 files changed, 10 insertions(+), 144 deletions(-)

diff --git a/bin/install_megadrivers.py b/bin/install_megadrivers.py
index 0a28dd7c0c5..60ee4576c60 100644
--- a/bin/install_megadrivers.py
+++ b/bin/install_megadrivers.py
@@ -22,7 +22,6 @@
 
 """Script to install megadriver symlinks for meson."""
 
-from __future__ import print_function
 import argparse
 import os
 
diff --git a/bin/meson_get_version.py b/bin/meson_get_version.py
index 2e631d23673..9a44aa8fab6 100644
--- a/bin/meson_get_version.py
+++ b/bin/meson_get_version.py
@@ -20,7 +20,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-from __future__ import print_function
 import os
 
 
diff --git a/src/amd/common/gfx10_format_table.py b/src/amd/common/gfx10_format_table.py
index 83c21199d3e..9701499f8f1 100644
--- a/src/amd/common/gfx10_format_table.py
+++ b/src/amd/common/gfx10_format_table.py
@@ -24,8 +24,6 @@
 Script that generates the mapping from Gallium PIPE_FORMAT_xxx to GFX10_FORMAT_xxx enums.
 """
 
-from __future__ import absolute_import, division, print_function, unicode_literals
-
 import json
 import mako.template
 import os
diff --git a/src/amd/common/sid_tables.py b/src/amd/common/sid_tables.py
index 6fc2ad01cef..c8fd312935b 100644
--- a/src/amd/common/sid_tables.py
+++ b/src/amd/common/sid_tables.py
@@ -1,5 +1,3 @@
-from __future__ import print_function, division, unicode_literals
-
 CopyRight = '''
 /*
  * Copyright 2015-2019 Advanced Micro Devices, Inc.
diff --git a/src/amd/registers/canonicalize.py b/src/amd/registers/canonicalize.py
index a1b7023a201..73c5452653d 100644
--- a/src/amd/registers/canonicalize.py
+++ b/src/amd/registers/canonicalize.py
@@ -33,8 +33,6 @@ Notes about deduced register types as well as the output JSON are printed on
 stdout.
 """
 
-from __future__ import absolute_import, division, print_function, unicode_literals
-
 from collections import defaultdict
 import json
 import re
diff --git a/src/amd/registers/makeregheader.py b/src/amd/registers/makeregheader.py
index 770d67847f5..37618840162 100644
--- a/src/amd/registers/makeregheader.py
+++ b/src/amd/registers/makeregheader.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import, division, print_function, unicode_literals
-
 COPYRIGHT = '''
 /*
  * Copyright 2015-2019 Advanced Micro Devices, Inc.
diff --git a/src/amd/registers/mergedbs.py b/src/amd/registers/mergedbs.py
index 2a469e7a0d4..312aeb32d80 100644
--- a/src/amd/registers/mergedbs.py
+++ b/src/amd/registers/mergedbs.py
@@ -28,8 +28,6 @@ Helper script to merge register database JSON files.
 Will merge the given JSON files and output the result on stdout.
 """
 
-from __future__ import absolute_import, division, print_function, unicode_literals
-
 from collections import defaultdict
 import json
 import re
diff --git a/src/amd/registers/parseheader.py b/src/amd/registers/parseheader.py
index d6602b7f6ff..9dd054361b0 100644
--- a/src/amd/registers/parseheader.py
+++ b/src/amd/registers/parseheader.py
@@ -30,8 +30,6 @@ This script is included for reference -- we should be able to remove this in
 the future.
 """
 
-from __future__ import absolute_import, division, print_function, unicode_literals
-
 import json
 import math
 import re
diff --git a/src/amd/registers/regdb.py b/src/amd/registers/regdb.py
index 0167365d7c8..dab3e66731b 100644
--- a/src/amd/registers/regdb.py
+++ b/src/amd/registers/regdb.py
@@ -24,8 +24,6 @@
 Python package containing common tools for manipulating register JSON.
 """
 
-from __future__ import absolute_import, division, print_function, unicode_literals
-
 import itertools
 import json
 import re
diff --git a/src/broadcom/cle/gen_pack_header.py b/src/broadcom/cle/gen_pack_header.py
index cc9e4a03ec2..0090b616d50 100644
--- a/src/broadcom/cle/gen_pack_header.py
+++ b/src/broadcom/cle/gen_pack_header.py
@@ -22,9 +22,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import (
-    absolute_import, division, print_function, unicode_literals
-)
 import xml.parsers.expat
 import re
 import sys
diff --git a/src/compiler/glsl/glcpp/tests/glcpp_test.py b/src/compiler/glsl/glcpp/tests/glcpp_test.py
index 0772770f5b2..b034754c963 100644
--- a/src/compiler/glsl/glcpp/tests/glcpp_test.py
+++ b/src/compiler/glsl/glcpp/tests/glcpp_test.py
@@ -21,7 +21,6 @@
 
 """Run glcpp tests with various line endings."""
 
-from __future__ import print_function
 import argparse
 import difflib
 import errno
diff --git a/src/compiler/glsl/tests/lower_precision_test.py b/src/compiler/glsl/tests/lower_precision_test.py
index 0ee67e0c45b..51b00993235 100644
--- a/src/compiler/glsl/tests/lower_precision_test.py
+++ b/src/compiler/glsl/tests/lower_precision_test.py
@@ -19,7 +19,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-from __future__ import print_function
 import sys
 import subprocess
 import tempfile
diff --git a/src/compiler/glsl/tests/optimization_test.py b/src/compiler/glsl/tests/optimization_test.py
index 06627283474..7f5bdd665c6 100644
--- a/src/compiler/glsl/tests/optimization_test.py
+++ b/src/compiler/glsl/tests/optimization_test.py
@@ -21,7 +21,6 @@
 
 """Script to generate and run glsl optimization tests."""
 
-from __future__ import print_function
 import argparse
 import difflib
 import errno
diff --git a/src/compiler/glsl/tests/sexps.py b/src/compiler/glsl/tests/sexps.py
index 7de5db39be6..36fd7251eb3 100644
--- a/src/compiler/glsl/tests/sexps.py
+++ b/src/compiler/glsl/tests/sexps.py
@@ -29,10 +29,6 @@
 
 import re
 import sys
-if sys.version_info >= (3, 0, 0):
-    STRING_TYPE = str
-else:
-    STRING_TYPE = unicode
 
 def check_sexp(sexp):
     """Verify that the argument is a proper sexp.
@@ -44,7 +40,7 @@ def check_sexp(sexp):
     if isinstance(sexp, list):
         for s in sexp:
             check_sexp(s)
-    elif not isinstance(sexp, (STRING_TYPE, bytes)):
+    elif not isinstance(sexp, (str, bytes)):
         raise Exception('Not a sexp: {0!r}'.format(sexp))
 
 def parse_sexp(sexp):
@@ -75,7 +71,7 @@ def sexp_to_string(sexp):
     """Convert a sexp, represented as nested lists containing strings,
     into a single string of the form parseable by mesa.
     """
-    if isinstance(sexp, STRING_TYPE):
+    if isinstance(sexp, str):
         return sexp
     if isinstance(sexp, bytes):
         return sexp.encode('utf-8')
diff --git a/src/compiler/glsl/tests/warnings_test.py b/src/compiler/glsl/tests/warnings_test.py
index 61a1413b917..fed5a75f236 100644
--- a/src/compiler/glsl/tests/warnings_test.py
+++ b/src/compiler/glsl/tests/warnings_test.py
@@ -19,7 +19,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-from __future__ import print_function
 import argparse
 import errno
 import os
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 37fefd87a6b..2a4354a7378 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -23,7 +23,6 @@
 # Authors:
 #    Jason Ekstrand (jason at jlekstrand.net)
 
-from __future__ import print_function
 import ast
 from collections import defaultdict
 import itertools
@@ -60,15 +59,6 @@ def get_c_opcode(op):
       else:
          return 'nir_op_' + op
 
-
-if sys.version_info < (3, 0):
-    integer_types = (int, long)
-    string_type = unicode
-
-else:
-    integer_types = (int, )
-    string_type = str
-
 _type_re = re.compile(r"(?P<type>int|uint|bool|float)?(?P<bits>\d+)?")
 
 def type_bits(type_str):
@@ -107,9 +97,9 @@ class Value(object):
          return Expression(val, name_base, varset)
       elif isinstance(val, Expression):
          return val
-      elif isinstance(val, string_type):
+      elif isinstance(val, str):
          return Variable(val, name_base, varset)
-      elif isinstance(val, (bool, float) + integer_types):
+      elif isinstance(val, (bool, float, int)):
          return Constant(val, name_base)
 
    def __init__(self, val, name, type_str):
@@ -246,7 +236,7 @@ class Constant(Value):
    def hex(self):
       if isinstance(self.value, (bool)):
          return 'NIR_TRUE' if self.value else 'NIR_FALSE'
-      if isinstance(self.value, integer_types):
+      if isinstance(self.value, int):
          return hex(self.value)
       elif isinstance(self.value, float):
          i = struct.unpack('Q', struct.pack('d', self.value))[0]
@@ -265,7 +255,7 @@ class Constant(Value):
    def type(self):
       if isinstance(self.value, (bool)):
          return "nir_type_bool"
-      elif isinstance(self.value, integer_types):
+      elif isinstance(self.value, int):
          return "nir_type_int"
       elif isinstance(self.value, float):
          return "nir_type_float"
diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py
index 006ed42c407..3e083ffa896 100644
--- a/src/compiler/nir/nir_builder_opcodes_h.py
+++ b/src/compiler/nir/nir_builder_opcodes_h.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 template = """\
 /* Copyright (C) 2015 Broadcom
  *
diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py
index c1097de7c67..3876b681e1d 100644
--- a/src/compiler/nir/nir_constant_expressions.py
+++ b/src/compiler/nir/nir_constant_expressions.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 import re
 from nir_opcodes import opcodes
 from nir_opcodes import type_has_size, type_size, type_sizes, type_base_type
diff --git a/src/compiler/nir/nir_opcodes_c.py b/src/compiler/nir/nir_opcodes_c.py
index c6e5bb39ddd..4f80d51ff3b 100644
--- a/src/compiler/nir/nir_opcodes_c.py
+++ b/src/compiler/nir/nir_opcodes_c.py
@@ -23,8 +23,6 @@
 # Authors:
 #    Connor Abbott (cwabbott0 at gmail.com)
 
-from __future__ import print_function
-
 from nir_opcodes import opcodes, type_sizes
 from mako.template import Template
 
diff --git a/src/compiler/nir/nir_opcodes_h.py b/src/compiler/nir/nir_opcodes_h.py
index 6b4e2fe052e..1fc799bb0f9 100644
--- a/src/compiler/nir/nir_opcodes_h.py
+++ b/src/compiler/nir/nir_opcodes_h.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 template = """\
 /* Copyright (C) 2014 Connor Abbott
  *
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index fb6afb2f60b..1582b1ed4f1 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Jason Ekstrand (jason at jlekstrand.net)
 
-from __future__ import print_function
-
 from collections import OrderedDict
 import nir_algebraic
 from nir_opcodes import type_sizes
diff --git a/src/freedreno/ir3/ir3_nir_imul.py b/src/freedreno/ir3/ir3_nir_imul.py
index 45dee61ca1d..e6b6cbb1243 100644
--- a/src/freedreno/ir3/ir3_nir_imul.py
+++ b/src/freedreno/ir3/ir3_nir_imul.py
@@ -20,8 +20,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import print_function
-
 import argparse
 import sys
 
diff --git a/src/freedreno/ir3/ir3_nir_trig.py b/src/freedreno/ir3/ir3_nir_trig.py
index 93eb8cae940..6a88420e1e5 100644
--- a/src/freedreno/ir3/ir3_nir_trig.py
+++ b/src/freedreno/ir3/ir3_nir_trig.py
@@ -20,8 +20,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import print_function
-
 import argparse
 import sys
 
diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py
index 9a6fc06cb45..71c04944903 100644
--- a/src/gallium/auxiliary/indices/u_indices_gen.py
+++ b/src/gallium/auxiliary/indices/u_indices_gen.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 copyright = '''
 /*
  * Copyright 2009 VMware, Inc.
diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.py b/src/gallium/auxiliary/indices/u_unfilled_gen.py
index 4c7d7c61e91..0cb3f2121e6 100644
--- a/src/gallium/auxiliary/indices/u_unfilled_gen.py
+++ b/src/gallium/auxiliary/indices/u_unfilled_gen.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 copyright = '''
 /*
  * Copyright 2009 VMware, Inc.
diff --git a/src/gallium/drivers/r600/egd_tables.py b/src/gallium/drivers/r600/egd_tables.py
index 8a60a6229ad..010b0d7818a 100644
--- a/src/gallium/drivers/r600/egd_tables.py
+++ b/src/gallium/drivers/r600/egd_tables.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 CopyRight = '''
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py
index 140a39bd68b..a4be675a34c 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_archrast.py
@@ -20,7 +20,6 @@
 # IN THE SOFTWARE.
 
 # Python source
-from __future__ import print_function
 import os
 import sys
 import re
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
index fa3e348e6ae..eb51a3a8a13 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
@@ -20,9 +20,7 @@
 # IN THE SOFTWARE.
 
 # Python source
-# Compatible with Python2.X and Python3.X
 
-from __future__ import print_function
 import itertools
 import os
 import sys
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py
index cea3ac8fcbb..c1d08fb83bc 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_common.py
@@ -20,7 +20,6 @@
 # IN THE SOFTWARE.
 
 # Python source
-from __future__ import print_function
 import os
 import errno
 import sys
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py
index 7733f86ec2b..bd39ef645f7 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py
@@ -20,7 +20,6 @@
 # IN THE SOFTWARE.
 
 # Python source
-from __future__ import print_function
 import os
 import sys
 import knob_defs
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
index 0b4f82c04f8..f3ab7120a43 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
@@ -19,7 +19,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import print_function
 import os, sys, re
 from gen_common import *
 from argparse import FileType
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
index 7089a3d0f2b..4739f2078d6 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
@@ -19,7 +19,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import print_function
 import os, sys, re
 from gen_common import *
 from argparse import FileType
diff --git a/src/intel/compiler/brw_nir_trig_workarounds.py b/src/intel/compiler/brw_nir_trig_workarounds.py
index dddadc71da2..7425ff4c6ec 100644
--- a/src/intel/compiler/brw_nir_trig_workarounds.py
+++ b/src/intel/compiler/brw_nir_trig_workarounds.py
@@ -31,8 +31,6 @@
 # amplitude slightly.  Apparently this also minimizes the error function,
 # reducing the maximum error from 0.00006 to about 0.00003.
 
-from __future__ import print_function
-
 import argparse
 import sys
 
diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py
index 2b84eb20f20..1c1b24450ae 100644
--- a/src/intel/genxml/gen_bits_header.py
+++ b/src/intel/genxml/gen_bits_header.py
@@ -19,10 +19,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-from __future__ import (
-    absolute_import, division, print_function, unicode_literals
-)
-
 import argparse
 import os
 import xml.parsers.expat
diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py
index 74722046ba3..45bbb30c464 100644
--- a/src/intel/genxml/gen_pack_header.py
+++ b/src/intel/genxml/gen_pack_header.py
@@ -1,8 +1,5 @@
 #encoding=utf-8
 
-from __future__ import (
-    absolute_import, division, print_function, unicode_literals
-)
 import argparse
 import ast
 import xml.parsers.expat
diff --git a/src/intel/genxml/gen_zipped_file.py b/src/intel/genxml/gen_zipped_file.py
index 56a0dd2dbed..d6af6e91fea 100644
--- a/src/intel/genxml/gen_zipped_file.py
+++ b/src/intel/genxml/gen_zipped_file.py
@@ -22,7 +22,6 @@
 # IN THE SOFTWARE.
 #
 
-from __future__ import print_function
 import sys
 import zlib
 import xml.etree.ElementTree as et
diff --git a/src/intel/isl/gen_format_layout.py b/src/intel/isl/gen_format_layout.py
index 8a6d2a12e7e..ea81edf91d6 100644
--- a/src/intel/isl/gen_format_layout.py
+++ b/src/intel/isl/gen_format_layout.py
@@ -21,18 +21,14 @@
 
 """Generates isl_format_layout.c."""
 
-from __future__ import absolute_import, division, print_function
 import argparse
 import csv
 import re
 
 from mako import template
 
-# Load the template, ensure that __future__.division is imported, and set the
-# bytes encoding to be utf-8. This last bit is important to getting simple
-# consistent behavior for python 3 when we get there.
-TEMPLATE = template.Template(future_imports=['division'],
-                             output_encoding='utf-8',
+# Load the template and set the bytes encoding to be utf-8.
+TEMPLATE = template.Template(output_encoding='utf-8',
                              text="""\
 /* This file is autogenerated by gen_format_layout.py. DO NOT EDIT! */
 
diff --git a/src/mapi/glapi/gen/glX_proto_common.py b/src/mapi/glapi/gen/glX_proto_common.py
index 0559dd16091..dba393d42bf 100644
--- a/src/mapi/glapi/gen/glX_proto_common.py
+++ b/src/mapi/glapi/gen/glX_proto_common.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import gl_XML, glX_XML
 
 
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index a55c737d03e..d37ac6a0a82 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -26,8 +26,6 @@
 #    Ian Romanick <idr at us.ibm.com>
 #    Jeremy Kolb <jkolb at brandeis.edu>
 
-from __future__ import division, print_function
-
 import argparse
 
 import gl_XML, glX_XML, glX_proto_common, license
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index 2a843c3e241..37c896bc2d7 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 import sys, string
 
diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py b/src/mapi/glapi/gen/gl_SPARC_asm.py
index 34e83adaeca..d2f9fcd5cf4 100644
--- a/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 
 import license
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index da80ea1b860..3488000840e 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 from collections import OrderedDict
 from decimal import Decimal
 import xml.etree.ElementTree as ET
diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py
index f4870be03b0..4e93eda1e4e 100644
--- a/src/mapi/glapi/gen/gl_apitemp.py
+++ b/src/mapi/glapi/gen/gl_apitemp.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 
 import gl_XML, glX_XML
diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 1e4d5a3b3cf..02cc2bf8a6b 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -25,8 +25,6 @@
 # Authors:
 #    Zack Rusin <zack at kde.org>
 
-from __future__ import print_function
-
 import argparse
 
 import license
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index 8bca9ed6904..99e7dc60b7f 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -24,8 +24,6 @@
 # _mesa_initialize_exec_table().  It is responsible for populating all
 # entries in the "exec" dispatch table that aren't dynamic.
 
-from __future__ import print_function
-
 import argparse
 import collections
 import license
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
index 92e1a546cff..4695614e5c6 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -29,8 +29,6 @@
 # Based on code ogiginally by:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 
 import license
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py
index a73745ba20b..39b5aa2015a 100644
--- a/src/mapi/glapi/gen/gl_marshal.py
+++ b/src/mapi/glapi/gen/gl_marshal.py
@@ -20,8 +20,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import print_function
-
 import contextlib
 import getopt
 import gl_XML
diff --git a/src/mapi/glapi/gen/gl_marshal_h.py b/src/mapi/glapi/gen/gl_marshal_h.py
index b87b7908dfa..c45b8487be5 100644
--- a/src/mapi/glapi/gen/gl_marshal_h.py
+++ b/src/mapi/glapi/gen/gl_marshal_h.py
@@ -20,8 +20,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import print_function
-
 import getopt
 import gl_XML
 import license
diff --git a/src/mapi/glapi/gen/gl_procs.py b/src/mapi/glapi/gen/gl_procs.py
index 6a950493854..32c60e875da 100644
--- a/src/mapi/glapi/gen/gl_procs.py
+++ b/src/mapi/glapi/gen/gl_procs.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 
 import license
diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index e32139e6afa..659e1772989 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -25,8 +25,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 
 import gl_XML
diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py
index b4149a5f220..487843dd000 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 import copy
 
diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index 3d262cf5783..4b10db37d7f 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import argparse
 
 import license
diff --git a/src/mapi/glapi/gen/remap_helper.py b/src/mapi/glapi/gen/remap_helper.py
index 0740b189f67..dae955263f7 100644
--- a/src/mapi/glapi/gen/remap_helper.py
+++ b/src/mapi/glapi/gen/remap_helper.py
@@ -23,8 +23,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-from __future__ import print_function
-
 import argparse
 
 import license
diff --git a/src/mapi/glapi/gen/typeexpr.py b/src/mapi/glapi/gen/typeexpr.py
index 1f710ea9e79..a5c47cd7950 100644
--- a/src/mapi/glapi/gen/typeexpr.py
+++ b/src/mapi/glapi/gen/typeexpr.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Ian Romanick <idr at us.ibm.com>
 
-from __future__ import print_function
-
 import copy
 
 class type_node(object):
diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py
index a002300ded8..deb3ee27050 100644
--- a/src/mapi/mapi_abi.py
+++ b/src/mapi/mapi_abi.py
@@ -24,8 +24,6 @@
 # Authors:
 #    Chia-I Wu <olv at lunarg.com>
 
-from __future__ import print_function
-
 import sys
 # make it possible to import glapi
 import os
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
index edc0324e60b..37b46a27c31 100644
--- a/src/mesa/main/format_info.py
+++ b/src/mesa/main/format_info.py
@@ -21,8 +21,6 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-from __future__ import division, print_function
-
 import format_parser as parser
 import sys
 
diff --git a/src/mesa/main/get_hash_generator.py b/src/mesa/main/get_hash_generator.py
index 3e9032bd4c8..fb006ad82d6 100644
--- a/src/mesa/main/get_hash_generator.py
+++ b/src/mesa/main/get_hash_generator.py
@@ -28,8 +28,6 @@
 # Generate a C header file containing hash tables of glGet parameter
 # names for each GL API. The generated file is to be included by glGet.c
 
-from __future__ import print_function
-
 import os, sys, getopt
 from collections import defaultdict
 import get_hash_params
diff --git a/src/util/format/u_format_pack.py b/src/util/format/u_format_pack.py
index e32c01f8a08..2ef33f9de24 100644
--- a/src/util/format/u_format_pack.py
+++ b/src/util/format/u_format_pack.py
@@ -35,20 +35,11 @@
  */
 '''
 
-
-from __future__ import division, print_function
-
 import sys
 
 from u_format_parse import *
 
 
-if sys.version_info < (3, 0):
-    integer_types = (int, long)
-
-else:
-    integer_types = (int, )
-
 def inv_swizzles(swizzles):
     '''Return an array[4] of inverse swizzle terms'''
     '''Only pick the first matching value to avoid l8 getting blue and i8 getting alpha'''
@@ -220,7 +211,7 @@ def truncate_mantissa(x, bits):
     '''Truncate an integer so it can be represented exactly with a floating
     point mantissa'''
 
-    assert isinstance(x, integer_types)
+    assert isinstance(x, int)
 
     s = 1
     if x < 0:
@@ -244,7 +235,7 @@ def value_to_native(type, value):
     '''Get the value of unity for this type.'''
     if type.type == FLOAT:
         if type.size <= 32 \
-            and isinstance(value, integer_types):
+            and isinstance(value, int):
             return truncate_mantissa(value, 23)
         return value
     if type.type == FIXED:
diff --git a/src/util/format/u_format_parse.py b/src/util/format/u_format_parse.py
index 9d6ca267fdd..8571a0fd970 100644
--- a/src/util/format/u_format_parse.py
+++ b/src/util/format/u_format_parse.py
@@ -29,7 +29,6 @@
 '''
 
 
-from __future__ import division
 import copy
 
 VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
diff --git a/src/util/format/u_format_table.py b/src/util/format/u_format_table.py
index 6bfccef201d..10659d5c4b1 100644
--- a/src/util/format/u_format_table.py
+++ b/src/util/format/u_format_table.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 CopyRight = '''
 /**************************************************************************
  *
diff --git a/src/util/format_srgb.py b/src/util/format_srgb.py
index 98fa1c48cf3..f52455c648e 100644
--- a/src/util/format_srgb.py
+++ b/src/util/format_srgb.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 CopyRight = '''
 /**************************************************************************
  *
diff --git a/src/util/xxd.py b/src/util/xxd.py
index efff14d1c29..e5c0e9d1a96 100644
--- a/src/util/xxd.py
+++ b/src/util/xxd.py
@@ -22,7 +22,6 @@
 
 # Converts a file to a C/C++ #include containing a string
 
-from __future__ import unicode_literals
 import argparse
 import io
 import os
diff --git a/src/vulkan/util/gen_enum_to_str.py b/src/vulkan/util/gen_enum_to_str.py
index 01f0551d3b8..5fff82d6f75 100644
--- a/src/vulkan/util/gen_enum_to_str.py
+++ b/src/vulkan/util/gen_enum_to_str.py
@@ -21,7 +21,6 @@
 
 """Create enum to string functions for vulkan using vk.xml."""
 
-from __future__ import print_function
 import argparse
 import os
 import textwrap



More information about the mesa-commit mailing list