Add airframe .post scripts on NuttX targets

This commit is contained in:
Julien Lecoeur
2019-07-20 20:09:42 +02:00
committed by Beat Küng
parent e964af9262
commit daeba4e75f
5 changed files with 47 additions and 13 deletions
+16 -10
View File
@@ -29,7 +29,7 @@ class ParameterGroup(object):
Get parameter group vehicle type.
"""
return self.af_class
def GetImageName(self):
"""
Get parameter group image base name (w/o extension)
@@ -127,11 +127,12 @@ class Parameter(object):
# all others == 0 (sorted alphabetically)
}
def __init__(self, path, name, airframe_type, airframe_class, airframe_id, maintainer):
def __init__(self, path, post_path, name, airframe_type, airframe_class, airframe_id, maintainer):
self.fields = {}
self.outputs = {}
self.archs = {}
self.path = path
self.post_path = post_path
self.name = name
self.type = airframe_type
self.af_class = airframe_class
@@ -141,6 +142,9 @@ class Parameter(object):
def GetPath(self):
return self.path
def GetPostPath(self):
return self.post_path
def GetName(self):
return self.name
@@ -384,8 +388,14 @@ class SourceParser(object):
sys.stderr.write("Aborting due to missing @name tag in file: '%s'\n" % path)
return False
# Check if a .post script exists
if os.path.isfile(path + '.post'):
post_path = path + '.post'
else:
post_path = None
# We already know this is an airframe config, so add it
param = Parameter(path, airframe_name, airframe_type, airframe_class, airframe_id, maintainer)
param = Parameter(path, post_path, airframe_name, airframe_type, airframe_class, airframe_id, maintainer)
# Done with file, store
for tag in tags:
@@ -407,13 +417,10 @@ class SourceParser(object):
# Store outputs
for arch in archs:
param.SetArch(arch, archs[arch])
# Store the parameter
#Create a class-specific airframe group. This is needed to catch cases where an airframe type might cross classes (e.g. simulation)
# Create a class-specific airframe group. This is needed to catch cases where an airframe type might cross classes (e.g. simulation)
class_group_identifier=airframe_type+airframe_class
if class_group_identifier not in self.param_groups:
#self.param_groups[airframe_type] = ParameterGroup(airframe_type) #HW TEST REMOVE
@@ -458,7 +465,7 @@ class SourceParser(object):
groups = sorted(groups, key=lambda x: x.GetName())
groups = sorted(groups, key=lambda x: x.GetClass())
groups = sorted(groups, key=lambda x: self.priority.get(x.GetName(), 0), reverse=True)
#Rename duplicate groups to include the class (creating unique headings in page TOC)
duplicate_test=set()
duplicate_set=set()
@@ -471,5 +478,4 @@ class SourceParser(object):
if group.GetName() in duplicate_set:
group.name=group.GetName()+' (%s)' % group.GetClass()
return groups