Set Python scripts to use Python 3

Several of these already required Python 3 and would not run under 2.7.
This commit is contained in:
Amar Takhar
2024-10-21 16:24:22 -04:00
committed by Chris Johns
parent 83c1a305f7
commit e0f1c8fe0b
8 changed files with 13 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# encoding: utf-8 # encoding: utf-8
# Thomas Nagy, 2008-2010 (ita) # Thomas Nagy, 2008-2010 (ita)

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
# encoding: utf-8 # encoding: utf-8
""" """

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
# #
# RTEMS (http://www.rtems.org/) # RTEMS (http://www.rtems.org/)
# Copyright 2020, 2022 Chris Johns (chrisj@rtems.org) # Copyright 2020, 2022 Chris Johns (chrisj@rtems.org)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
# #
@@ -28,14 +28,14 @@
import argparse import argparse
import sys import sys
sys.argv = list(filter(lambda a: a != '-', sys.argv)) sys.argv = list([a for a in sys.argv if a != '-'])
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-E', action='count') parser.add_argument('-E', action='count')
parser.add_argument('-dM', action='count') parser.add_argument('-dM', action='count')
args = parser.parse_args() args = parser.parse_args()
if args.E > 0: if args.E and args.E > 0:
print("#define __GNUC__ 7") print("#define __GNUC__ 7")
print("#define __GNUC_MINOR__ 4") print("#define __GNUC_MINOR__ 4")
print("#define __GNUC_PATCHLEVEL__ 0") print("#define __GNUC_PATCHLEVEL__ 0")

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
# #

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
# #

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env python3
# #
# Copyright 2018 Chris Johns (chrisj@rtems.org) # Copyright 2018 Chris Johns (chrisj@rtems.org)
# All rights reserved. # All rights reserved.
@@ -33,12 +33,9 @@
# Python version the rtems-test-check script. # Python version the rtems-test-check script.
# #
from __future__ import print_function
import os import os
import os.path import os.path
import re import re
import sre_constants
import sys import sys
def eprint(*args, **kwargs): def eprint(*args, **kwargs):
@@ -219,7 +216,7 @@ for test in tests:
for e in testdata['rexclude']: for e in testdata['rexclude']:
try: try:
m = re.compile(e).match(test) m = re.compile(e).match(test)
except sre_constants.error as ree: except re.error as ree:
eprint('error: invalid rexclude regx: %s: %s' % (e, ree)) eprint('error: invalid rexclude regx: %s: %s' % (e, ree))
print('INVALID-TEST-DATA') print('INVALID-TEST-DATA')
sys.exit(1) sys.exit(1)
@@ -229,7 +226,7 @@ for test in tests:
for i in testdata['rinclude']: for i in testdata['rinclude']:
try: try:
m = re.compile(i).match(test) m = re.compile(i).match(test)
except sre_constants.error as ree: except re.error as ree:
eprint('error: invalid rinclude regx: %s: %s' % (i, ree)) eprint('error: invalid rinclude regx: %s: %s' % (i, ree))
print('INVALID-TEST-DATA') print('INVALID-TEST-DATA')
sys.exit(1) sys.exit(1)
@@ -248,7 +245,7 @@ for test in tests:
for ftest in testdata['flags'][mode]: for ftest in testdata['flags'][mode]:
try: try:
m = re.compile(ftest).match(test) m = re.compile(ftest).match(test)
except sre_constants.error as ref: except re.error as ref:
eprint('error: invalid flags test regx: %s: %s' % (ftest, ref)) eprint('error: invalid flags test regx: %s: %s' % (ftest, ref))
print('INVALID-TEST-DATA') print('INVALID-TEST-DATA')
sys.exit(1) sys.exit(1)