mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-02 22:54:05 +08:00
python: drop python2 support
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Acked-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3674>
This commit is contained in:
parent
dac09a3119
commit
f1eae2f8bb
@ -22,7 +22,6 @@
|
||||
|
||||
"""Script to install megadriver symlinks for meson."""
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
import os
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function, division, unicode_literals
|
||||
|
||||
CopyRight = '''
|
||||
/*
|
||||
* Copyright 2015-2019 Advanced Micro Devices, Inc.
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
COPYRIGHT = '''
|
||||
/*
|
||||
* Copyright 2015-2019 Advanced Micro Devices, Inc.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
"""Run glcpp tests with various line endings."""
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
import difflib
|
||||
import errno
|
||||
|
@ -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
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
"""Script to generate and run glsl optimization tests."""
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
import difflib
|
||||
import errno
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -23,7 +23,6 @@
|
||||
# Authors:
|
||||
# Jason Ekstrand (jason@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"
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
template = """\
|
||||
/* Copyright (C) 2015 Broadcom
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -23,8 +23,6 @@
|
||||
# Authors:
|
||||
# Connor Abbott (cwabbott0@gmail.com)
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from nir_opcodes import opcodes, type_sizes
|
||||
from mako.template import Template
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
template = """\
|
||||
/* Copyright (C) 2014 Connor Abbott
|
||||
*
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Jason Ekstrand (jason@jlekstrand.net)
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from collections import OrderedDict
|
||||
import nir_algebraic
|
||||
from nir_opcodes import type_sizes
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
copyright = '''
|
||||
/*
|
||||
* Copyright 2009 VMware, Inc.
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
copyright = '''
|
||||
/*
|
||||
* Copyright 2009 VMware, Inc.
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
CopyRight = '''
|
||||
/*
|
||||
* Copyright 2015 Advanced Micro Devices, Inc.
|
||||
|
@ -20,7 +20,6 @@
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
# Python source
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
@ -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
|
||||
|
@ -20,7 +20,6 @@
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
# Python source
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import errno
|
||||
import sys
|
||||
|
@ -20,7 +20,6 @@
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
# Python source
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import knob_defs
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -22,7 +22,6 @@
|
||||
# IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import zlib
|
||||
import xml.etree.ElementTree as et
|
||||
|
@ -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! */
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import gl_XML, glX_XML
|
||||
|
||||
|
||||
|
@ -26,8 +26,6 @@
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
# Jeremy Kolb <jkolb@brandeis.edu>
|
||||
|
||||
from __future__ import division, print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import gl_XML, glX_XML, glX_proto_common, license
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys, string
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import license
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from collections import OrderedDict
|
||||
from decimal import Decimal
|
||||
import xml.etree.ElementTree as ET
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import gl_XML, glX_XML
|
||||
|
@ -25,8 +25,6 @@
|
||||
# Authors:
|
||||
# Zack Rusin <zack@kde.org>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import license
|
||||
|
@ -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
|
||||
|
@ -29,8 +29,6 @@
|
||||
# Based on code ogiginally by:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import license
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import license
|
||||
|
@ -25,8 +25,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import gl_XML
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import copy
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
import license
|
||||
|
@ -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
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Ian Romanick <idr@us.ibm.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import copy
|
||||
|
||||
class type_node(object):
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Authors:
|
||||
# Chia-I Wu <olv@lunarg.com>
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
# make it possible to import glapi
|
||||
import os
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -29,7 +29,6 @@
|
||||
'''
|
||||
|
||||
|
||||
from __future__ import division
|
||||
import copy
|
||||
|
||||
VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
CopyRight = '''
|
||||
/**************************************************************************
|
||||
*
|
||||
|
@ -1,5 +1,3 @@
|
||||
from __future__ import print_function
|
||||
|
||||
CopyRight = '''
|
||||
/**************************************************************************
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user