Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 2 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 3 | '''Phosphor Inventory Manager YAML parser and code generator. |
| 4 | |
| 5 | The parser workflow is broken down as follows: |
| 6 | 1 - Import YAML files as native python type(s) instance(s). |
| 7 | 2 - Create an instance of the Everything class from the |
| 8 | native python type instance(s) with the Everything.load |
| 9 | method. |
| 10 | 3 - The Everything class constructor orchestrates conversion of the |
| 11 | native python type(s) instances(s) to render helper types. |
| 12 | Each render helper type constructor imports its attributes |
| 13 | from the native python type(s) instances(s). |
| 14 | 4 - Present the converted YAML to the command processing method |
| 15 | requested by the script user. |
| 16 | ''' |
| 17 | |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 18 | import sys |
| 19 | import os |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 20 | import argparse |
Brad Bishop | cfb3c89 | 2016-11-12 11:43:37 -0500 | [diff] [blame] | 21 | import subprocess |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 22 | import yaml |
| 23 | import mako.lookup |
| 24 | import sdbusplus.property |
| 25 | from sdbusplus.namedelement import NamedElement |
| 26 | from sdbusplus.renderer import Renderer |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 27 | |
| 28 | |
Matthew Barth | 979eb59 | 2018-10-05 15:29:26 -0500 | [diff] [blame] | 29 | # Global busname for use within classes where necessary |
| 30 | busname = "xyz.openbmc_project.Inventory.Manager" |
| 31 | |
| 32 | |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 33 | def cppTypeName(yaml_type): |
| 34 | ''' Convert yaml types to cpp types.''' |
| 35 | return sdbusplus.property.Property(type=yaml_type).cppTypeName |
| 36 | |
| 37 | |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 38 | class InterfaceComposite(object): |
| 39 | '''Compose interface properties.''' |
| 40 | |
| 41 | def __init__(self, dict): |
| 42 | self.dict = dict |
| 43 | |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 44 | def interfaces(self): |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 45 | return list(self.dict.keys()) |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 46 | |
| 47 | def names(self, interface): |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 48 | names = [] |
| 49 | if self.dict[interface]: |
Brad Bishop | 3864659 | 2019-04-12 18:05:45 +0000 | [diff] [blame] | 50 | names = [NamedElement(name=x["name"]) for x in self.dict[interface]] |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 51 | return names |
| 52 | |
| 53 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 54 | class Interface(list): |
| 55 | '''Provide various interface transformations.''' |
| 56 | |
| 57 | def __init__(self, iface): |
| 58 | super(Interface, self).__init__(iface.split('.')) |
| 59 | |
| 60 | def namespace(self): |
| 61 | '''Represent as an sdbusplus namespace.''' |
| 62 | return '::'.join(['sdbusplus'] + self[:-1] + ['server', self[-1]]) |
| 63 | |
| 64 | def header(self): |
| 65 | '''Represent as an sdbusplus server binding header.''' |
| 66 | return os.sep.join(self + ['server.hpp']) |
| 67 | |
| 68 | def __str__(self): |
| 69 | return '.'.join(self) |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 70 | |
Brad Bishop | cfb3c89 | 2016-11-12 11:43:37 -0500 | [diff] [blame] | 71 | |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 72 | class Indent(object): |
| 73 | '''Help templates be depth agnostic.''' |
| 74 | |
| 75 | def __init__(self, depth=0): |
| 76 | self.depth = depth |
| 77 | |
| 78 | def __add__(self, depth): |
| 79 | return Indent(self.depth + depth) |
| 80 | |
| 81 | def __call__(self, depth): |
| 82 | '''Render an indent at the current depth plus depth.''' |
| 83 | return 4*' '*(depth + self.depth) |
| 84 | |
| 85 | |
| 86 | class Template(NamedElement): |
| 87 | '''Associate a template name with its namespace.''' |
| 88 | |
| 89 | def __init__(self, **kw): |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 90 | self.namespace = kw.pop('namespace', []) |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 91 | super(Template, self).__init__(**kw) |
| 92 | |
| 93 | def qualified(self): |
| 94 | return '::'.join(self.namespace + [self.name]) |
| 95 | |
| 96 | |
Brad Bishop | db9b325 | 2017-01-30 08:58:40 -0500 | [diff] [blame] | 97 | class FixBool(object): |
| 98 | '''Un-capitalize booleans.''' |
| 99 | |
| 100 | def __call__(self, arg): |
| 101 | return '{0}'.format(arg.lower()) |
| 102 | |
| 103 | |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 104 | class Quote(object): |
| 105 | '''Decorate an argument by quoting it.''' |
| 106 | |
| 107 | def __call__(self, arg): |
| 108 | return '"{0}"'.format(arg) |
| 109 | |
| 110 | |
| 111 | class Cast(object): |
| 112 | '''Decorate an argument by casting it.''' |
| 113 | |
| 114 | def __init__(self, cast, target): |
| 115 | '''cast is the cast type (static, const, etc...). |
| 116 | target is the cast target type.''' |
| 117 | self.cast = cast |
| 118 | self.target = target |
| 119 | |
| 120 | def __call__(self, arg): |
| 121 | return '{0}_cast<{1}>({2})'.format(self.cast, self.target, arg) |
| 122 | |
| 123 | |
| 124 | class Literal(object): |
| 125 | '''Decorate an argument with a literal operator.''' |
| 126 | |
Brad Bishop | 134d2cb | 2017-02-23 12:37:56 -0500 | [diff] [blame] | 127 | integer_types = [ |
| 128 | 'int8', |
| 129 | 'int16', |
| 130 | 'int32', |
| 131 | 'int64', |
| 132 | 'uint8', |
| 133 | 'uint16', |
| 134 | 'uint32', |
| 135 | 'uint64' |
| 136 | ] |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 137 | |
| 138 | def __init__(self, type): |
| 139 | self.type = type |
| 140 | |
| 141 | def __call__(self, arg): |
Brad Bishop | 134d2cb | 2017-02-23 12:37:56 -0500 | [diff] [blame] | 142 | if 'uint' in self.type: |
| 143 | arg = '{0}ull'.format(arg) |
| 144 | elif 'int' in self.type: |
| 145 | arg = '{0}ll'.format(arg) |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 146 | |
Brad Bishop | 134d2cb | 2017-02-23 12:37:56 -0500 | [diff] [blame] | 147 | if self.type in self.integer_types: |
| 148 | return Cast('static', '{0}_t'.format(self.type))(arg) |
| 149 | |
| 150 | if self.type == 'string': |
| 151 | return '{0}s'.format(arg) |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 152 | |
| 153 | return arg |
| 154 | |
| 155 | |
Brad Bishop | 75800cf | 2017-01-21 15:24:18 -0500 | [diff] [blame] | 156 | class Argument(NamedElement, Renderer): |
| 157 | '''Define argument type inteface.''' |
| 158 | |
| 159 | def __init__(self, **kw): |
| 160 | self.type = kw.pop('type', None) |
| 161 | super(Argument, self).__init__(**kw) |
| 162 | |
| 163 | def argument(self, loader, indent): |
| 164 | raise NotImplementedError |
| 165 | |
| 166 | |
| 167 | class TrivialArgument(Argument): |
| 168 | '''Non-array type arguments.''' |
Brad Bishop | 14a9fe5 | 2016-11-12 12:51:26 -0500 | [diff] [blame] | 169 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 170 | def __init__(self, **kw): |
| 171 | self.value = kw.pop('value') |
Brad Bishop | 75800cf | 2017-01-21 15:24:18 -0500 | [diff] [blame] | 172 | self.decorators = kw.pop('decorators', []) |
| 173 | if kw.get('type', None) == 'string': |
| 174 | self.decorators.insert(0, Quote()) |
Brad Bishop | db9b325 | 2017-01-30 08:58:40 -0500 | [diff] [blame] | 175 | if kw.get('type', None) == 'boolean': |
| 176 | self.decorators.insert(0, FixBool()) |
Brad Bishop | 75800cf | 2017-01-21 15:24:18 -0500 | [diff] [blame] | 177 | |
Brad Bishop | 75800cf | 2017-01-21 15:24:18 -0500 | [diff] [blame] | 178 | super(TrivialArgument, self).__init__(**kw) |
| 179 | |
| 180 | def argument(self, loader, indent): |
| 181 | a = str(self.value) |
| 182 | for d in self.decorators: |
| 183 | a = d(a) |
| 184 | |
| 185 | return a |
Brad Bishop | 14a9fe5 | 2016-11-12 12:51:26 -0500 | [diff] [blame] | 186 | |
Brad Bishop | 14a9fe5 | 2016-11-12 12:51:26 -0500 | [diff] [blame] | 187 | |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 188 | class InitializerList(Argument): |
| 189 | '''Initializer list arguments.''' |
| 190 | |
| 191 | def __init__(self, **kw): |
| 192 | self.values = kw.pop('values') |
| 193 | super(InitializerList, self).__init__(**kw) |
| 194 | |
| 195 | def argument(self, loader, indent): |
| 196 | return self.render( |
| 197 | loader, |
| 198 | 'argument.mako.cpp', |
| 199 | arg=self, |
| 200 | indent=indent) |
| 201 | |
| 202 | |
Brad Bishop | 75800cf | 2017-01-21 15:24:18 -0500 | [diff] [blame] | 203 | class DbusSignature(Argument): |
| 204 | '''DBus signature arguments.''' |
| 205 | |
| 206 | def __init__(self, **kw): |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 207 | self.sig = {x: y for x, y in kw.items()} |
Brad Bishop | 75800cf | 2017-01-21 15:24:18 -0500 | [diff] [blame] | 208 | kw.clear() |
| 209 | super(DbusSignature, self).__init__(**kw) |
| 210 | |
| 211 | def argument(self, loader, indent): |
| 212 | return self.render( |
| 213 | loader, |
| 214 | 'signature.mako.cpp', |
| 215 | signature=self, |
| 216 | indent=indent) |
| 217 | |
| 218 | |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 219 | class MethodCall(Argument): |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 220 | '''Render syntatically correct c++ method calls.''' |
| 221 | |
| 222 | def __init__(self, **kw): |
| 223 | self.namespace = kw.pop('namespace', []) |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 224 | self.templates = kw.pop('templates', []) |
| 225 | self.args = kw.pop('args', []) |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 226 | super(MethodCall, self).__init__(**kw) |
| 227 | |
Brad Bishop | cab2bdd | 2017-01-21 15:00:54 -0500 | [diff] [blame] | 228 | def call(self, loader, indent): |
| 229 | return self.render( |
| 230 | loader, |
| 231 | 'method.mako.cpp', |
| 232 | method=self, |
| 233 | indent=indent) |
| 234 | |
| 235 | def argument(self, loader, indent): |
| 236 | return self.call(loader, indent) |
| 237 | |
Brad Bishop | 14a9fe5 | 2016-11-12 12:51:26 -0500 | [diff] [blame] | 238 | |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 239 | class Vector(MethodCall): |
| 240 | '''Convenience type for vectors.''' |
| 241 | |
| 242 | def __init__(self, **kw): |
| 243 | kw['name'] = 'vector' |
| 244 | kw['namespace'] = ['std'] |
| 245 | kw['args'] = [InitializerList(values=kw.pop('args'))] |
| 246 | super(Vector, self).__init__(**kw) |
| 247 | |
| 248 | |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 249 | class Filter(MethodCall): |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 250 | '''Convenience type for filters''' |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 251 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 252 | def __init__(self, **kw): |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 253 | kw['name'] = 'make_filter' |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 254 | super(Filter, self).__init__(**kw) |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 255 | |
Brad Bishop | 0a6a479 | 2016-11-12 12:10:07 -0500 | [diff] [blame] | 256 | |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 257 | class Action(MethodCall): |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 258 | '''Convenience type for actions''' |
Brad Bishop | 561a565 | 2016-10-26 21:13:32 -0500 | [diff] [blame] | 259 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 260 | def __init__(self, **kw): |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 261 | kw['name'] = 'make_action' |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 262 | super(Action, self).__init__(**kw) |
Brad Bishop | 92665b2 | 2016-10-26 20:51:16 -0500 | [diff] [blame] | 263 | |
Brad Bishop | cfb3c89 | 2016-11-12 11:43:37 -0500 | [diff] [blame] | 264 | |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 265 | class PathCondition(MethodCall): |
| 266 | '''Convenience type for path conditions''' |
| 267 | |
| 268 | def __init__(self, **kw): |
| 269 | kw['name'] = 'make_path_condition' |
| 270 | super(PathCondition, self).__init__(**kw) |
| 271 | |
| 272 | |
Matthew Barth | 979eb59 | 2018-10-05 15:29:26 -0500 | [diff] [blame] | 273 | class GetProperty(MethodCall): |
| 274 | '''Convenience type for getting inventory properties''' |
| 275 | |
| 276 | def __init__(self, **kw): |
| 277 | kw['name'] = 'make_get_property' |
| 278 | super(GetProperty, self).__init__(**kw) |
| 279 | |
| 280 | |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 281 | class CreateObjects(MethodCall): |
| 282 | '''Assemble a createObjects functor.''' |
Brad Bishop | db92c28 | 2017-01-21 23:44:28 -0500 | [diff] [blame] | 283 | |
| 284 | def __init__(self, **kw): |
| 285 | objs = [] |
| 286 | |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 287 | for path, interfaces in kw.pop('objs').items(): |
Brad Bishop | db92c28 | 2017-01-21 23:44:28 -0500 | [diff] [blame] | 288 | key_o = TrivialArgument( |
| 289 | value=path, |
| 290 | type='string', |
| 291 | decorators=[Literal('string')]) |
| 292 | value_i = [] |
| 293 | |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 294 | for interface, properties, in interfaces.items(): |
Brad Bishop | db92c28 | 2017-01-21 23:44:28 -0500 | [diff] [blame] | 295 | key_i = TrivialArgument(value=interface, type='string') |
| 296 | value_p = [] |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 297 | if properties: |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 298 | for prop, value in properties.items(): |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 299 | key_p = TrivialArgument(value=prop, type='string') |
| 300 | value_v = TrivialArgument( |
| 301 | decorators=[Literal(value.get('type', None))], |
| 302 | **value) |
| 303 | value_p.append(InitializerList(values=[key_p, value_v])) |
Brad Bishop | db92c28 | 2017-01-21 23:44:28 -0500 | [diff] [blame] | 304 | |
| 305 | value_p = InitializerList(values=value_p) |
| 306 | value_i.append(InitializerList(values=[key_i, value_p])) |
| 307 | |
| 308 | value_i = InitializerList(values=value_i) |
| 309 | objs.append(InitializerList(values=[key_o, value_i])) |
| 310 | |
| 311 | kw['args'] = [InitializerList(values=objs)] |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 312 | kw['namespace'] = ['functor'] |
Brad Bishop | db92c28 | 2017-01-21 23:44:28 -0500 | [diff] [blame] | 313 | super(CreateObjects, self).__init__(**kw) |
| 314 | |
| 315 | |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 316 | class DestroyObjects(MethodCall): |
| 317 | '''Assemble a destroyObject functor.''' |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 318 | |
| 319 | def __init__(self, **kw): |
Brad Bishop | 7b7e712 | 2017-01-21 21:21:46 -0500 | [diff] [blame] | 320 | values = [{'value': x, 'type': 'string'} for x in kw.pop('paths')] |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 321 | conditions = [ |
| 322 | Event.functor_map[ |
| 323 | x['name']](**x) for x in kw.pop('conditions', [])] |
| 324 | conditions = [PathCondition(args=[x]) for x in conditions] |
Brad Bishop | 7b7e712 | 2017-01-21 21:21:46 -0500 | [diff] [blame] | 325 | args = [InitializerList( |
| 326 | values=[TrivialArgument(**x) for x in values])] |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 327 | args.append(InitializerList(values=conditions)) |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 328 | kw['args'] = args |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 329 | kw['namespace'] = ['functor'] |
Brad Bishop | 7b7e712 | 2017-01-21 21:21:46 -0500 | [diff] [blame] | 330 | super(DestroyObjects, self).__init__(**kw) |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 331 | |
| 332 | |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 333 | class SetProperty(MethodCall): |
| 334 | '''Assemble a setProperty functor.''' |
Brad Bishop | e2e402f | 2016-11-30 18:00:17 -0500 | [diff] [blame] | 335 | |
| 336 | def __init__(self, **kw): |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 337 | args = [] |
| 338 | |
| 339 | value = kw.pop('value') |
| 340 | prop = kw.pop('property') |
| 341 | iface = kw.pop('interface') |
| 342 | iface = Interface(iface) |
| 343 | namespace = iface.namespace().split('::')[:-1] |
| 344 | name = iface[-1] |
| 345 | t = Template(namespace=namespace, name=iface[-1]) |
| 346 | |
Brad Bishop | e2e402f | 2016-11-30 18:00:17 -0500 | [diff] [blame] | 347 | member = '&%s' % '::'.join( |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 348 | namespace + [name, NamedElement(name=prop).camelCase]) |
| 349 | member_type = cppTypeName(value['type']) |
| 350 | member_cast = '{0} ({1}::*)({0})'.format(member_type, t.qualified()) |
Brad Bishop | e2e402f | 2016-11-30 18:00:17 -0500 | [diff] [blame] | 351 | |
Brad Bishop | 02ca021 | 2017-01-28 23:25:58 -0500 | [diff] [blame] | 352 | paths = [{'value': x, 'type': 'string'} for x in kw.pop('paths')] |
| 353 | args.append(InitializerList( |
| 354 | values=[TrivialArgument(**x) for x in paths])) |
| 355 | |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 356 | conditions = [ |
| 357 | Event.functor_map[ |
| 358 | x['name']](**x) for x in kw.pop('conditions', [])] |
| 359 | conditions = [PathCondition(args=[x]) for x in conditions] |
| 360 | |
| 361 | args.append(InitializerList(values=conditions)) |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 362 | args.append(TrivialArgument(value=str(iface), type='string')) |
| 363 | args.append(TrivialArgument( |
| 364 | value=member, decorators=[Cast('static', member_cast)])) |
| 365 | args.append(TrivialArgument(**value)) |
Brad Bishop | e2e402f | 2016-11-30 18:00:17 -0500 | [diff] [blame] | 366 | |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 367 | kw['templates'] = [Template(name=name, namespace=namespace)] |
| 368 | kw['args'] = args |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 369 | kw['namespace'] = ['functor'] |
Brad Bishop | e2e402f | 2016-11-30 18:00:17 -0500 | [diff] [blame] | 370 | super(SetProperty, self).__init__(**kw) |
| 371 | |
| 372 | |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 373 | class PropertyChanged(MethodCall): |
| 374 | '''Assemble a propertyChanged functor.''' |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 375 | |
| 376 | def __init__(self, **kw): |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 377 | args = [] |
| 378 | args.append(TrivialArgument(value=kw.pop('interface'), type='string')) |
| 379 | args.append(TrivialArgument(value=kw.pop('property'), type='string')) |
| 380 | args.append(TrivialArgument( |
| 381 | decorators=[ |
| 382 | Literal(kw['value'].get('type', None))], **kw.pop('value'))) |
| 383 | kw['args'] = args |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 384 | kw['namespace'] = ['functor'] |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 385 | super(PropertyChanged, self).__init__(**kw) |
| 386 | |
| 387 | |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 388 | class PropertyIs(MethodCall): |
| 389 | '''Assemble a propertyIs functor.''' |
Brad Bishop | 040e18b | 2017-01-21 22:04:00 -0500 | [diff] [blame] | 390 | |
| 391 | def __init__(self, **kw): |
| 392 | args = [] |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 393 | path = kw.pop('path', None) |
| 394 | if not path: |
| 395 | path = TrivialArgument(value='nullptr') |
| 396 | else: |
| 397 | path = TrivialArgument(value=path, type='string') |
| 398 | |
| 399 | args.append(path) |
Matthew Barth | 979eb59 | 2018-10-05 15:29:26 -0500 | [diff] [blame] | 400 | iface = TrivialArgument(value=kw.pop('interface'), type='string') |
| 401 | args.append(iface) |
| 402 | prop = TrivialArgument(value=kw.pop('property'), type='string') |
| 403 | args.append(prop) |
Brad Bishop | 040e18b | 2017-01-21 22:04:00 -0500 | [diff] [blame] | 404 | args.append(TrivialArgument( |
| 405 | decorators=[ |
| 406 | Literal(kw['value'].get('type', None))], **kw.pop('value'))) |
| 407 | |
| 408 | service = kw.pop('service', None) |
| 409 | if service: |
| 410 | args.append(TrivialArgument(value=service, type='string')) |
| 411 | |
Matthew Barth | 979eb59 | 2018-10-05 15:29:26 -0500 | [diff] [blame] | 412 | dbusMember = kw.pop('dbusMember', None) |
| 413 | if dbusMember: |
| 414 | # Inventory manager's service name is required |
| 415 | if not service or service != busname: |
| 416 | args.append(TrivialArgument(value=busname, type='string')) |
| 417 | |
| 418 | gpArgs = [] |
| 419 | gpArgs.append(path) |
| 420 | gpArgs.append(iface) |
| 421 | # Prepend '&' and append 'getPropertyByName' function on dbusMember |
| 422 | gpArgs.append(TrivialArgument( |
| 423 | value='&'+dbusMember+'::getPropertyByName')) |
| 424 | gpArgs.append(prop) |
| 425 | fArg = MethodCall( |
| 426 | name='getProperty', |
| 427 | namespace=['functor'], |
| 428 | templates=[Template( |
| 429 | name=dbusMember, |
| 430 | namespace=[])], |
| 431 | args=gpArgs) |
| 432 | |
| 433 | # Append getProperty functor |
| 434 | args.append(GetProperty( |
| 435 | templates=[Template( |
| 436 | name=dbusMember+'::PropertiesVariant', |
| 437 | namespace=[])], |
| 438 | args=[fArg])) |
| 439 | |
Brad Bishop | 040e18b | 2017-01-21 22:04:00 -0500 | [diff] [blame] | 440 | kw['args'] = args |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 441 | kw['namespace'] = ['functor'] |
Brad Bishop | 040e18b | 2017-01-21 22:04:00 -0500 | [diff] [blame] | 442 | super(PropertyIs, self).__init__(**kw) |
| 443 | |
| 444 | |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 445 | class Event(MethodCall): |
| 446 | '''Assemble an inventory manager event.''' |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 447 | |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 448 | functor_map = { |
Brad Bishop | 7b7e712 | 2017-01-21 21:21:46 -0500 | [diff] [blame] | 449 | 'destroyObjects': DestroyObjects, |
Brad Bishop | db92c28 | 2017-01-21 23:44:28 -0500 | [diff] [blame] | 450 | 'createObjects': CreateObjects, |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 451 | 'propertyChangedTo': PropertyChanged, |
Brad Bishop | 040e18b | 2017-01-21 22:04:00 -0500 | [diff] [blame] | 452 | 'propertyIs': PropertyIs, |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 453 | 'setProperty': SetProperty, |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 454 | } |
| 455 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 456 | def __init__(self, **kw): |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 457 | self.summary = kw.pop('name') |
| 458 | |
| 459 | filters = [ |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 460 | self.functor_map[x['name']](**x) for x in kw.pop('filters', [])] |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 461 | filters = [Filter(args=[x]) for x in filters] |
Brad Bishop | 064c94a | 2017-01-21 21:33:30 -0500 | [diff] [blame] | 462 | filters = Vector( |
Brad Bishop | 12f8a3c | 2017-02-09 00:02:00 -0500 | [diff] [blame] | 463 | templates=[Template(name='Filter', namespace=[])], |
Brad Bishop | 064c94a | 2017-01-21 21:33:30 -0500 | [diff] [blame] | 464 | args=filters) |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 465 | |
| 466 | event = MethodCall( |
| 467 | name='make_shared', |
| 468 | namespace=['std'], |
| 469 | templates=[Template( |
| 470 | name=kw.pop('event'), |
| 471 | namespace=kw.pop('event_namespace', []))], |
Brad Bishop | 064c94a | 2017-01-21 21:33:30 -0500 | [diff] [blame] | 472 | args=kw.pop('event_args', []) + [filters]) |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 473 | |
| 474 | events = Vector( |
Brad Bishop | 12f8a3c | 2017-02-09 00:02:00 -0500 | [diff] [blame] | 475 | templates=[Template(name='EventBasePtr', namespace=[])], |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 476 | args=[event]) |
| 477 | |
Brad Bishop | 12f8a3c | 2017-02-09 00:02:00 -0500 | [diff] [blame] | 478 | action_type = Template(name='Action', namespace=[]) |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 479 | action_args = [ |
Brad Bishop | d0f48ad | 2017-01-30 08:52:26 -0500 | [diff] [blame] | 480 | self.functor_map[x['name']](**x) for x in kw.pop('actions', [])] |
Brad Bishop | c1f4798 | 2017-02-09 01:27:38 -0500 | [diff] [blame] | 481 | action_args = [Action(args=[x]) for x in action_args] |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 482 | actions = Vector( |
| 483 | templates=[action_type], |
| 484 | args=action_args) |
| 485 | |
| 486 | kw['name'] = 'make_tuple' |
| 487 | kw['namespace'] = ['std'] |
| 488 | kw['args'] = [events, actions] |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 489 | super(Event, self).__init__(**kw) |
Brad Bishop | cfb3c89 | 2016-11-12 11:43:37 -0500 | [diff] [blame] | 490 | |
Brad Bishop | cfb3c89 | 2016-11-12 11:43:37 -0500 | [diff] [blame] | 491 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 492 | class MatchEvent(Event): |
| 493 | '''Associate one or more dbus signal match signatures with |
| 494 | a filter.''' |
| 495 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 496 | def __init__(self, **kw): |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 497 | kw['event'] = 'DbusSignal' |
Brad Bishop | 12f8a3c | 2017-02-09 00:02:00 -0500 | [diff] [blame] | 498 | kw['event_namespace'] = [] |
Brad Bishop | c93bcc9 | 2017-01-21 16:23:39 -0500 | [diff] [blame] | 499 | kw['event_args'] = [ |
| 500 | DbusSignature(**x) for x in kw.pop('signatures', [])] |
| 501 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 502 | super(MatchEvent, self).__init__(**kw) |
| 503 | |
| 504 | |
Brad Bishop | 828df83 | 2017-01-21 22:20:43 -0500 | [diff] [blame] | 505 | class StartupEvent(Event): |
| 506 | '''Assemble a startup event.''' |
| 507 | |
| 508 | def __init__(self, **kw): |
| 509 | kw['event'] = 'StartupEvent' |
Brad Bishop | 12f8a3c | 2017-02-09 00:02:00 -0500 | [diff] [blame] | 510 | kw['event_namespace'] = [] |
Brad Bishop | 828df83 | 2017-01-21 22:20:43 -0500 | [diff] [blame] | 511 | super(StartupEvent, self).__init__(**kw) |
| 512 | |
| 513 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 514 | class Everything(Renderer): |
| 515 | '''Parse/render entry point.''' |
| 516 | |
| 517 | class_map = { |
| 518 | 'match': MatchEvent, |
Brad Bishop | 828df83 | 2017-01-21 22:20:43 -0500 | [diff] [blame] | 519 | 'startup': StartupEvent, |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 520 | } |
| 521 | |
| 522 | @staticmethod |
| 523 | def load(args): |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 524 | # Aggregate all the event YAML in the events.d directory |
| 525 | # into a single list of events. |
| 526 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 527 | events = [] |
Brad Bishop | a6fcd56 | 2017-02-03 11:00:27 -0500 | [diff] [blame] | 528 | events_dir = os.path.join(args.inputdir, 'events.d') |
| 529 | |
| 530 | if os.path.exists(events_dir): |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 531 | yaml_files = [x for x in os.listdir(events_dir) if |
| 532 | x.endswith('.yaml')] |
Brad Bishop | a6fcd56 | 2017-02-03 11:00:27 -0500 | [diff] [blame] | 533 | |
| 534 | for x in yaml_files: |
| 535 | with open(os.path.join(events_dir, x), 'r') as fd: |
| 536 | for e in yaml.safe_load(fd.read()).get('events', {}): |
| 537 | events.append(e) |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 538 | |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 539 | interfaces, interface_composite = Everything.get_interfaces( |
| 540 | args.ifacesdir) |
| 541 | extra_interfaces, extra_interface_composite = \ |
| 542 | Everything.get_interfaces( |
| 543 | os.path.join(args.inputdir, 'extra_interfaces.d')) |
| 544 | interface_composite.update(extra_interface_composite) |
| 545 | interface_composite = InterfaceComposite(interface_composite) |
Matthew Barth | 979eb59 | 2018-10-05 15:29:26 -0500 | [diff] [blame] | 546 | # Update busname if configured differenly than the default |
| 547 | busname = args.busname |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 548 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 549 | return Everything( |
| 550 | *events, |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 551 | interfaces=interfaces + extra_interfaces, |
| 552 | interface_composite=interface_composite) |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 553 | |
| 554 | @staticmethod |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 555 | def get_interfaces(targetdir): |
| 556 | '''Scan the interfaces directory for interfaces that PIM can create.''' |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 557 | |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 558 | yaml_files = [] |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 559 | interfaces = [] |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 560 | interface_composite = {} |
Brad Bishop | a6fcd56 | 2017-02-03 11:00:27 -0500 | [diff] [blame] | 561 | |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 562 | if targetdir and os.path.exists(targetdir): |
| 563 | for directory, _, files in os.walk(targetdir): |
| 564 | if not files: |
| 565 | continue |
| 566 | |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 567 | yaml_files += [os.path.relpath( |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 568 | os.path.join(directory, f), |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 569 | targetdir) for f in [f for f in files if |
| 570 | f.endswith('.interface.yaml')]] |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 571 | |
| 572 | for y in yaml_files: |
Marri Devender Rao | 06e3d50 | 2017-06-09 11:33:38 -0500 | [diff] [blame] | 573 | # parse only phosphor dbus related interface files |
| 574 | if not y.startswith('xyz'): |
| 575 | continue |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 576 | with open(os.path.join(targetdir, y)) as fd: |
| 577 | i = y.replace('.interface.yaml', '').replace(os.sep, '.') |
| 578 | |
| 579 | # PIM can't create interfaces with methods. |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 580 | parsed = yaml.safe_load(fd.read()) |
| 581 | if parsed.get('methods', None): |
| 582 | continue |
Deepak Kodihalli | 0b6ca10 | 2017-08-09 04:39:43 -0500 | [diff] [blame] | 583 | # Cereal can't understand the type sdbusplus::object_path. This |
| 584 | # type is a wrapper around std::string. Ignore interfaces having |
| 585 | # a property of this type for now. The only interface that has a |
| 586 | # property of this type now is xyz.openbmc_project.Association, |
| 587 | # which is an unused interface. No inventory objects implement |
| 588 | # this interface. |
| 589 | # TODO via openbmc/openbmc#2123 : figure out how to make Cereal |
| 590 | # understand sdbusplus::object_path. |
Marri Devender Rao | fa23d70 | 2017-09-02 04:43:42 -0500 | [diff] [blame] | 591 | properties = parsed.get('properties', None) |
| 592 | if properties: |
| 593 | if any('path' in p['type'] for p in properties): |
| 594 | continue |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 595 | interface_composite[i] = properties |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 596 | interfaces.append(i) |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 597 | |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 598 | return interfaces, interface_composite |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 599 | |
| 600 | def __init__(self, *a, **kw): |
| 601 | self.interfaces = \ |
| 602 | [Interface(x) for x in kw.pop('interfaces', [])] |
Deepak Kodihalli | ef550b1 | 2017-08-03 14:00:17 -0500 | [diff] [blame] | 603 | self.interface_composite = \ |
| 604 | kw.pop('interface_composite', {}) |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 605 | self.events = [ |
| 606 | self.class_map[x['type']](**x) for x in a] |
| 607 | super(Everything, self).__init__(**kw) |
| 608 | |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 609 | def generate_cpp(self, loader): |
| 610 | '''Render the template with the provided events and interfaces.''' |
| 611 | with open(os.path.join( |
| 612 | args.outputdir, |
| 613 | 'generated.cpp'), 'w') as fd: |
| 614 | fd.write( |
| 615 | self.render( |
| 616 | loader, |
| 617 | 'generated.mako.cpp', |
| 618 | events=self.events, |
Brad Bishop | 9b5a12f | 2017-01-21 14:42:11 -0500 | [diff] [blame] | 619 | interfaces=self.interfaces, |
| 620 | indent=Indent())) |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 621 | |
Deepak Kodihalli | f7b0399 | 2017-08-04 11:25:41 -0500 | [diff] [blame] | 622 | def generate_serialization(self, loader): |
| 623 | with open(os.path.join( |
| 624 | args.outputdir, |
| 625 | 'gen_serialization.hpp'), 'w') as fd: |
| 626 | fd.write( |
| 627 | self.render( |
| 628 | loader, |
| 629 | 'gen_serialization.mako.hpp', |
| 630 | interfaces=self.interfaces, |
| 631 | interface_composite=self.interface_composite)) |
| 632 | |
Brad Bishop | 95dd98f | 2016-11-12 12:39:15 -0500 | [diff] [blame] | 633 | |
| 634 | if __name__ == '__main__': |
| 635 | script_dir = os.path.dirname(os.path.realpath(__file__)) |
Brad Bishop | 14a9fe5 | 2016-11-12 12:51:26 -0500 | [diff] [blame] | 636 | valid_commands = { |
| 637 | 'generate-cpp': 'generate_cpp', |
Deepak Kodihalli | f7b0399 | 2017-08-04 11:25:41 -0500 | [diff] [blame] | 638 | 'generate-serialization': 'generate_serialization', |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 639 | } |
Brad Bishop | 95dd98f | 2016-11-12 12:39:15 -0500 | [diff] [blame] | 640 | |
| 641 | parser = argparse.ArgumentParser( |
| 642 | description='Phosphor Inventory Manager (PIM) YAML ' |
| 643 | 'scanner and code generator.') |
| 644 | parser.add_argument( |
| 645 | '-o', '--output-dir', dest='outputdir', |
| 646 | default='.', help='Output directory.') |
| 647 | parser.add_argument( |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 648 | '-i', '--interfaces-dir', dest='ifacesdir', |
| 649 | help='Location of interfaces to be supported.') |
| 650 | parser.add_argument( |
Brad Bishop | 95dd98f | 2016-11-12 12:39:15 -0500 | [diff] [blame] | 651 | '-d', '--dir', dest='inputdir', |
| 652 | default=os.path.join(script_dir, 'example'), |
| 653 | help='Location of files to process.') |
Brad Bishop | f4666f5 | 2016-11-12 12:44:42 -0500 | [diff] [blame] | 654 | parser.add_argument( |
Matthew Barth | 979eb59 | 2018-10-05 15:29:26 -0500 | [diff] [blame] | 655 | '-b', '--bus-name', dest='busname', |
| 656 | default='xyz.openbmc_project.Inventory.Manager', |
| 657 | help='Inventory manager busname.') |
| 658 | parser.add_argument( |
Brad Bishop | f4666f5 | 2016-11-12 12:44:42 -0500 | [diff] [blame] | 659 | 'command', metavar='COMMAND', type=str, |
Patrick Williams | 5587898 | 2020-04-03 15:24:57 -0500 | [diff] [blame] | 660 | choices=list(valid_commands.keys()), |
| 661 | help='%s.' % " | ".join(list(valid_commands.keys()))) |
Brad Bishop | 95dd98f | 2016-11-12 12:39:15 -0500 | [diff] [blame] | 662 | |
| 663 | args = parser.parse_args() |
Brad Bishop | 22cfbe6 | 2016-11-30 13:25:10 -0500 | [diff] [blame] | 664 | |
| 665 | if sys.version_info < (3, 0): |
| 666 | lookup = mako.lookup.TemplateLookup( |
| 667 | directories=[script_dir], |
| 668 | disable_unicode=True) |
| 669 | else: |
| 670 | lookup = mako.lookup.TemplateLookup( |
| 671 | directories=[script_dir]) |
| 672 | |
| 673 | function = getattr( |
| 674 | Everything.load(args), |
| 675 | valid_commands[args.command]) |
| 676 | function(lookup) |
Brad Bishop | 95dd98f | 2016-11-12 12:39:15 -0500 | [diff] [blame] | 677 | |
| 678 | |
Brad Bishop | bf066a6 | 2016-10-19 08:09:44 -0400 | [diff] [blame] | 679 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |