Matt Spinler | d9c2fea | 2020-03-05 16:53:41 -0600 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 2 | |
| 3 | r""" |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 4 | This script will parse error log yaml file(s) and generate |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 5 | a header file which will then be used by the error logging client and |
| 6 | server to collect and validate the error information generated by the |
| 7 | openbmc software components. |
| 8 | |
| 9 | This code uses a mako template to provide the basic template of the header |
| 10 | file we're going to generate. We then call it with information from the |
| 11 | yaml to generate the header file. |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 12 | """ |
| 13 | |
| 14 | from mako.template import Template |
| 15 | from optparse import OptionParser |
| 16 | import yaml |
| 17 | import sys |
| 18 | import os |
| 19 | |
Andrew Geissler | 184690d | 2016-11-03 08:06:31 -0500 | [diff] [blame] | 20 | |
Deepak Kodihalli | 5d1aace | 2017-01-18 00:17:39 -0600 | [diff] [blame] | 21 | def order_inherited_errors(i_errors, i_parents): |
| 22 | # the ordered list of errors |
| 23 | errors = list() |
| 24 | has_inheritance = False |
| 25 | for error in i_errors: |
| 26 | if(i_parents[error] is not None): |
| 27 | has_inheritance = True |
| 28 | break |
| 29 | |
| 30 | if(has_inheritance): |
| 31 | # Order the error codes list such that an error is never placed |
| 32 | # before it's parent. This way generated code can ensure parent |
Gunnar Mills | deae3ca | 2017-10-25 17:22:22 -0500 | [diff] [blame] | 33 | # definitions precede child error definitions. |
Deepak Kodihalli | 5d1aace | 2017-01-18 00:17:39 -0600 | [diff] [blame] | 34 | while(len(errors) < len(i_errors)): |
| 35 | for error in i_errors: |
| 36 | if(error in errors): |
| 37 | # already ordererd |
| 38 | continue |
| 39 | if((not i_parents[error]) or (i_parents[error] in errors)): |
| 40 | # parent present, or has no parent, either way this error |
| 41 | # can be added |
| 42 | errors.append(error) |
| 43 | else: |
| 44 | # no inherited errors |
| 45 | errors = i_errors |
| 46 | |
| 47 | return errors |
| 48 | |
| 49 | |
Deepak Kodihalli | cbd12c8 | 2017-01-17 08:50:55 -0600 | [diff] [blame] | 50 | def check_error_inheritance(i_errors, i_parents): |
Deepak Kodihalli | 5d1aace | 2017-01-18 00:17:39 -0600 | [diff] [blame] | 51 | for error in i_errors: |
| 52 | if(i_parents[error] and (i_parents[error] not in i_errors)): |
Patrick Williams | 6f29913 | 2017-02-16 13:27:39 -0600 | [diff] [blame] | 53 | print(error + " inherits " + i_parents[error] + |
| 54 | " but the latter is not defined") |
Deepak Kodihalli | cbd12c8 | 2017-01-17 08:50:55 -0600 | [diff] [blame] | 55 | return False |
| 56 | return True |
| 57 | |
| 58 | |
Adriana Kobylak | 465aaec | 2017-02-20 11:58:03 -0600 | [diff] [blame] | 59 | # Return the yaml files with their directory structure plus the file name |
| 60 | # without the yaml extension, which will be used to set the namespaces. |
| 61 | # Ex: file xyz/openbmc_project/Error/Callout/Device.errors.yaml |
| 62 | # will have namespce xyz/openbmc_project/Error/Callout/Device |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 63 | def get_error_yaml_files(i_yaml_dir, i_test_dir): |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 64 | yaml_files = dict() |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 65 | if i_yaml_dir != "None": |
| 66 | for root, dirs, files in os.walk(i_yaml_dir): |
Matt Spinler | d9c2fea | 2020-03-05 16:53:41 -0600 | [diff] [blame] | 67 | for files in \ |
| 68 | [file for file in files if file.endswith('.errors.yaml')]: |
Adriana Kobylak | 465aaec | 2017-02-20 11:58:03 -0600 | [diff] [blame] | 69 | splitdir = root.split(i_yaml_dir)[1] + "/" + files[:-12] |
| 70 | if splitdir.startswith("/"): |
| 71 | splitdir = splitdir[1:] |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 72 | yaml_files[(os.path.join(root, files))] = splitdir |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 73 | for root, dirs, files in os.walk(i_test_dir): |
Matt Spinler | d9c2fea | 2020-03-05 16:53:41 -0600 | [diff] [blame] | 74 | for files in [file for file in files if file.endswith('.errors.yaml')]: |
Adriana Kobylak | 465aaec | 2017-02-20 11:58:03 -0600 | [diff] [blame] | 75 | splitdir = root.split(i_test_dir)[1] + "/" + files[:-12] |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 76 | yaml_files[(os.path.join(root, files))] = splitdir |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 77 | return yaml_files |
| 78 | |
| 79 | |
| 80 | def get_meta_yaml_file(i_error_yaml_file): |
| 81 | # the meta data will be defined in file name where we replace |
| 82 | # <Interface>.errors.yaml with <Interface>.metadata.yaml |
| 83 | meta_yaml = i_error_yaml_file.replace("errors", "metadata") |
| 84 | return meta_yaml |
| 85 | |
| 86 | |
Deepak Kodihalli | 9916119 | 2017-01-16 04:00:07 -0600 | [diff] [blame] | 87 | def get_cpp_type(i_type): |
| 88 | typeMap = { |
Lei YU | cea3f89 | 2020-12-03 14:27:10 +0800 | [diff] [blame] | 89 | 'boolean': 'bool', |
| 90 | 'int8': 'int8_t', |
Deepak Kodihalli | 9916119 | 2017-01-16 04:00:07 -0600 | [diff] [blame] | 91 | 'int16': 'int16_t', |
| 92 | 'int32': 'int32_t', |
| 93 | 'int64': 'int64_t', |
Lei YU | cea3f89 | 2020-12-03 14:27:10 +0800 | [diff] [blame] | 94 | 'uint8': 'uint8_t', |
Deepak Kodihalli | 9916119 | 2017-01-16 04:00:07 -0600 | [diff] [blame] | 95 | 'uint16': 'uint16_t', |
| 96 | 'uint32': 'uint32_t', |
| 97 | 'uint64': 'uint64_t', |
| 98 | 'double': 'double', |
| 99 | # const char* aids usage of constexpr |
| 100 | 'string': 'const char*'} |
| 101 | |
| 102 | return typeMap[i_type] |
| 103 | |
| 104 | |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 105 | def gen_elog_hpp(i_yaml_dir, i_test_dir, i_output_hpp, |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 106 | i_template_dir, i_elog_mako): |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 107 | r""" |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 108 | Read yaml file(s) under input yaml dir, grab the relevant data and call |
| 109 | the mako template to generate the output header file. |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 110 | |
| 111 | Description of arguments: |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 112 | i_yaml_dir directory containing base error yaml files |
| 113 | i_test_dir directory containing test error yaml files |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 114 | i_output_hpp name of the to be generated output hpp |
| 115 | i_template_dir directory containing error mako templates |
| 116 | i_elog_mako error mako template to render |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 117 | """ |
| 118 | |
| 119 | # Input parameters to mako template |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 120 | errors = list() # Main error codes |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 121 | error_msg = dict() # Error msg that corresponds to error code |
| 122 | error_lvl = dict() # Error code log level (debug, info, error, ...) |
Deepak Kodihalli | 5d1aace | 2017-01-18 00:17:39 -0600 | [diff] [blame] | 123 | meta = dict() # The meta data names associated (ERRNO, FILE_NAME, ...) |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 124 | meta_data = dict() # The meta data info (type, format) |
Deepak Kodihalli | 5d1aace | 2017-01-18 00:17:39 -0600 | [diff] [blame] | 125 | parents = dict() |
Deepak Kodihalli | 38f6974 | 2017-02-28 02:18:09 -0600 | [diff] [blame] | 126 | metadata_process = dict() # metadata that have the 'process' keyword set |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 127 | |
Patrick Williams | 7dc8c3b | 2021-04-17 07:22:48 -0500 | [diff] [blame] | 128 | # Verify the input mako file |
| 129 | template_path = os.path.join(i_template_dir, i_elog_mako) |
| 130 | if (not (os.path.isfile(template_path))): |
| 131 | print("Cannot find input template file " + template_path) |
| 132 | exit(1) |
| 133 | template_path = os.path.abspath(template_path) |
| 134 | |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 135 | error_yamls = get_error_yaml_files(i_yaml_dir, i_test_dir) |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 136 | |
| 137 | for error_yaml in error_yamls: |
| 138 | # Verify the error yaml file |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 139 | if (not (os.path.isfile(error_yaml))): |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 140 | print("Cannot find input yaml file " + error_yaml) |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 141 | exit(1) |
| 142 | |
| 143 | # Verify the metadata yaml file |
| 144 | meta_yaml = get_meta_yaml_file(error_yaml) |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 145 | |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 146 | get_elog_data(error_yaml, |
| 147 | meta_yaml, |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 148 | error_yamls[error_yaml], |
| 149 | # Last arg is a tuple |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 150 | (errors, |
| 151 | error_msg, |
| 152 | error_lvl, |
| 153 | meta, |
Deepak Kodihalli | 82b7de7 | 2017-01-17 07:59:29 -0600 | [diff] [blame] | 154 | meta_data, |
Deepak Kodihalli | 38f6974 | 2017-02-28 02:18:09 -0600 | [diff] [blame] | 155 | parents, |
| 156 | metadata_process)) |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 157 | |
Deepak Kodihalli | cbd12c8 | 2017-01-17 08:50:55 -0600 | [diff] [blame] | 158 | if(not check_error_inheritance(errors, parents)): |
Patrick Williams | 6f29913 | 2017-02-16 13:27:39 -0600 | [diff] [blame] | 159 | print("Error - failed to validate error inheritance") |
Deepak Kodihalli | cbd12c8 | 2017-01-17 08:50:55 -0600 | [diff] [blame] | 160 | exit(1) |
| 161 | |
Deepak Kodihalli | 5d1aace | 2017-01-18 00:17:39 -0600 | [diff] [blame] | 162 | errors = order_inherited_errors(errors, parents) |
| 163 | |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 164 | # Load the mako template and call it with the required data |
| 165 | yaml_dir = i_yaml_dir.strip("./") |
| 166 | yaml_dir = yaml_dir.strip("../") |
| 167 | template = Template(filename=template_path) |
| 168 | f = open(i_output_hpp, 'w') |
| 169 | f.write(template.render( |
Deepak Kodihalli | 38f6974 | 2017-02-28 02:18:09 -0600 | [diff] [blame] | 170 | errors=errors, |
| 171 | error_msg=error_msg, |
| 172 | error_lvl=error_lvl, |
| 173 | meta=meta, |
Adriana Kobylak | 465aaec | 2017-02-20 11:58:03 -0600 | [diff] [blame] | 174 | meta_data=meta_data, |
Deepak Kodihalli | 38f6974 | 2017-02-28 02:18:09 -0600 | [diff] [blame] | 175 | parents=parents, |
| 176 | metadata_process=metadata_process)) |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 177 | f.close() |
| 178 | |
Patrick Williams | bb6af86 | 2021-04-16 13:58:01 -0500 | [diff] [blame] | 179 | |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 180 | def get_elog_data(i_elog_yaml, |
| 181 | i_elog_meta_yaml, |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 182 | i_namespace, |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 183 | o_elog_data): |
| 184 | r""" |
| 185 | Parse the error and metadata yaml files in order to pull out |
| 186 | error metadata. |
| 187 | |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 188 | Use default values if metadata yaml file is not found. |
| 189 | |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 190 | Description of arguments: |
| 191 | i_elog_yaml error yaml file |
| 192 | i_elog_meta_yaml metadata yaml file |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 193 | i_namespace namespace data |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 194 | o_elog_data error metadata |
| 195 | """ |
Deepak Kodihalli | 38f6974 | 2017-02-28 02:18:09 -0600 | [diff] [blame] | 196 | (errors, error_msg, error_lvl, meta, |
| 197 | meta_data, parents, metadata_process) = o_elog_data |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 198 | ifile = yaml.safe_load(open(i_elog_yaml)) |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 199 | |
Patrick Williams | bb6af86 | 2021-04-16 13:58:01 -0500 | [diff] [blame] | 200 | # for all the errors in error yaml file |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 201 | for error in ifile: |
| 202 | if 'name' not in error: |
Patrick Williams | 4952aa6 | 2017-06-03 15:47:55 -0500 | [diff] [blame] | 203 | print("Error - Did not find name in entry %s in file %s " % ( |
| 204 | str(error), i_elog_yaml)) |
Andrew Geissler | e859630 | 2016-11-21 16:06:53 -0600 | [diff] [blame] | 205 | exit(1) |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 206 | fullname = i_namespace.replace('/', '.') + ('.') + error['name'] |
Adriana Kobylak | 465aaec | 2017-02-20 11:58:03 -0600 | [diff] [blame] | 207 | errors.append(fullname) |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 208 | |
| 209 | if 'description' in error: |
| 210 | error_msg[fullname] = error['description'].strip() |
| 211 | |
Patrick Williams | bb6af86 | 2021-04-16 13:58:01 -0500 | [diff] [blame] | 212 | # set default values |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 213 | error_lvl[fullname] = "ERR" |
| 214 | parents[fullname] = None |
| 215 | |
Patrick Williams | bb6af86 | 2021-04-16 13:58:01 -0500 | [diff] [blame] | 216 | # check if meta data yaml file is found |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 217 | if not os.path.isfile(i_elog_meta_yaml): |
| 218 | continue |
| 219 | mfile = yaml.safe_load(open(i_elog_meta_yaml)) |
| 220 | |
| 221 | # Find the meta data entry |
| 222 | match = None |
| 223 | for meta_entry in mfile: |
| 224 | if meta_entry['name'] == error['name']: |
| 225 | match = meta_entry |
| 226 | break |
| 227 | |
| 228 | if match is None: |
William A. Kennington III | b17e876 | 2018-10-04 18:58:14 -0700 | [diff] [blame] | 229 | print("Error - Did not find error named %s in %s" % ( |
| 230 | error['name'], i_elog_meta_yaml)) |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 231 | continue |
| 232 | |
| 233 | error_lvl[fullname] = match.get('level', 'ERR') |
| 234 | |
| 235 | # Get 0th inherited error (current support - single inheritance) |
| 236 | if 'inherits' in match: |
Patrick Williams | bb6af86 | 2021-04-16 13:58:01 -0500 | [diff] [blame] | 237 | parents[fullname] = match['inherits'][0] |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 238 | |
Lei YU | 80aa476 | 2018-07-19 10:29:56 +0800 | [diff] [blame] | 239 | # Put all errors in meta[] even the meta is empty |
| 240 | # so that child errors could inherits such error without meta |
| 241 | tmp_meta = [] |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 242 | if 'meta' in match: |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 243 | # grab all the meta data fields and info |
| 244 | for i in match['meta']: |
| 245 | str_short = i['str'].split('=')[0] |
Deepak Kodihalli | 7924b17 | 2017-03-08 00:04:33 -0600 | [diff] [blame] | 246 | tmp_meta.append(str_short) |
| 247 | meta_data[str_short] = {} |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 248 | meta_data[str_short]['str'] = i['str'] |
Deepak Kodihalli | 7924b17 | 2017-03-08 00:04:33 -0600 | [diff] [blame] | 249 | meta_data[str_short]['str_short'] = str_short |
Marri Devender Rao | df7cb5c | 2017-05-14 08:30:40 -0500 | [diff] [blame] | 250 | meta_data[str_short]['type'] = get_cpp_type(i['type']) |
Patrick Williams | bb6af86 | 2021-04-16 13:58:01 -0500 | [diff] [blame] | 251 | if ('process' in i) and (i['process'] is True): |
Deepak Kodihalli | 38f6974 | 2017-02-28 02:18:09 -0600 | [diff] [blame] | 252 | metadata_process[str_short] = fullname + "." + str_short |
Lei YU | 80aa476 | 2018-07-19 10:29:56 +0800 | [diff] [blame] | 253 | meta[fullname] = tmp_meta |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 254 | |
| 255 | # Debug |
Andrew Geissler | 184690d | 2016-11-03 08:06:31 -0500 | [diff] [blame] | 256 | # for i in errors: |
Andrew Geissler | df048c1 | 2016-11-10 16:50:35 -0600 | [diff] [blame] | 257 | # print "ERROR: " + errors[i] |
| 258 | # print " MSG: " + error_msg[errors[i]] |
| 259 | # print " LVL: " + error_lvl[errors[i]] |
| 260 | # print " META: " |
| 261 | # print meta[i] |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 262 | |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 263 | |
| 264 | def main(i_args): |
| 265 | parser = OptionParser() |
| 266 | |
Andrew Geissler | 184690d | 2016-11-03 08:06:31 -0500 | [diff] [blame] | 267 | parser.add_option("-m", "--mako", dest="elog_mako", |
| 268 | default="elog-gen-template.mako.hpp", |
Andrew Geissler | df048c1 | 2016-11-10 16:50:35 -0600 | [diff] [blame] | 269 | help="input mako template file to use") |
Andrew Geissler | 184690d | 2016-11-03 08:06:31 -0500 | [diff] [blame] | 270 | |
| 271 | parser.add_option("-o", "--output", dest="output_hpp", |
Adriana Kobylak | ebd59fa | 2017-02-06 20:55:39 -0600 | [diff] [blame] | 272 | default="elog-errors.hpp", |
| 273 | help="output hpp to generate, elog-errors.hpp default") |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 274 | |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 275 | parser.add_option("-y", "--yamldir", dest="yamldir", |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 276 | default="None", |
Andrew Geissler | f1f2cfa | 2016-11-21 15:16:45 -0600 | [diff] [blame] | 277 | help="Base directory of yaml files to process") |
| 278 | |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 279 | parser.add_option("-u", "--testdir", dest="testdir", |
| 280 | default="./tools/example/", |
| 281 | help="Unit test directory of yaml files to process") |
| 282 | |
Andrew Geissler | f1f2cfa | 2016-11-21 15:16:45 -0600 | [diff] [blame] | 283 | parser.add_option("-t", "--templatedir", dest="templatedir", |
| 284 | default="phosphor-logging/templates/", |
| 285 | help="Base directory of files to process") |
| 286 | |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 287 | (options, args) = parser.parse_args(i_args) |
| 288 | |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 289 | gen_elog_hpp(options.yamldir, |
Adriana Kobylak | 6a9db6e | 2017-02-21 12:58:05 -0600 | [diff] [blame] | 290 | options.testdir, |
Deepak Kodihalli | 160d3e0 | 2017-01-17 04:25:22 -0600 | [diff] [blame] | 291 | options.output_hpp, |
| 292 | options.templatedir, |
Adriana Kobylak | 371a38b | 2017-02-19 13:45:42 -0600 | [diff] [blame] | 293 | options.elog_mako) |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 294 | |
Patrick Williams | bb6af86 | 2021-04-16 13:58:01 -0500 | [diff] [blame] | 295 | |
Andrew Geissler | c830e0f | 2016-10-18 12:51:29 -0500 | [diff] [blame] | 296 | # Only run if it's a script |
| 297 | if __name__ == '__main__': |
Andrew Geissler | 184690d | 2016-11-03 08:06:31 -0500 | [diff] [blame] | 298 | main(sys.argv[1:]) |