[PATCH master 1/4] waf: Reformat to PEP8 using yapf

chrisj at rtems.org chrisj at rtems.org
Tue Sep 15 02:32:32 UTC 2020


From: Chris Johns <chrisj at rtems.org>

---
 builder.py    | 458 ++++++++++++++++++++++++++++++++------------------
 waf_libbsd.py | 239 +++++++++++++-------------
 wscript       | 152 ++++++++++-------
 3 files changed, 505 insertions(+), 344 deletions(-)

diff --git a/builder.py b/builder.py
index 0eda461f..83672935 100755
--- a/builder.py
+++ b/builder.py
@@ -1,7 +1,10 @@
+# SPDX-License-Identifier: BSD-2-Clause
+'''Manage the libbsd build configuration data.
+'''
+
+# Copyright (c) 2015, 2020 Chris Johns <chrisj at rtems.org>. All rights reserved.
 #
-#  Copyright (c) 2015-2016 Chris Johns <chrisj at rtems.org>. All rights reserved.
-#
-#  Copyright (c) 2009, 2017 embedded brains GmbH.  All rights reserved.
+# Copyright (c) 2009, 2017 embedded brains GmbH.  All rights reserved.
 #
 #   embedded brains GmbH
 #   Dornierstr. 4
@@ -9,30 +12,26 @@
 #   Germany
 #   <info at embedded-brains.de>
 #
-#  Copyright (c) 2012 OAR Corporation. All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions
-#  are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
 #
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# FreeBSD: http://svn.freebsd.org/base/releng/8.2/sys (revision 222485)
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
 
 from __future__ import print_function
 
@@ -60,13 +59,14 @@ filesTotal = 0
 filesTotalLines = 0
 filesTotalInserts = 0
 filesTotalDeletes = 0
-diffDetails = { }
+diffDetails = {}
 
 verboseInfo = 1
 verboseDetail = 2
 verboseMoreDetail = 3
 verboseDebug = 4
 
+
 def _cflagsIncludes(cflags, includes):
     if type(cflags) is not list:
         if cflags is not None:
@@ -81,10 +81,12 @@ def _cflagsIncludes(cflags, includes):
         _includes = includes
     return _cflags, _includes
 
-def verbose(level = verboseInfo):
+
+def verbose(level=verboseInfo):
     return verboseLevel >= level
 
-def changedFileSummary(statsReport = False):
+
+def changedFileSummary(statsReport=False):
 
     global filesTotal, filesTotalLines, filesTotalInserts, filesTotalDeletes
 
@@ -107,18 +109,25 @@ def changedFileSummary(statsReport = False):
         #
         # Sort by opacity.
         #
-        ordered_diffs = sorted(diffDetails.items(), key = lambda diff: diff[1].opacity, reverse = True)
+        ordered_diffs = sorted(diffDetails.items(),
+                               key=lambda diff: diff[1].opacity,
+                               reverse=True)
         for f in ordered_diffs:
             print('  %s' % (diffDetails[f[0]].status()))
 
+
 def readFile(name):
     try:
-        contents = codecs.open(name, mode = 'r', encoding = 'utf-8', errors = 'ignore').read()
+        contents = codecs.open(name,
+                               mode='r',
+                               encoding='utf-8',
+                               errors='ignore').read()
     except UnicodeDecodeError as ude:
         print('error: reading: %s: %s' % (name, ude))
         sys.exit(1)
     return contents
 
+
 def writeFile(name, contents):
     path = os.path.dirname(name)
     if not os.path.exists(path):
@@ -128,11 +137,13 @@ def writeFile(name, contents):
             print('error: cannot create directory: %s: %s' % (path, oe))
             sys.exit(1)
     try:
-        codecs.open(name, mode = 'w',  encoding = 'utf-8', errors = 'ignore').write(contents)
+        codecs.open(name, mode='w', encoding='utf-8',
+                    errors='ignore').write(contents)
     except UnicodeDecodeError as ude:
         print('error: write: %s: %s' % (name, ude))
         sys.exit(1)
 
+
 #
 # A builder error.
 #
@@ -140,11 +151,14 @@ class error(Exception):
     """Base class for exceptions."""
     def __init__(self, msg):
         self.msg = 'error: %s' % (msg)
+
     def set_output(self, msg):
         self.msg = msg
+
     def __str__(self):
         return self.msg
 
+
 #
 # Diff Record
 #
@@ -158,7 +172,8 @@ class diffRecord:
         self.inserts = inserts
         self.deletes = deletes
         self.changes = inserts + deletes
-        self.opacity = (float(self.changes) / (self.lines + self.changes)) * 100.0
+        self.opacity = (float(self.changes) /
+                        (self.lines + self.changes)) * 100.0
 
     def __repr__(self):
         return self.src
@@ -167,36 +182,50 @@ class diffRecord:
         return 'opacity:%5.1f%% edits:%4d (+):%-4d (-):%-4d %s' % \
             (self.opacity, self.changes, self.inserts, self.deletes, self.src)
 
+
 #
 # This stuff needs to move to libbsd.py.
 #
 
+
 # Move target dependent files under a machine directory
 def mapCPUDependentPath(path):
-  return path.replace("include/", "include/machine/")
+    return path.replace("include/", "include/machine/")
+
 
 def fixIncludes(data):
-    data = re.sub('#include <sys/resource.h>', '#include <rtems/bsd/sys/resource.h>', data)
-    data = re.sub('#include <sys/unistd.h>',   '#include <rtems/bsd/sys/unistd.h>', data)
+    data = re.sub('#include <sys/resource.h>',
+                  '#include <rtems/bsd/sys/resource.h>', data)
+    data = re.sub('#include <sys/unistd.h>',
+                  '#include <rtems/bsd/sys/unistd.h>', data)
     return data
 
+
 # revert fixing the include paths inside a C or .h file
 def revertFixIncludes(data):
-    data = re.sub('#include <rtems/bsd/',  '#include <', data)
-    data = re.sub('#include <util.h>',     '#include <rtems/bsd/util.h>', data)
-    data = re.sub('#include <bsd.h>',      '#include <rtems/bsd/bsd.h>', data)
-    data = re.sub('#include <zerocopy.h>', '#include <rtems/bsd/zerocopy.h>', data)
-    data = re.sub('#include <modules.h>',  '#include <rtems/bsd/modules.h>', data)
+    data = re.sub('#include <rtems/bsd/', '#include <', data)
+    data = re.sub('#include <util.h>', '#include <rtems/bsd/util.h>', data)
+    data = re.sub('#include <bsd.h>', '#include <rtems/bsd/bsd.h>', data)
+    data = re.sub('#include <zerocopy.h>', '#include <rtems/bsd/zerocopy.h>',
+                  data)
+    data = re.sub('#include <modules.h>', '#include <rtems/bsd/modules.h>',
+                  data)
     return data
 
+
 # fix include paths inside a C or .h file
 def fixLocalIncludes(data):
-    data = re.sub('#include "opt_([^"]*)"',    '#include <rtems/bsd/local/opt_\\1>', data)
-    data = re.sub('#include "([^"]*)_if.h"',   '#include <rtems/bsd/local/\\1_if.h>', data)
-    data = re.sub('#include "miidevs([^"]*)"', '#include <rtems/bsd/local/miidevs\\1>', data)
-    data = re.sub('#include "usbdevs([^"]*)"', '#include <rtems/bsd/local/usbdevs\\1>', data)
+    data = re.sub('#include "opt_([^"]*)"',
+                  '#include <rtems/bsd/local/opt_\\1>', data)
+    data = re.sub('#include "([^"]*)_if.h"',
+                  '#include <rtems/bsd/local/\\1_if.h>', data)
+    data = re.sub('#include "miidevs([^"]*)"',
+                  '#include <rtems/bsd/local/miidevs\\1>', data)
+    data = re.sub('#include "usbdevs([^"]*)"',
+                  '#include <rtems/bsd/local/usbdevs\\1>', data)
     return data
 
+
 # revert fixing the include paths inside a C or .h file
 def revertFixLocalIncludes(data):
     data = re.sub('#include <rtems/bsd/local/([^>]*)>', '#include "\\1"', data)
@@ -211,42 +240,48 @@ def assertHeaderFile(path):
         print("*** Move it to a C source file list")
         sys.exit(2)
 
+
 def assertSourceFile(path):
     if path[-2:] != '.c' and path[-2:] != '.S' and path[-3:] != '.cc':
         print("*** " + path + " does not end in .c, .cc or .S")
         print("*** Move it to a header file list")
         sys.exit(2)
 
+
 def assertHeaderOrSourceFile(path):
     if path[-2] != '.' or (path[-1] != 'h' and path[-1] != 'c'):
         print("*** " + path + " does not end in .h or .c")
         print("*** Move it to another list")
         sys.exit(2)
 
+
 def diffSource(dstLines, srcLines, src, dst):
     global filesTotal, filesTotalLines, filesTotalInserts, filesTotalDeletes
     #
     # Diff, note there is no line termination on each string.  Expand the
     # generator to list because the generator is not reusable.
     #
-    diff = list(difflib.unified_diff(dstLines,
-                                     srcLines,
-                                     fromfile = src,
-                                     tofile = dst,
-                                     n = 5,
-                                     lineterm = ''))
+    diff = list(
+        difflib.unified_diff(dstLines,
+                             srcLines,
+                             fromfile=src,
+                             tofile=dst,
+                             n=5,
+                             lineterm=''))
     inserts = 0
     deletes = 0
     if len(diff) > 0:
         if src in diffDetails and \
            diffDetails[src].dst != dst and diffDetails[src].diff != diff:
-            raise error('repeated diff of file different: src:%s dst:%s' % (src, dst))
+            raise error('repeated diff of file different: src:%s dst:%s' %
+                        (src, dst))
         for l in diff:
             if l[0] == '-':
                 deletes += 1
             elif l[0] == '+':
                 inserts += 1
-        diffDetails[src] = diffRecord(src, dst, srcLines, diff, inserts, deletes)
+        diffDetails[src] = diffRecord(src, dst, srcLines, diff, inserts,
+                                      deletes)
 
     #
     # Count the total files, lines and the level of changes.
@@ -258,6 +293,7 @@ def diffSource(dstLines, srcLines, src, dst):
 
     return diff
 
+
 #
 # Converters provide a way to alter the various types of code. The conversion
 # process filters a file as it is copies from the source path to the
@@ -265,8 +301,12 @@ def diffSource(dstLines, srcLines, src, dst):
 # source.
 #
 class Converter(object):
-
-    def convert(self, src, dst, hasSource = True, sourceFilter = None, srcContents = None):
+    def convert(self,
+                src,
+                dst,
+                hasSource=True,
+                sourceFilter=None,
+                srcContents=None):
 
         global filesProcessed, filesProcessedCount
 
@@ -337,10 +377,12 @@ class Converter(object):
                 for l in diff:
                     print(l)
 
+
 class NoConverter(Converter):
-    def convert(self, src, dst, hasSource = True, sourceFilter = None):
+    def convert(self, src, dst, hasSource=True, sourceFilter=None):
         return '/* EMPTY */\n'
 
+
 class FromFreeBSDToRTEMSHeaderConverter(Converter):
     def sourceFilter(self, data):
         data = fixLocalIncludes(data)
@@ -349,7 +391,8 @@ class FromFreeBSDToRTEMSHeaderConverter(Converter):
 
     def convert(self, src, dst):
         sconverter = super(FromFreeBSDToRTEMSHeaderConverter, self)
-        sconverter.convert(src, dst, sourceFilter = self.sourceFilter)
+        sconverter.convert(src, dst, sourceFilter=self.sourceFilter)
+
 
 class FromFreeBSDToRTEMSUserSpaceHeaderConverter(Converter):
     def sourceFilter(self, data):
@@ -358,7 +401,8 @@ class FromFreeBSDToRTEMSUserSpaceHeaderConverter(Converter):
 
     def convert(self, src, dst):
         sconverter = super(FromFreeBSDToRTEMSUserSpaceHeaderConverter, self)
-        sconverter.convert(src, dst, sourceFilter = self.sourceFilter)
+        sconverter.convert(src, dst, sourceFilter=self.sourceFilter)
+
 
 class FromFreeBSDToRTEMSSourceConverter(Converter):
     def sourceFilter(self, data):
@@ -369,7 +413,8 @@ class FromFreeBSDToRTEMSSourceConverter(Converter):
 
     def convert(self, src, dst):
         sconverter = super(FromFreeBSDToRTEMSSourceConverter, self)
-        sconverter.convert(src, dst, sourceFilter = self.sourceFilter)
+        sconverter.convert(src, dst, sourceFilter=self.sourceFilter)
+
 
 class FromFreeBSDToRTEMSUserSpaceSourceConverter(Converter):
     def sourceFilter(self, data):
@@ -379,7 +424,8 @@ class FromFreeBSDToRTEMSUserSpaceSourceConverter(Converter):
 
     def convert(self, src, dst):
         sconverter = super(FromFreeBSDToRTEMSUserSpaceSourceConverter, self)
-        sconverter.convert(src, dst, sourceFilter = self.sourceFilter)
+        sconverter.convert(src, dst, sourceFilter=self.sourceFilter)
+
 
 class FromRTEMSToFreeBSDHeaderConverter(Converter):
     def sourceFilter(self, data):
@@ -389,19 +435,29 @@ class FromRTEMSToFreeBSDHeaderConverter(Converter):
 
     def convert(self, src, dst):
         sconverter = super(FromRTEMSToFreeBSDHeaderConverter, self)
-        sconverter.convert(src, dst, hasSource = False,  sourceFilter = self.sourceFilter)
+        sconverter.convert(src,
+                           dst,
+                           hasSource=False,
+                           sourceFilter=self.sourceFilter)
+
 
 class FromRTEMSToFreeBSDSourceConverter(Converter):
     def sourceFilter(self, data):
-        data = re.sub('#include <machine/rtems-bsd-kernel-space.h>\n\n', '', data)
-        data = re.sub('#include <machine/rtems-bsd-user-space.h>\n\n', '', data)
+        data = re.sub('#include <machine/rtems-bsd-kernel-space.h>\n\n', '',
+                      data)
+        data = re.sub('#include <machine/rtems-bsd-user-space.h>\n\n', '',
+                      data)
         data = revertFixLocalIncludes(data)
         data = revertFixIncludes(data)
         return data
 
     def convert(self, src, dst):
         sconverter = super(FromRTEMSToFreeBSDSourceConverter, self)
-        sconverter.convert(src, dst, hasSource = False, sourceFilter = self.sourceFilter)
+        sconverter.convert(src,
+                           dst,
+                           hasSource=False,
+                           sourceFilter=self.sourceFilter)
+
 
 #
 # Compose a path based for the various parts of the source tree.
@@ -413,6 +469,7 @@ class PathComposer(object):
     def composeLibBSDPath(self, path, prefix):
         return os.path.join(prefix, path)
 
+
 class FreeBSDPathComposer(PathComposer):
     def composeOriginPath(self, path):
         return os.path.join(FreeBSD_DIR, path)
@@ -420,6 +477,7 @@ class FreeBSDPathComposer(PathComposer):
     def composeLibBSDPath(self, path, prefix):
         return os.path.join(prefix, 'freebsd', path)
 
+
 class RTEMSPathComposer(PathComposer):
     def composeOriginPath(self, path):
         return path
@@ -427,6 +485,7 @@ class RTEMSPathComposer(PathComposer):
     def composeLibBSDPath(self, path, prefix):
         return os.path.join(prefix, 'rtemsbsd', path)
 
+
 class LinuxPathComposer(PathComposer):
     def composeOriginPath(self, path):
         return path
@@ -434,36 +493,45 @@ class LinuxPathComposer(PathComposer):
     def composeLibBSDPath(self, path, prefix):
         return os.path.join(prefix, 'linux', path)
 
+
 class CPUDependentFreeBSDPathComposer(FreeBSDPathComposer):
     def composeLibBSDPath(self, path, prefix):
-        path = super(CPUDependentFreeBSDPathComposer, self).composeLibBSDPath(path, prefix)
+        path = super(CPUDependentFreeBSDPathComposer,
+                     self).composeLibBSDPath(path, prefix)
         path = mapCPUDependentPath(path)
         return path
 
+
 class CPUDependentRTEMSPathComposer(RTEMSPathComposer):
     def composeLibBSDPath(self, path, prefix):
-        path = super(CPUDependentRTEMSPathComposer, self).composeLibBSDPath(path, prefix)
+        path = super(CPUDependentRTEMSPathComposer,
+                     self).composeLibBSDPath(path, prefix)
         path = mapCPUDependentPath(path)
         return path
 
+
 class CPUDependentLinuxPathComposer(LinuxPathComposer):
     def composeLibBSDPath(self, path, prefix):
-        path = super(CPUDependentLinuxPathComposer, self).composeLibBSDPath(path, prefix)
+        path = super(CPUDependentLinuxPathComposer,
+                     self).composeLibBSDPath(path, prefix)
         path = mapCPUDependentPath(path)
         return path
 
+
 class TargetSourceCPUDependentPathComposer(CPUDependentFreeBSDPathComposer):
     def __init__(self, targetCPU, sourceCPU):
         self.targetCPU = targetCPU
         self.sourceCPU = sourceCPU
 
     def composeLibBSDPath(self, path, prefix):
-        path = super(TargetSourceCPUDependentPathComposer, self).composeLibBSDPath(path, prefix)
+        path = super(TargetSourceCPUDependentPathComposer,
+                     self).composeLibBSDPath(path, prefix)
         path = path.replace(self.sourceCPU, self.targetCPU)
         return path
 
+
 class BuildSystemFragmentComposer(object):
-    def __init__(self, includes = None):
+    def __init__(self, includes=None):
         if type(includes) is not list:
             self.includes = [includes]
         else:
@@ -472,9 +540,9 @@ class BuildSystemFragmentComposer(object):
     def compose(self, path):
         return ''
 
-class SourceFileFragmentComposer(BuildSystemFragmentComposer):
 
-    def __init__(self, cflags = "default", includes = None):
+class SourceFileFragmentComposer(BuildSystemFragmentComposer):
+    def __init__(self, cflags="default", includes=None):
         self.cflags, self.includes = _cflagsIncludes(cflags, includes)
 
     def compose(self, path):
@@ -482,15 +550,17 @@ class SourceFileFragmentComposer(BuildSystemFragmentComposer):
             flags = self.cflags
         else:
             flags = self.cflags + self.includes
-        return ['sources', flags, ('default', None)], [path], self.cflags, self.includes
+        return ['sources', flags,
+                ('default', None)], [path], self.cflags, self.includes
 
-class SourceFileIfHeaderComposer(SourceFileFragmentComposer):
 
-    def __init__(self, headers, cflags = "default", includes = None):
+class SourceFileIfHeaderComposer(SourceFileFragmentComposer):
+    def __init__(self, headers, cflags="default", includes=None):
         if headers is not list:
             headers = [headers]
         self.headers = headers
-        super(SourceFileIfHeaderComposer, self).__init__(cflags = cflags, includes = includes)
+        super(SourceFileIfHeaderComposer, self).__init__(cflags=cflags,
+                                                         includes=includes)
 
     def compose(self, path):
         r = SourceFileFragmentComposer.compose(self, path)
@@ -503,9 +573,15 @@ class SourceFileIfHeaderComposer(SourceFileFragmentComposer):
         r[0][2] = (define_keys.strip(), self.headers)
         return r
 
-class TestFragementComposer(BuildSystemFragmentComposer):
 
-    def __init__(self, testName, fileFragments, configTest = None, runTest = True, netTest = False, extraLibs = []):
+class TestFragementComposer(BuildSystemFragmentComposer):
+    def __init__(self,
+                 testName,
+                 fileFragments,
+                 configTest=None,
+                 runTest=True,
+                 netTest=False,
+                 extraLibs=[]):
         self.testName = testName
         self.fileFragments = fileFragments
         self.configTest = configTest
@@ -514,21 +590,32 @@ class TestFragementComposer(BuildSystemFragmentComposer):
         self.extraLibs = extraLibs
 
     def compose(self, path):
-        return ['tests', self.testName, ('default', None)], { 'configTest': self.configTest,
-                                                              'files': self.fileFragments,
-                                                              'run': self.runTest,
-                                                              'net': self.netTest,
-                                                              'libs': self.extraLibs}
+        return ['tests', self.testName, ('default', None)], {
+            'configTest': self.configTest,
+            'files': self.fileFragments,
+            'run': self.runTest,
+            'net': self.netTest,
+            'libs': self.extraLibs
+        }
 
-class TestIfHeaderComposer(TestFragementComposer):
 
-    def __init__(self, testName, headers, fileFragments, runTest = True, netTest = False, extraLibs = []):
+class TestIfHeaderComposer(TestFragementComposer):
+    def __init__(self,
+                 testName,
+                 headers,
+                 fileFragments,
+                 runTest=True,
+                 netTest=False,
+                 extraLibs=[]):
         if headers is not list:
             headers = [headers]
         self.headers = headers
-        super(TestIfHeaderComposer, self).__init__(testName, fileFragments, 'header',
-                                                   runTest = runTest, netTest = netTest,
-                                                   extraLibs = extraLibs)
+        super(TestIfHeaderComposer, self).__init__(testName,
+                                                   fileFragments,
+                                                   'header',
+                                                   runTest=runTest,
+                                                   netTest=netTest,
+                                                   extraLibs=extraLibs)
 
     def compose(self, path):
         r = TestFragementComposer.compose(self, path)
@@ -541,15 +628,24 @@ class TestIfHeaderComposer(TestFragementComposer):
         r[0][2] = (define_keys.strip(), self.headers)
         return r
 
-class TestIfLibraryComposer(TestFragementComposer):
 
-    def __init__(self, testName, libraries, fileFragments, runTest = True, netTest = False, extraLibs = []):
+class TestIfLibraryComposer(TestFragementComposer):
+    def __init__(self,
+                 testName,
+                 libraries,
+                 fileFragments,
+                 runTest=True,
+                 netTest=False,
+                 extraLibs=[]):
         if libraries is not list:
             libraries = [libraries]
         self.libraries = libraries
-        super(TestIfLibraryComposer, self).__init__(testName, fileFragments, 'library',
-                                                    runTest = runTest, netTest = netTest,
-                                                    extraLibs = extraLibs)
+        super(TestIfLibraryComposer, self).__init__(testName,
+                                                    fileFragments,
+                                                    'library',
+                                                    runTest=runTest,
+                                                    netTest=netTest,
+                                                    extraLibs=extraLibs)
 
     def compose(self, path):
         r = TestFragementComposer.compose(self, path)
@@ -562,65 +658,71 @@ class TestIfLibraryComposer(TestFragementComposer):
         r[0][2] = (define_keys.strip(), self.libraries)
         return r
 
-class KVMSymbolsFragmentComposer(BuildSystemFragmentComposer):
 
+class KVMSymbolsFragmentComposer(BuildSystemFragmentComposer):
     def compose(self, path):
-        return ['KVMSymbols', 'files', ('default', None)], [path], self.includes
+        return ['KVMSymbols', 'files',
+                ('default', None)], [path], self.includes
 
-class RPCGENFragmentComposer(BuildSystemFragmentComposer):
 
+class RPCGENFragmentComposer(BuildSystemFragmentComposer):
     def compose(self, path):
         return ['RPCGen', 'files', ('default', None)], [path]
 
-class RouteKeywordsFragmentComposer(BuildSystemFragmentComposer):
 
+class RouteKeywordsFragmentComposer(BuildSystemFragmentComposer):
     def compose(self, path):
         return ['RouteKeywords', 'files', ('default', None)], [path]
 
-class LexFragmentComposer(BuildSystemFragmentComposer):
 
-    def __init__(self, sym, dep, cflags = None, includes = None, build = True):
+class LexFragmentComposer(BuildSystemFragmentComposer):
+    def __init__(self, sym, dep, cflags=None, includes=None, build=True):
         self.sym = sym
         self.dep = dep
         self.cflags, self.includes = _cflagsIncludes(cflags, includes)
         self.build = build
 
     def compose(self, path):
-        d = { 'file': path,
-              'sym': self.sym,
-              'dep': self.dep,
-              'build': self.build }
+        d = {
+            'file': path,
+            'sym': self.sym,
+            'dep': self.dep,
+            'build': self.build
+        }
         if None not in self.cflags:
             d['cflags'] = self.cflags
         if None not in self.includes:
             d['includes'] = self.includes
         return ['lex', path, ('default', None)], d
 
-class YaccFragmentComposer(BuildSystemFragmentComposer):
 
-    def __init__(self, sym, header, cflags = None, includes = None, build = True):
+class YaccFragmentComposer(BuildSystemFragmentComposer):
+    def __init__(self, sym, header, cflags=None, includes=None, build=True):
         self.sym = sym
         self.header = header
         self.cflags, self.includes = _cflagsIncludes(cflags, includes)
         self.build = build
 
     def compose(self, path):
-        d = { 'file': path,
-              'sym': self.sym,
-              'header': self.header,
-              'build': self.build }
+        d = {
+            'file': path,
+            'sym': self.sym,
+            'header': self.header,
+            'build': self.build
+        }
         if None not in self.cflags:
             d['cflags'] = self.cflags
         if None not in self.includes:
             d['includes'] = self.includes
         return ['yacc', path, ('default', None)], d
 
+
 #
 # File - a file in the source we move backwards and forwards.
 #
 class File(object):
-    def __init__(self, path, pathComposer,
-                 forwardConverter, reverseConverter, buildSystemComposer):
+    def __init__(self, path, pathComposer, forwardConverter, reverseConverter,
+                 buildSystemComposer):
         if verbose(verboseMoreDetail):
             print("FILE: %-50s F:%-45s R:%-45s" % \
                   (path,
@@ -629,7 +731,8 @@ class File(object):
         self.path = path
         self.pathComposer = pathComposer
         self.originPath = self.pathComposer.composeOriginPath(self.path)
-        self.libbsdPath = self.pathComposer.composeLibBSDPath(self.path, LIBBSD_DIR)
+        self.libbsdPath = self.pathComposer.composeLibBSDPath(
+            self.path, LIBBSD_DIR)
         self.forwardConverter = forwardConverter
         self.reverseConverter = reverseConverter
         self.buildSystemComposer = buildSystemComposer
@@ -637,7 +740,8 @@ class File(object):
     def processSource(self, forward):
         if forward:
             if verbose(verboseDetail):
-                print("process source: %s => %s" % (self.originPath, self.libbsdPath))
+                print("process source: %s => %s" %
+                      (self.originPath, self.libbsdPath))
             self.forwardConverter.convert(self.originPath, self.libbsdPath)
         else:
             if verbose(verboseDetail):
@@ -646,13 +750,15 @@ class File(object):
             self.reverseConverter.convert(self.libbsdPath, self.originPath)
 
     def getFragment(self):
-        return self.buildSystemComposer.compose(self.pathComposer.composeLibBSDPath(self.path, ''))
+        return self.buildSystemComposer.compose(
+            self.pathComposer.composeLibBSDPath(self.path, ''))
+
 
 #
 # Module - logical group of related files we can perform actions on
 #
 class Module(object):
-    def __init__(self, manager, name, enabled = True):
+    def __init__(self, manager, name, enabled=True):
         self.manager = manager
         self.name = name
         self.conditionalOn = "none"
@@ -673,7 +779,9 @@ class Module(object):
             for f in files:
                 f.processSource(direction)
 
-    def addFiles(self, newFiles, buildSystemComposer = BuildSystemFragmentComposer()):
+    def addFiles(self,
+                 newFiles,
+                 buildSystemComposer=BuildSystemFragmentComposer()):
         files = []
         for newFile in newFiles:
             assertFile(newFile)
@@ -683,14 +791,20 @@ class Module(object):
     def addFile(self, f):
         self.files += [f]
 
-    def addFiles(self, newFiles,
-                 pathComposer, forwardConverter, reverseConverter,
-                 assertFile, buildSystemComposer = BuildSystemFragmentComposer()):
+    def addFiles(self,
+                 newFiles,
+                 pathComposer,
+                 forwardConverter,
+                 reverseConverter,
+                 assertFile,
+                 buildSystemComposer=BuildSystemFragmentComposer()):
         files = []
         for newFile in newFiles:
             assertFile(newFile)
-            files += [File(newFile, pathComposer, forwardConverter,
-                           reverseConverter, buildSystemComposer)]
+            files += [
+                File(newFile, pathComposer, forwardConverter, reverseConverter,
+                     buildSystemComposer)
+            ]
         return files
 
     def addPlainTextFile(self, files):
@@ -699,71 +813,75 @@ class Module(object):
                                     Converter(), assertNothing)
 
     def addKernelSpaceHeaderFiles(self, files):
-        self.files += self.addFiles(files,
-                                    FreeBSDPathComposer(), FromFreeBSDToRTEMSHeaderConverter(),
-                                    FromRTEMSToFreeBSDHeaderConverter(), assertHeaderOrSourceFile)
+        self.files += self.addFiles(files, FreeBSDPathComposer(),
+                                    FromFreeBSDToRTEMSHeaderConverter(),
+                                    FromRTEMSToFreeBSDHeaderConverter(),
+                                    assertHeaderOrSourceFile)
 
     def addUserSpaceHeaderFiles(self, files):
-        self.files += self.addFiles(files,
-                                    FreeBSDPathComposer(), FromFreeBSDToRTEMSUserSpaceHeaderConverter(),
-                                    FromRTEMSToFreeBSDHeaderConverter(), assertHeaderFile)
+        self.files += self.addFiles(
+            files, FreeBSDPathComposer(),
+            FromFreeBSDToRTEMSUserSpaceHeaderConverter(),
+            FromRTEMSToFreeBSDHeaderConverter(), assertHeaderFile)
 
     def addRTEMSHeaderFiles(self, files):
-        self.files += self.addFiles(files, RTEMSPathComposer(),
-                                    NoConverter(), NoConverter(), assertHeaderFile)
+        self.files += self.addFiles(files, RTEMSPathComposer(), NoConverter(),
+                                    NoConverter(), assertHeaderFile)
 
     def addLinuxHeaderFiles(self, files):
-        self.files += self.addFiles(files,
-                                    PathComposer(), NoConverter(),
+        self.files += self.addFiles(files, PathComposer(), NoConverter(),
                                     NoConverter(), assertHeaderFile)
 
     def addCPUDependentFreeBSDHeaderFiles(self, files):
-        self.files += self.addFiles(files,
-                                    CPUDependentFreeBSDPathComposer(), FromFreeBSDToRTEMSHeaderConverter(),
-                                    FromRTEMSToFreeBSDHeaderConverter(), assertHeaderFile)
+        self.files += self.addFiles(files, CPUDependentFreeBSDPathComposer(),
+                                    FromFreeBSDToRTEMSHeaderConverter(),
+                                    FromRTEMSToFreeBSDHeaderConverter(),
+                                    assertHeaderFile)
 
     def addCPUDependentLinuxHeaderFiles(self, files):
-        self.files += self.addFiles(files,
-                                    CPUDependentLinuxPathComposer(), NoConverter(),
-                                    NoConverter(), assertHeaderFile)
+        self.files += self.addFiles(files, CPUDependentLinuxPathComposer(),
+                                    NoConverter(), NoConverter(),
+                                    assertHeaderFile)
 
-    def addTargetSourceCPUDependentHeaderFiles(self, targetCPUs, sourceCPU, files):
+    def addTargetSourceCPUDependentHeaderFiles(self, targetCPUs, sourceCPU,
+                                               files):
         for cpu in targetCPUs:
-            self.files += self.addFiles(files,
-                                        TargetSourceCPUDependentPathComposer(cpu, sourceCPU),
-                                        FromFreeBSDToRTEMSHeaderConverter(),
-                                        NoConverter(), assertHeaderFile)
+            self.files += self.addFiles(
+                files, TargetSourceCPUDependentPathComposer(cpu, sourceCPU),
+                FromFreeBSDToRTEMSHeaderConverter(), NoConverter(),
+                assertHeaderFile)
 
     def addSourceFiles(self, files, sourceFileFragmentComposer):
-        self.files += self.addFiles(files,
-                                    PathComposer(), NoConverter(), NoConverter(), assertSourceFile,
+        self.files += self.addFiles(files, PathComposer(), NoConverter(),
+                                    NoConverter(), assertSourceFile,
                                     sourceFileFragmentComposer)
 
     def addKernelSpaceSourceFiles(self, files, sourceFileFragmentComposer):
-        self.files += self.addFiles(files,
-                                    FreeBSDPathComposer(), FromFreeBSDToRTEMSSourceConverter(),
-                                    FromRTEMSToFreeBSDSourceConverter(), assertSourceFile,
+        self.files += self.addFiles(files, FreeBSDPathComposer(),
+                                    FromFreeBSDToRTEMSSourceConverter(),
+                                    FromRTEMSToFreeBSDSourceConverter(),
+                                    assertSourceFile,
                                     sourceFileFragmentComposer)
 
     def addUserSpaceSourceFiles(self, files, sourceFileFragmentComposer):
-        self.files += self.addFiles(files,
-                                    FreeBSDPathComposer(),
-                                    FromFreeBSDToRTEMSUserSpaceSourceConverter(),
-                                    FromRTEMSToFreeBSDSourceConverter(), assertSourceFile,
-                                    sourceFileFragmentComposer)
+        self.files += self.addFiles(
+            files, FreeBSDPathComposer(),
+            FromFreeBSDToRTEMSUserSpaceSourceConverter(),
+            FromRTEMSToFreeBSDSourceConverter(), assertSourceFile,
+            sourceFileFragmentComposer)
 
     def addRTEMSSourceFiles(self, files, sourceFileFragmentComposer):
-        self.files += self.addFiles(files,
-                                    RTEMSPathComposer(), NoConverter(), NoConverter(),
-                                    assertSourceFile, sourceFileFragmentComposer)
+        self.files += self.addFiles(files, RTEMSPathComposer(), NoConverter(),
+                                    NoConverter(), assertSourceFile,
+                                    sourceFileFragmentComposer)
 
     def addLinuxSourceFiles(self, files, sourceFileFragmentComposer):
-        self.files += self.addFiles(files,
-                                    PathComposer(), NoConverter(),
+        self.files += self.addFiles(files, PathComposer(), NoConverter(),
                                     NoConverter(), assertSourceFile,
                                     sourceFileFragmentComposer)
 
-    def addCPUDependentFreeBSDSourceFiles(self, cpus, files, sourceFileFragmentComposer):
+    def addCPUDependentFreeBSDSourceFiles(self, cpus, files,
+                                          sourceFileFragmentComposer):
         for cpu in cpus:
             self.initCPUDependencies(cpu)
             self.cpuDependentSourceFiles[cpu] += \
@@ -772,7 +890,8 @@ class Module(object):
                               FromRTEMSToFreeBSDSourceConverter(), assertSourceFile,
                               sourceFileFragmentComposer)
 
-    def addCPUDependentRTEMSSourceFiles(self, cpus, files, sourceFileFragmentComposer):
+    def addCPUDependentRTEMSSourceFiles(self, cpus, files,
+                                        sourceFileFragmentComposer):
         for cpu in cpus:
             self.initCPUDependencies(cpu)
             self.cpuDependentSourceFiles[cpu] += \
@@ -781,7 +900,8 @@ class Module(object):
                               NoConverter(), assertSourceFile,
                               sourceFileFragmentComposer)
 
-    def addCPUDependentLinuxSourceFiles(self, cpus, files, sourceFileFragmentComposer):
+    def addCPUDependentLinuxSourceFiles(self, cpus, files,
+                                        sourceFileFragmentComposer):
         for cpu in cpus:
             self.initCPUDependencies(cpu)
             self.cpuDependentSourceFiles[cpu] += \
@@ -791,13 +911,15 @@ class Module(object):
                               sourceFileFragmentComposer)
 
     def addTest(self, testFragementComposer):
-        self.files += [File(testFragementComposer.testName,
-                            PathComposer(), NoConverter(), NoConverter(),
-                            testFragementComposer)]
+        self.files += [
+            File(testFragementComposer.testName, PathComposer(), NoConverter(),
+                 NoConverter(), testFragementComposer)
+        ]
 
     def addDependency(self, dep):
         self.dependencies += [dep]
 
+
 #
 # Manager - a collection of modules.
 #
@@ -858,9 +980,12 @@ class ModuleManager(object):
     def setGenerators(self):
         self.generator['convert'] = Converter
         self.generator['no-convert'] = NoConverter
-        self.generator['from-FreeBSD-to-RTEMS-UserSpaceSourceConverter'] = FromFreeBSDToRTEMSUserSpaceSourceConverter
-        self.generator['from-RTEMS-To-FreeBSD-SourceConverter'] = FromRTEMSToFreeBSDSourceConverter
-        self.generator['buildSystemFragmentComposer'] = BuildSystemFragmentComposer
+        self.generator[
+            'from-FreeBSD-to-RTEMS-UserSpaceSourceConverter'] = FromFreeBSDToRTEMSUserSpaceSourceConverter
+        self.generator[
+            'from-RTEMS-To-FreeBSD-SourceConverter'] = FromRTEMSToFreeBSDSourceConverter
+        self.generator[
+            'buildSystemFragmentComposer'] = BuildSystemFragmentComposer
 
         self.generator['file'] = File
 
@@ -868,7 +993,8 @@ class ModuleManager(object):
         self.generator['freebsd-path'] = FreeBSDPathComposer
         self.generator['rtems-path'] = RTEMSPathComposer
         self.generator['cpu-path'] = CPUDependentFreeBSDPathComposer
-        self.generator['target-src-cpu--path'] = TargetSourceCPUDependentPathComposer
+        self.generator[
+            'target-src-cpu--path'] = TargetSourceCPUDependentPathComposer
 
         self.generator['source'] = SourceFileFragmentComposer
         self.generator['test'] = TestFragementComposer
diff --git a/waf_libbsd.py b/waf_libbsd.py
index a817e574..779aa7b2 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -1,7 +1,10 @@
+# SPDX-License-Identifier: BSD-2-Clause
+'''LibBSD build configuration to waf integration module.
+'''
+
+# Copyright (c) 2015, 2020 Chris Johns <chrisj at rtems.org>. All rights reserved.
 #
-#  Copyright (c) 2015-2018 Chris Johns <chrisj at rtems.org>. All rights reserved.
-#
-#  Copyright (c) 2009-2015 embedded brains GmbH.  All rights reserved.
+# Copyright (c) 2009, 2015 embedded brains GmbH.  All rights reserved.
 #
 #   embedded brains GmbH
 #   Dornierstr. 4
@@ -9,30 +12,31 @@
 #   Germany
 #   <info at embedded-brains.de>
 #
-#  Copyright (c) 2012 OAR Corporation. All rights reserved.
+# Copyright (c) 2012 OAR Corporation. All rights reserved.
 #
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions
-#  are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
 #
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
 
 from __future__ import print_function
+
 # Python 3 does no longer know the basestring class. Catch that.
 try:
     basestring
@@ -55,12 +59,12 @@ if windows:
 else:
     host_shell = ''
 
+
 #
 # The waf builder for libbsd.
 #
 class Builder(builder.ModuleManager):
-
-    def __init__(self, trace = False):
+    def __init__(self, trace=False):
         super(Builder, self).__init__()
         self.trace = trace
         self.data = {}
@@ -82,7 +86,6 @@ class Builder(builder.ModuleManager):
         return sources
 
     def generate(self, rtems_version):
-
         def _dataInsert(data, cpu, frag):
             #
             # The default handler returns an empty string. Skip it.
@@ -104,14 +107,14 @@ class Builder(builder.ModuleManager):
                     d[p] = {}
                 d = d[p]
                 if cpu not in d:
-                    d[cpu] = { }
+                    d[cpu] = {}
                 config = frag[0][2][0]
                 if config != 'default':
                     if 'configure' not in data:
-                        data['configure'] = { }
+                        data['configure'] = {}
                     configTest = frag[1]['configTest']
                     if configTest not in data['configure']:
-                        data['configure'][configTest] = { }
+                        data['configure'][configTest] = {}
                     data['configure'][configTest][config] = frag[0][2][1]
                 if type(frag[1]) is list:
                     if config not in d[cpu]:
@@ -156,20 +159,19 @@ class Builder(builder.ModuleManager):
                 for cfg in self.data['configure'][configTest]:
                     if configTest == 'header':
                         for h in self.data['configure'][configTest][cfg]:
-                            conf.check(header_name = h,
-                                       features = "c",
-                                       includes = conf.env.IFLAGS,
-                                       mandatory = False)
+                            conf.check(header_name=h,
+                                       features="c",
+                                       includes=conf.env.IFLAGS,
+                                       mandatory=False)
                     elif configTest == 'library':
                         for l in self.data['configure'][configTest][cfg]:
-                            conf.check_cc(lib = l,
-                                          fragment = rtems.test_application(),
-                                          execute = False,
-                                          mandatory = False)
+                            conf.check_cc(lib=l,
+                                          fragment=rtems.test_application(),
+                                          execute=False,
+                                          mandatory=False)
                     else:
                         bld.fatal('invalid config test: %s' % (configTest))
 
-
     def build(self, bld):
         #
         # Localize the config.
@@ -231,16 +233,17 @@ class Builder(builder.ModuleManager):
         # Network test configuration
         #
         if not os.path.exists(bld.env.NET_CONFIG):
-            bld.fatal('network configuraiton \'%s\' not found' % (bld.env.NET_CONFIG))
-        tags = [ 'NET_CFG_INTERFACE_0',
-                 'NET_CFG_SELF_IP',
-                 'NET_CFG_NETMASK',
-                 'NET_CFG_PEER_IP',
-                 'NET_CFG_GATEWAY_IP' ]
+            bld.fatal('network configuraiton \'%s\' not found' %
+                      (bld.env.NET_CONFIG))
+        tags = [
+            'NET_CFG_INTERFACE_0', 'NET_CFG_SELF_IP', 'NET_CFG_NETMASK',
+            'NET_CFG_PEER_IP', 'NET_CFG_GATEWAY_IP'
+        ]
         try:
             net_cfg_lines = open(bld.env.NET_CONFIG).readlines()
         except:
-            bld.fatal('network configuraiton \'%s\' read failed' % (bld.env.NET_CONFIG))
+            bld.fatal('network configuraiton \'%s\' read failed' %
+                      (bld.env.NET_CONFIG))
         lc = 0
         sed = 'sed '
         for l in net_cfg_lines:
@@ -255,10 +258,10 @@ class Builder(builder.ModuleManager):
                 for t in tags:
                     if lhs == t:
                         sed += "-e 's/@%s@/%s/' " % (t, rhs)
-        bld(target = "testsuite/include/rtems/bsd/test/network-config.h",
-            source = "testsuite/include/rtems/bsd/test/network-config.h.in",
-            rule = sed + " < ${SRC} > ${TGT}",
-            update_outputs = True)
+        bld(target="testsuite/include/rtems/bsd/test/network-config.h",
+            source="testsuite/include/rtems/bsd/test/network-config.h.in",
+            rule=sed + " < ${SRC} > ${TGT}",
+            update_outputs=True)
 
         #
         # Add a copy rule for all headers where the install path and the source
@@ -266,7 +269,8 @@ class Builder(builder.ModuleManager):
         #
         if 'header-paths' in config:
             header_build_copy_paths = [
-                hp for hp in config['header-paths'] if hp[2] != '' and not hp[0].endswith(hp[2])
+                hp for hp in config['header-paths']
+                if hp[2] != '' and not hp[0].endswith(hp[2])
             ]
             for headers in header_build_copy_paths:
                 target = os.path.join(buildinclude, headers[2])
@@ -274,10 +278,10 @@ class Builder(builder.ModuleManager):
                 for header in start_dir.ant_glob(headers[1]):
                     relsourcepath = header.path_from(start_dir)
                     targetheader = os.path.join(target, relsourcepath)
-                    bld(features = 'subst',
-                        target = targetheader,
-                        source = header,
-                        is_copy = True)
+                    bld(features='subst',
+                        target=targetheader,
+                        source=header,
+                        is_copy=True)
 
         #
         # Generate a header that contains information about enabled modules
@@ -296,12 +300,13 @@ class Builder(builder.ModuleManager):
                 output += '#define RTEMS_BSD_MODULE_{} 1\n'.format(modname)
             output += '#endif /* RTEMS_BSD_MODULES_H */\n'
             self.outputs[0].write(output)
+
         modules_h_file_with_path = os.path.join(buildinclude,
                                                 module_header_path,
                                                 module_header_name)
-        bld(rule = rtems_libbsd_modules_h_gen,
-            target = modules_h_file_with_path,
-            before = ['c', 'cxx'])
+        bld(rule=rtems_libbsd_modules_h_gen,
+            target=modules_h_file_with_path,
+            before=['c', 'cxx'])
 
         #
         # Add the specific rule based builders
@@ -316,15 +321,15 @@ class Builder(builder.ModuleManager):
                 kvmsymbols_includes = kvmsymbols['files']['includes']
             else:
                 kvmsymbols_includes = []
-            bld(target = kvmsymbols['files']['all']['default'][0],
-                source = 'rtemsbsd/rtems/generate_kvm_symbols',
-                rule = host_shell + './${SRC} > ${TGT}',
-                update_outputs = True)
-            bld.objects(target = 'kvmsymbols',
-                        features = 'c',
-                        cflags = cflags,
-                        includes = kvmsymbols_includes + includes,
-                        source = kvmsymbols['files']['all']['default'][0])
+            bld(target=kvmsymbols['files']['all']['default'][0],
+                source='rtemsbsd/rtems/generate_kvm_symbols',
+                rule=host_shell + './${SRC} > ${TGT}',
+                update_outputs=True)
+            bld.objects(target='kvmsymbols',
+                        features='c',
+                        cflags=cflags,
+                        includes=kvmsymbols_includes + includes,
+                        source=kvmsymbols['files']['all']['default'][0])
             libbsd_use += ["kvmsymbols"]
 
         bld.add_group()
@@ -336,9 +341,9 @@ class Builder(builder.ModuleManager):
             if bld.env.AUTO_REGEN:
                 rpcgen = self.data['RPCGen']
                 rpcname = rpcgen['files']['all']['default'][0][:-2]
-                bld(target = rpcname + '.h',
-                    source = rpcname + '.x',
-                    rule = host_shell + '${RPCGEN} -h -o ${TGT} ${SRC}')
+                bld(target=rpcname + '.h',
+                    source=rpcname + '.x',
+                    rule=host_shell + '${RPCGEN} -h -o ${TGT} ${SRC}')
 
         #
         # Route keywords
@@ -351,9 +356,7 @@ class Builder(builder.ModuleManager):
                            "awk 'BEGIN { r = 0 } { if (NF == 1) " + \
                            "printf \"#define\\tK_%%s\\t%%d\\n\\t{\\\"%%s\\\", K_%%s},\\n\", " + \
                            "toupper($1), ++r, $1, toupper($1)}' > ${TGT}"
-                bld(target = rkwname + '.h',
-                    source = rkwname,
-                    rule = rkw_rule)
+                bld(target=rkwname + '.h', source=rkwname, rule=rkw_rule)
 
         #
         # Lex
@@ -373,16 +376,16 @@ class Builder(builder.ModuleManager):
                 lex_rule = host_shell + '${LEX} -P ' + lex['sym'] + ' -t ${SRC} | ' + \
                            'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' > ${TGT}'
                 if bld.env.AUTO_REGEN:
-                    bld(target = lex['file'][:-2]+ '.c',
-                        source = lex['file'],
-                        rule = lex_rule)
+                    bld(target=lex['file'][:-2] + '.c',
+                        source=lex['file'],
+                        rule=lex_rule)
                 if lex['build']:
-                    bld.objects(target = 'lex_%s' % (lex['sym']),
-                                features = 'c',
-                                cflags = cflags,
-                                includes = lexIncludes + includes,
-                                defines = defines + lexDefines,
-                                source = lex['file'][:-2] + '.c')
+                    bld.objects(target='lex_%s' % (lex['sym']),
+                                features='c',
+                                cflags=cflags,
+                                includes=lexIncludes + includes,
+                                defines=defines + lexDefines,
+                                source=lex['file'][:-2] + '.c')
                 libbsd_use += ['lex_%s' % (lex['sym'])]
 
         #
@@ -397,7 +400,8 @@ class Builder(builder.ModuleManager):
                     yaccSym = yacc['sym']
                 else:
                     yaccSym = os.path.basename(yaccFile)[:-2]
-                yaccHeader = '%s/%s' % (os.path.dirname(yaccFile), yacc['header'])
+                yaccHeader = '%s/%s' % (os.path.dirname(yaccFile),
+                                        yacc['header'])
                 if 'cflags' in yacc:
                     yaccDefines = [d[2:] for d in yacc['cflags']]
                 else:
@@ -408,19 +412,20 @@ class Builder(builder.ModuleManager):
                     yaccIncludes = []
                 yacc_rule = host_shell + '${YACC} -b ' + yaccSym + \
                             ' -d -p ' + yaccSym + ' ${SRC} && ' + \
-                            'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' < ' + yaccSym + '.tab.c > ${TGT} && ' + \
+                            'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' < ' + \
+                            yaccSym + '.tab.c > ${TGT} && ' + \
                             'rm -f ' + yaccSym + '.tab.c && mv ' + yaccSym + '.tab.h ' + yaccHeader
                 if bld.env.AUTO_REGEN:
-                    bld(target = yaccFile[:-2] + '.c',
-                        source = yaccFile,
-                        rule = yacc_rule)
+                    bld(target=yaccFile[:-2] + '.c',
+                        source=yaccFile,
+                        rule=yacc_rule)
                 if yacc['build']:
-                    bld.objects(target = 'yacc_%s' % (yaccSym),
-                                features = 'c',
-                                cflags = cflags,
-                                includes = yaccIncludes + includes,
-                                defines = defines + yaccDefines,
-                                source = yaccFile[:-2] + '.c')
+                    bld.objects(target='yacc_%s' % (yaccSym),
+                                features='c',
+                                cflags=cflags,
+                                includes=yaccIncludes + includes,
+                                defines=defines + yaccDefines,
+                                source=yaccFile[:-2] + '.c')
                 libbsd_use += ['yacc_%s' % (yaccSym)]
 
         #
@@ -443,12 +448,12 @@ class Builder(builder.ModuleManager):
             for arch in archs:
                 if bld.get_env()['RTEMS_ARCH'] == arch:
                     bld_sources += Builder._sourceList(bld, build[arch])
-            bld.objects(target = target,
-                        features = 'c',
-                        cflags = cflags + sorted(build.get('cflags', [])),
-                        includes = sorted(build.get('includes', [])) + includes,
-                        defines = defines,
-                        source = bld_sources)
+            bld.objects(target=target,
+                        features='c',
+                        cflags=cflags + sorted(build.get('cflags', [])),
+                        includes=sorted(build.get('includes', [])) + includes,
+                        defines=defines,
+                        source=bld_sources)
             libbsd_use += [target]
 
         #
@@ -462,14 +467,14 @@ class Builder(builder.ModuleManager):
         for arch in archs:
             if bld.get_env()['RTEMS_ARCH'] == arch:
                 bld_sources += Builder._sourceList(bld, build[arch])
-        bld.stlib(target = 'bsd',
-                  features = 'c cxx',
-                  cflags = cflags,
-                  cxxflags = cxxflags,
-                  includes = includes,
-                  defines = defines,
-                  source = bld_sources,
-                  use = libbsd_use)
+        bld.stlib(target='bsd',
+                  features='c cxx',
+                  cflags=cflags,
+                  cxxflags=cxxflags,
+                  includes=includes,
+                  defines=defines,
+                  source=bld_sources,
+                  use=libbsd_use)
 
         #
         # Installs.
@@ -495,13 +500,13 @@ class Builder(builder.ModuleManager):
                 if start_dir != None:
                     bld.install_files("${PREFIX}/" + ipath,
                                       start_dir.ant_glob(headers[1]),
-                                      cwd = start_dir,
-                                      relative_trick = True)
+                                      cwd=start_dir,
+                                      relative_trick=True)
 
         bld.install_files(os.path.join("${PREFIX}", arch_inc_path,
                                        module_header_path),
                           modules_h_file_with_path,
-                          cwd = bld.path)
+                          cwd=bld.path)
 
         #
         # Tests
@@ -525,11 +530,11 @@ class Builder(builder.ModuleManager):
                                     for f in test[cfg]['files']]
                     libs = test[cfg]['libs'] + libs
             if build_test:
-                bld.program(target = '%s.exe' % (testName),
-                            features = 'cprogram',
-                            cflags = cflags,
-                            includes = includes,
-                            source = test_sources,
-                            use = ['bsd'],
-                            lib = libs,
-                            install_path = None)
+                bld.program(target='%s.exe' % (testName),
+                            features='cprogram',
+                            cflags=cflags,
+                            includes=includes,
+                            source=test_sources,
+                            use=['bsd'],
+                            lib=libs,
+                            install_path=None)
diff --git a/wscript b/wscript
index 03151bb2..55652ff8 100644
--- a/wscript
+++ b/wscript
@@ -1,28 +1,32 @@
-#
-# RTEMS Project (https://www.rtems.org/)
-#
+# SPDX-License-Identifier: BSD-2-Clause
+'''RTEMS LibBSD is a transparent source build of the FreeBSD kernel
+source for RTEMS.
+
+To use see README.waf shipped with this file.
+'''
+
 # Copyright (c) 2015-2016 Chris Johns <chrisj at rtems.org>. All rights reserved.
 #
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions
-#  are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
 #
-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
 
 #
 # RTEMS LibBSD is a transparent source build of the FreeBSD kernel source for RTEMS.
@@ -57,6 +61,7 @@ builders = {}
 BUILDSET_DIR = "buildset"
 BUILDSET_DEFAULT = "buildset/default.ini"
 
+
 def load_ini(conf, f):
     ini = configparser.ConfigParser()
     ini.read(f)
@@ -73,8 +78,9 @@ def load_ini(conf, f):
         elif os.path.isfile(os.path.join(BUILDSET_DIR, extends)):
             extendfile = os.path.join(BUILDSET_DIR, extends)
         else:
-            conf.fatal("'{}': Invalid file given for general/extends:'{}'"
-                .format(f, extends))
+            conf.fatal(
+                "'{}': Invalid file given for general/extends:'{}'".format(
+                    f, extends))
         base = load_ini(conf, extendfile)
         for s in ini.sections():
             if not base.has_section(s):
@@ -85,6 +91,7 @@ def load_ini(conf, f):
         ini = base
     return ini
 
+
 def load_config(conf, f):
     ini = load_ini(conf, f)
     config = {}
@@ -100,6 +107,7 @@ def load_config(conf, f):
             config['modules-enabled'].append(mod)
     return config
 
+
 def update_builders(ctx, buildset_opt):
     global builders
     builders = {}
@@ -111,7 +119,7 @@ def update_builders(ctx, buildset_opt):
         if os.path.isdir(bs):
             for f in os.listdir(bs):
                 if f[-4:] == ".ini":
-                    buildsets += [os.path.join(bs,f)]
+                    buildsets += [os.path.join(bs, f)]
         else:
             for f in bs.split(','):
                 buildsets += [f]
@@ -123,7 +131,8 @@ def update_builders(ctx, buildset_opt):
         bsname = bsconfig['name']
         builder.updateConfiguration(bsconfig)
         builder.generate(rtems_version)
-        builders[bsname]=builder
+        builders[bsname] = builder
+
 
 def bsp_init(ctx, env, contexts):
     # This function generates the builders and adds build-xxx, clean-xxx and
@@ -143,6 +152,7 @@ def bsp_init(ctx, env, contexts):
         for y in contexts:
             newcmd = y.cmd + '-' + builder
             newvariant = y.variant + '-' + builder
+
             class context(y):
                 cmd = str(newcmd)
                 variant = str(newvariant)
@@ -158,49 +168,66 @@ def bsp_init(ctx, env, contexts):
             commands += [str(cmd)]
     waflib.Options.commands = commands
 
+
 def init(ctx):
-    rtems.init(ctx, version = rtems_version, long_commands = True,
-               bsp_init = bsp_init)
+    rtems.init(ctx,
+               version=rtems_version,
+               long_commands=True,
+               bsp_init=bsp_init)
+
 
 def options(opt):
     rtems.options(opt)
     opt.add_option("--enable-auto-regen",
-                   action = "store_true",
-                   default = False,
-                   dest = "auto_regen",
-                   help = "Enable auto-regeneration of LEX, RPC and YACC files.")
+                   action="store_true",
+                   default=False,
+                   dest="auto_regen",
+                   help="Enable auto-regeneration of LEX, RPC and YACC files.")
     opt.add_option("--enable-warnings",
-                   action = "store_true",
-                   default = False,
-                   dest = "warnings",
-                   help = "Enable all warnings. The default is quiet builds.")
+                   action="store_true",
+                   default=False,
+                   dest="warnings",
+                   help="Enable all warnings. The default is quiet builds.")
     opt.add_option("--net-test-config",
-                   default = "config.inc",
-                   dest = "net_config",
-                   help = "Network test configuration.")
+                   default="config.inc",
+                   dest="net_config",
+                   help="Network test configuration.")
     opt.add_option("--freebsd-options",
-                   action = "store",
-                   default = "",
-                   dest = "freebsd_options",
-                   help = "Set FreeBSD options (developer option).")
-    opt.add_option("--optimization",
-                   action = "store",
-                   default = "2",
-                   dest = "optimization",
-                   help = "Set optimization level to OPTIMIZATION (-On compiler flag). Default is 2 (-O2).")
-    opt.add_option("--buildset",
-                   action = "append",
-                   default = [],
-                   dest = "buildset",
-                   help = "Select build sets to build. If set to a directory, all .ini file in this directory will be used.")
+                   action="store",
+                   default="",
+                   dest="freebsd_options",
+                   help="Set FreeBSD options (developer option).")
+    opt.add_option(
+        "--optimization",
+        action="store",
+        default="2",
+        dest="optimization",
+        help=
+        "Set optimization level to OPTIMIZATION (-On compiler flag). Default is 2 (-O2)."
+    )
+    opt.add_option(
+        "--buildset",
+        action="append",
+        default=[],
+        dest="buildset",
+        help=
+        "Select build sets to build. If set to a directory," \
+        " all .ini file in this directory will be used."
+    )
+
 
 def bsp_configure(conf, arch_bsp):
-    conf.check(header_name = "dlfcn.h", features = "c")
-    conf.check(header_name = "rtems/pci.h", features = "c", mandatory = False)
+    conf.check(header_name="dlfcn.h", features="c")
+    conf.check(header_name="rtems/pci.h", features="c", mandatory=False)
     if not rtems.check_posix(conf):
-        conf.fatal("RTEMS kernel POSIX support is disabled; configure RTEMS with --enable-posix")
+        conf.fatal(
+            "RTEMS kernel POSIX support is disabled; configure RTEMS with --enable-posix"
+        )
     if rtems.check_networking(conf):
-        conf.fatal("RTEMS kernel contains the old network support; configure RTEMS with --disable-networking")
+        conf.fatal(
+            "RTEMS kernel contains the old network support;" \
+            " configure RTEMS with --disable-networking"
+        )
     env = conf.env.derive()
     for builder in builders:
         ab = conf.env.RTEMS_ARCH_BSP
@@ -210,15 +237,16 @@ def bsp_configure(conf, arch_bsp):
         builders[builder].bsp_configure(conf, arch_bsp)
         conf.setenv(ab)
 
+
 def configure(conf):
     if conf.options.auto_regen:
-        conf.find_program("lex", mandatory = True)
-        conf.find_program("rpcgen", mandatory = True)
-        conf.find_program("yacc", mandatory = True)
+        conf.find_program("lex", mandatory=True)
+        conf.find_program("rpcgen", mandatory=True)
+        conf.find_program("yacc", mandatory=True)
     conf.env.AUTO_REGEN = conf.options.auto_regen
     conf.env.WARNINGS = conf.options.warnings
     conf.env.NET_CONFIG = conf.options.net_config
-    conf.env.FREEBSD_OPTIONS =conf.options.freebsd_options
+    conf.env.FREEBSD_OPTIONS = conf.options.freebsd_options
     conf.env.OPTIMIZATION = conf.options.optimization
     conf.env.BUILDSET = conf.options.buildset
     if len(conf.env.BUILDSET) == 0:
@@ -226,9 +254,11 @@ def configure(conf):
     update_builders(conf, conf.env.BUILDSET)
     rtems.configure(conf, bsp_configure)
 
+
 def test(bld):
     rtems.test_uninstall(bld)
 
+
 def build(bld):
     rtems.build(bld)
     builders[bld.libbsd_buildset_name].build(bld)
-- 
2.24.1



More information about the devel mailing list