diff options
| -rwxr-xr-x | contrib/oe-stylize.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/contrib/oe-stylize.py b/contrib/oe-stylize.py index ba4b87a74c..6f2b96c381 100755 --- a/contrib/oe-stylize.py +++ b/contrib/oe-stylize.py | |||
| @@ -353,7 +353,8 @@ if __name__ == "__main__": | |||
| 353 | # ignore empty lines | 353 | # ignore empty lines |
| 354 | if line.isspace() or line is '': | 354 | if line.isspace() or line is '': |
| 355 | # flush comments into the olines | 355 | # flush comments into the olines |
| 356 | for c in commentBloc: olines.append(c) | 356 | for c in commentBloc: |
| 357 | olines.append(c) | ||
| 357 | commentBloc = [] | 358 | commentBloc = [] |
| 358 | continue | 359 | continue |
| 359 | 360 | ||
| @@ -370,7 +371,8 @@ if __name__ == "__main__": | |||
| 370 | continue | 371 | continue |
| 371 | 372 | ||
| 372 | if var in seen_vars: | 373 | if var in seen_vars: |
| 373 | for c in commentBloc: seen_vars[var].append(c) | 374 | for c in commentBloc: |
| 375 | seen_vars[var].append(c) | ||
| 374 | commentBloc = [] | 376 | commentBloc = [] |
| 375 | seen_vars[var].append(line) | 377 | seen_vars[var].append(line) |
| 376 | else: | 378 | else: |
| @@ -389,24 +391,29 @@ if __name__ == "__main__": | |||
| 389 | if not in_routine: | 391 | if not in_routine: |
| 390 | print ("## Warning: unknown variable/routine \"%s\"" % originalLine.rstrip('\n')) | 392 | print ("## Warning: unknown variable/routine \"%s\"" % originalLine.rstrip('\n')) |
| 391 | var = 'others' | 393 | var = 'others' |
| 392 | for c in commentBloc: seen_vars[var].append(c) | 394 | for c in commentBloc: |
| 395 | seen_vars[var].append(c) | ||
| 393 | commentBloc = [] | 396 | commentBloc = [] |
| 394 | seen_vars[var].append(line) | 397 | seen_vars[var].append(line) |
| 395 | if not keep and not in_routine: var = "" | 398 | if not keep and not in_routine: |
| 399 | var = "" | ||
| 396 | 400 | ||
| 397 | # -- dump the sanitized .bb file -- | 401 | # -- dump the sanitized .bb file -- |
| 398 | addEmptyLine = False | 402 | addEmptyLine = False |
| 399 | # write comments that are not related to variables nor routines | 403 | # write comments that are not related to variables nor routines |
| 400 | for l in commentBloc: olines.append(l) | 404 | for l in commentBloc: |
| 405 | olines.append(l) | ||
| 401 | # write variables and routines | 406 | # write variables and routines |
| 402 | previourVarPrefix = "unknown" | 407 | previourVarPrefix = "unknown" |
| 403 | for k in OE_vars: | 408 | for k in OE_vars: |
| 404 | if k=='SRC_URI': addEmptyLine = True | 409 | if k=='SRC_URI': |
| 410 | addEmptyLine = True | ||
| 405 | if seen_vars[k] != []: | 411 | if seen_vars[k] != []: |
| 406 | if addEmptyLine and not k.startswith(previourVarPrefix): | 412 | if addEmptyLine and not k.startswith(previourVarPrefix): |
| 407 | olines.append("") | 413 | olines.append("") |
| 408 | for l in seen_vars[k]: | 414 | for l in seen_vars[k]: |
| 409 | olines.append(l) | 415 | olines.append(l) |
| 410 | previourVarPrefix = k.split('_')[0]=='' and "unknown" or k.split('_')[0] | 416 | previourVarPrefix = k.split('_')[0]=='' and "unknown" or k.split('_')[0] |
| 411 | for line in olines: print(line) | 417 | for line in olines: |
| 418 | print(line) | ||
| 412 | 419 | ||
