summaryrefslogtreecommitdiffstats
path: root/rtems_bsd.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2023-04-14 13:43:44 +1000
committerChris Johns <chrisj@rtems.org>2023-04-14 13:43:44 +1000
commit2c15b90de5c369aa78cd2252a50bba677e9b13f3 (patch)
tree2f93cb3d1665351b1042a561139976c4d941f872 /rtems_bsd.py
parentAdd version and git support for apps to use (diff)
downloadrtems_waf-2c15b90de5c369aa78cd2252a50bba677e9b13f3.tar.bz2
Format with YAPF
Diffstat (limited to 'rtems_bsd.py')
-rw-r--r--rtems_bsd.py71
1 files changed, 40 insertions, 31 deletions
diff --git a/rtems_bsd.py b/rtems_bsd.py
index f28ef1c..7fbe66f 100644
--- a/rtems_bsd.py
+++ b/rtems_bsd.py
@@ -35,21 +35,24 @@ except:
import sys
sys.exit(1)
+
def init(ctx):
pass
+
def options(opt):
opt.add_option('--net-config',
- default = 'config.inc',
- dest = 'net_config',
- help = 'Network test configuration.')
+ default='config.inc',
+ dest='net_config',
+ help='Network test configuration.')
opt.add_option('--rtems-libbsd',
- action = 'store',
- default = None,
- dest = 'rtems_libbsd',
- help = 'Path to install RTEMS LibBSD (defauls to prefix).')
+ action='store',
+ default=None,
+ dest='rtems_libbsd',
+ help='Path to install RTEMS LibBSD (defauls to prefix).')
-def bsp_configure(conf, arch_bsp, mandatory = True):
+
+def bsp_configure(conf, arch_bsp, mandatory=True):
configure = mandatory
if not mandatory and conf.options.rtems_libbsd is not None:
@@ -57,10 +60,9 @@ def bsp_configure(conf, arch_bsp, mandatory = True):
if configure:
conf.msg('RTEMS LibBSD',
- rtems.arch(arch_bsp) + '/' + rtems.bsp(arch_bsp),
- 'YELLOW')
+ rtems.arch(arch_bsp) + '/' + rtems.bsp(arch_bsp), 'YELLOW')
- conf.check(header_name = 'dlfcn.h', features = 'c')
+ conf.check(header_name='dlfcn.h', features='c')
if not rtems.check_posix(conf):
conf.fatal('RTEMS kernel POSIX support is disabled; ' +
'configure RTEMS with --enable-posix')
@@ -75,19 +77,21 @@ def bsp_configure(conf, arch_bsp, mandatory = True):
rtems_libbsd_path = conf.env.PREFIX
if not os.path.exists(rtems_libbsd_path):
- conf.fatal('RTEMS LibBSD path not found: %s' % (rtems_libbsd_path))
+ conf.fatal('RTEMS LibBSD path not found: %s' % (rtems_libbsd_path))
- rtems_libbsd_inc_path = os.path.join(rtems_libbsd_path,
- rtems.arch_bsp_include_path(conf.env.RTEMS_VERSION,
- conf.env.RTEMS_ARCH_BSP))
- rtems_libbsd_lib_path = os.path.join(rtems_libbsd_path,
- rtems.arch_bsp_lib_path(conf.env.RTEMS_VERSION,
- conf.env.RTEMS_ARCH_BSP))
+ rtems_libbsd_inc_path = os.path.join(
+ rtems_libbsd_path,
+ rtems.arch_bsp_include_path(conf.env.RTEMS_VERSION,
+ conf.env.RTEMS_ARCH_BSP))
+ rtems_libbsd_lib_path = os.path.join(
+ rtems_libbsd_path,
+ rtems.arch_bsp_lib_path(conf.env.RTEMS_VERSION,
+ conf.env.RTEMS_ARCH_BSP))
conf.env.IFLAGS += [rtems_libbsd_inc_path]
- conf.check(header_name = 'machine/rtems-bsd-sysinit.h',
- features = 'c',
- includes = conf.env.IFLAGS)
+ conf.check(header_name='machine/rtems-bsd-sysinit.h',
+ features='c',
+ includes=conf.env.IFLAGS)
conf.env.RTEMS_LIBBSD = 'Yes'
conf.env.INCLUDES = conf.env.IFLAGS
@@ -96,6 +100,7 @@ def bsp_configure(conf, arch_bsp, mandatory = True):
configure_net_config(conf, arch_bsp)
+
def configure_net_config(conf, arch_bsp):
if check_libbsd(conf) and conf.options.net_config is not None:
net_config = conf.options.net_config
@@ -106,12 +111,13 @@ def configure_net_config(conf, arch_bsp):
try:
net_cfg_lines = open(net_config).readlines()
except:
- conf.fatal('network configuraiton \'%s\' read failed' % (net_config))
+ conf.fatal('network configuraiton \'%s\' read failed' %
+ (net_config))
- tags = [ 'NET_CFG_SELF_IP',
- 'NET_CFG_NETMASK',
- 'NET_CFG_PEER_IP',
- 'NET_CFG_GATEWAY_IP' ]
+ tags = [
+ 'NET_CFG_SELF_IP', 'NET_CFG_NETMASK', 'NET_CFG_PEER_IP',
+ 'NET_CFG_GATEWAY_IP'
+ ]
lc = 0
sed = 'sed '
@@ -137,14 +143,17 @@ def configure_net_config(conf, arch_bsp):
conf.msg('Net Config', 'found', 'YELLOW')
+
def check_libbsd(ctx):
return rtems.check(ctx, 'RTEMS_LIBBSD')
+
def check_net_config(ctx):
- return rtems.check(ctx, 'NET_CONFIG', setting = True)
+ return rtems.check(ctx, 'NET_CONFIG', setting=True)
+
def net_config_header(ctx, target):
- ctx(target = target,
- source = "rtems_waf/network-config.h.in",
- rule = sed + " < ${SRC} > ${TGT}",
- update_outputs = True)
+ ctx(target=target,
+ source="rtems_waf/network-config.h.in",
+ rule=sed + " < ${SRC} > ${TGT}",
+ update_outputs=True)