mirror of
https://github.com/seL4/seL4.git
synced 2026-03-27 10:29:57 +00:00
Remove python2 support for core build tools
Depedencies on Python2/3 cross support (such as six, past and future) are removed as only Python3 is supported at this point. Fewer external deps is a good thing. Signed-off-by: Ben Leslie <benno@brkawy.com> Signed-off-by: Ivan Velickovic <i.velickovic@unsw.edu.au>
This commit is contained in:
committed by
Indan Zupancic
parent
0260fba168
commit
4d7fc32a24
@@ -13,7 +13,6 @@
|
|||||||
# See bitfield_gen.md for syntax, examples, and more information.
|
# See bitfield_gen.md for syntax, examples, and more information.
|
||||||
##
|
##
|
||||||
|
|
||||||
from __future__ import print_function, division
|
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import optparse
|
import optparse
|
||||||
@@ -21,7 +20,6 @@ import re
|
|||||||
import itertools
|
import itertools
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from six.moves import range
|
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
import lex
|
import lex
|
||||||
|
|||||||
23
tools/lex.py
23
tools/lex.py
@@ -36,35 +36,18 @@
|
|||||||
__version__ = "3.2"
|
__version__ = "3.2"
|
||||||
__tabversion__ = "3.2" # Version of table file used
|
__tabversion__ = "3.2" # Version of table file used
|
||||||
|
|
||||||
from past.builtins import cmp
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Python3 doesn't have a build-in cmp function.
|
StringTypes = (str, bytes)
|
||||||
# We need to import it here, even though it isn't called in this file
|
|
||||||
# when interpreted by python3, to prevent pylint from treating it as
|
|
||||||
# an error.
|
|
||||||
|
|
||||||
# This tuple contains known string types
|
|
||||||
try:
|
|
||||||
# Python 2.6
|
|
||||||
StringTypes = (types.StringType, types.UnicodeType)
|
|
||||||
except AttributeError:
|
|
||||||
# Python 3.0
|
|
||||||
StringTypes = (str, bytes)
|
|
||||||
|
|
||||||
# Extract the code attribute of a function. Different implementations
|
def func_code(f):
|
||||||
# are for Python 2/3 compatibility.
|
return f.__code__
|
||||||
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
def func_code(f):
|
|
||||||
return f.func_code
|
|
||||||
else:
|
|
||||||
def func_code(f):
|
|
||||||
return f.__code__
|
|
||||||
|
|
||||||
# This regular expression is used to match valid token names
|
# This regular expression is used to match valid token names
|
||||||
_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$')
|
_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$')
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import sys
|
import sys
|
||||||
import six
|
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
# We assume length tp > 0
|
# We assume length tp > 0
|
||||||
@@ -119,7 +117,7 @@ def print_graph(filename, out_file):
|
|||||||
mp = build_types(filename)
|
mp = build_types(filename)
|
||||||
|
|
||||||
print('digraph types {', file=out_file)
|
print('digraph types {', file=out_file)
|
||||||
for k, flds in six.iteritems(mp):
|
for k, flds in mp.iteritems():
|
||||||
for fld, tp in flds:
|
for fld, tp in flds:
|
||||||
# if is_base(tp):
|
# if is_base(tp):
|
||||||
print('\t "%s" -> "%s" [label="%s"]' % (k, base_name(tp), fld),
|
print('\t "%s" -> "%s" [label="%s"]' % (k, base_name(tp), fld),
|
||||||
|
|||||||
Reference in New Issue
Block a user