summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2022-09-08 07:34:12 +1000
committerChris Johns <chrisj@rtems.org>2022-09-09 09:08:09 +1000
commitbe25beed298e284385cac7d05f492c20f3d270e6 (patch)
treef4340adb5f31766f91c5fcc1cd972b07548bf0d3
parentrtems/libbsd: Update to the latest on the 6-freebsd-12 branch (diff)
downloadrtems-source-builder-be25beed298e284385cac7d05f492c20f3d270e6.tar.bz2
sb/rtems-kernel-config-check: Reformat using yapf
-rwxr-xr-xsource-builder/sb/rtems-kernel-config-check82
1 files changed, 30 insertions, 52 deletions
diff --git a/source-builder/sb/rtems-kernel-config-check b/source-builder/sb/rtems-kernel-config-check
index 9bdff22..0b7e141 100755
--- a/source-builder/sb/rtems-kernel-config-check
+++ b/source-builder/sb/rtems-kernel-config-check
@@ -1,5 +1,4 @@
#! /usr/bin/env python
-
"""
SPDX-License-Identifier: BSD-2-Clause
@@ -36,14 +35,15 @@ from os.path import exists
try:
import ConfigParser
- configparser = ConfigParser # used for python2
+ configparser = ConfigParser # used for python2
except ImportError:
try:
- import configparser # used for python3
+ import configparser # used for python3
except ImportError:
- print("Could not import configparser. Exiting...", file = sys.stderr)
+ print("Could not import configparser. Exiting...", file=sys.stderr)
sys.exit(1)
+
def run():
parser = argparse.ArgumentParser()
parser.add_argument("config", help="path to config file")
@@ -51,79 +51,56 @@ def run():
"-a",
"--arch",
help="return target architecture specified in the config",
- action="store_true"
- )
- parser.add_argument(
- "-b",
- "--bsp",
- help="return BSP specified in the config",
- action="store_true"
- )
+ action="store_true")
+ parser.add_argument("-b",
+ "--bsp",
+ help="return BSP specified in the config",
+ action="store_true")
parser.add_argument(
"-c",
"--arch-bsp",
help="return target architecture and BSP specified in the config",
- action="store_true"
- )
- parser.add_argument(
- "-v",
- "--rtems-version",
- help="version of RTEMS",
- type=int,
- default=6
- )
- parser.add_argument(
- "-t",
- "--target",
- help="return target (<arch-rtems<rtems-version>)",
- action="store_true"
- )
+ action="store_true")
+ parser.add_argument("-v",
+ "--rtems-version",
+ help="version of RTEMS",
+ type=int,
+ default=6)
+ parser.add_argument("-t",
+ "--target",
+ help="return target (<arch-rtems<rtems-version>)",
+ action="store_true")
args = parser.parse_args()
config = configparser.ConfigParser()
if args.config[-4:] != ".ini":
- print(
- "The config file is missing an *.ini extension.",
- file = sys.stderr
- )
+ print("The config file is missing an *.ini extension.",
+ file=sys.stderr)
sys.exit(1)
try:
config.read(args.config)
except configparser.MissingSectionHeaderError:
- print(
- "There is no section header in the config file",
- file = sys.stderr
- )
+ print("There is no section header in the config file", file=sys.stderr)
sys.exit(1)
except configparser.ParsingError:
- print(
- "An exception occured when parsing the config file",
- file = sys.stderr
- )
+ print("An exception occured when parsing the config file",
+ file=sys.stderr)
sys.exit(1)
except:
- print(
- "An unknown exception occured",
- file = sys.stderr
- )
+ print("An unknown exception occured", file=sys.stderr)
if len(config.sections()) != 1:
- print(
- "You can only have one arch/bsp section in your config.",
- file = sys.stderr
- )
+ print("You can only have one arch/bsp section in your config.",
+ file=sys.stderr)
sys.exit(1)
arch_bsp_str = config.sections()[0]
if arch_bsp_str.find("/") == -1:
- print(
- "arch/bsp section in config is missing '/'",
- file = sys.stderr
- )
+ print("arch/bsp section in config is missing '/'", file=sys.stderr)
sys.exit(1)
- if ( args.arch or args.bsp) and args.arch_bsp:
+ if (args.arch or args.bsp) and args.arch_bsp:
args.arch = False
if args.arch:
@@ -143,5 +120,6 @@ def run():
print(arch + "-rtems" + str(args.rtems_version))
return
+
if __name__ == "__main__":
run()