aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorpersianpros <persianpros@yahoo.com>2021-04-13 23:18:06 +0430
committerKhem Raj <raj.khem@gmail.com>2021-04-15 09:28:44 -0700
commite0b9cd57fab747a84b5dddc52b7efd64afeff6f2 (patch)
tree8eef050bd5dfac13eb5a9cd1e919f6f1cc71ef20 /contrib
parentaf6838a62c53dab71941b2cc31f0e32387cd30e0 (diff)
downloadmeta-openembedded-e0b9cd57fab747a84b5dddc52b7efd64afeff6f2.tar.gz
PEP8 double aggressive W291 ~ W293 and W391
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/oe-stylize.py43
1 files changed, 21 insertions, 22 deletions
diff --git a/contrib/oe-stylize.py b/contrib/oe-stylize.py
index cfabb90b1..e1ba1b321 100755
--- a/contrib/oe-stylize.py
+++ b/contrib/oe-stylize.py
@@ -2,12 +2,12 @@
"""\
Sanitize a bitbake file following the OpenEmbedded style guidelines,
-see http://openembedded.org/wiki/StyleGuide
+see http://openembedded.org/wiki/StyleGuide
(C) 2006 Cyril Romain <cyril.romain@gmail.com>
MIT license
-TODO:
+TODO:
- add the others OpenEmbedded variables commonly used:
- parse command arguments and print usage on misuse
. prevent giving more than one .bb file in arguments
@@ -19,7 +19,7 @@ TODO:
- count rule breaks and displays them in the order frequence
"""
-from __future__ import print_function
+from __future__ import print_function
import fileinput
import string
import re
@@ -65,7 +65,7 @@ OE_vars = [
'RSUGGESTS',
'RPROVIDES',
'RCONFLICTS',
- 'FILES',
+ 'FILES',
'do_package',
'do_stage',
'addhandler',
@@ -215,36 +215,36 @@ routineRegexp = r'^([a-zA-Z0-9_ ${}-]+?)\('
# Variables seen in the processed .bb
seen_vars = {}
-for v in OE_vars:
+for v in OE_vars:
seen_vars[v] = []
-# _Format guideline #0_:
-# No spaces are allowed at the beginning of lines that define a variable or
+# _Format guideline #0_:
+# No spaces are allowed at the beginning of lines that define a variable or
# a do_ routine
-def respect_rule0(line):
+def respect_rule0(line):
return line.lstrip() == line
-def conformTo_rule0(line):
+def conformTo_rule0(line):
return line.lstrip()
-# _Format guideline #1_:
+# _Format guideline #1_:
# No spaces are allowed behind the line continuation symbol '\'
def respect_rule1(line):
if line.rstrip().endswith('\\'):
return line.endswith('\\')
- else:
+ else:
return True
def conformTo_rule1(line):
return line.rstrip()
-# _Format guideline #2_:
+# _Format guideline #2_:
# Tabs should not be used (use spaces instead).
@@ -256,14 +256,14 @@ def conformTo_rule2(line):
return line.expandtabs()
# _Format guideline #3_:
-# Comments inside bb files are allowed using the '#' character at the
+# Comments inside bb files are allowed using the '#' character at the
# beginning of a line.
def respect_rule3(line):
if line.lstrip().startswith('#'):
return line.startswith('#')
- else:
+ else:
return True
@@ -364,8 +364,8 @@ if __name__ == "__main__":
if True:
lines.append(line)
else:
- # expandtabs on each line so that rule2 is always respected
- # rstrip each line so that rule1 is always respected
+ # expandtabs on each line so that rule2 is always respected
+ # rstrip each line so that rule1 is always respected
line = line.expandtabs().rstrip()
# ignore empty lines (or line filled with spaces or tabs only)
# so that rule6 is always respected
@@ -377,7 +377,7 @@ if __name__ == "__main__":
in_routine = False
commentBloc = []
olines = []
- for line in lines:
+ for line in lines:
originalLine = line
# rstrip line to remove line breaks characters
line = line.rstrip()
@@ -393,7 +393,7 @@ if __name__ == "__main__":
commentBloc = []
continue
- if line.startswith('}'):
+ if line.startswith('}'):
in_routine = False
keep = line.endswith('\\') or in_routine
@@ -415,7 +415,7 @@ if __name__ == "__main__":
if line.startswith(k):
var = k
break
- if re.match(routineRegexp, line) is not None:
+ if re.match(routineRegexp, line) is not None:
in_routine = True
line = follow_rule(0, line)
elif re.match(varRegexp, line) is not None:
@@ -443,12 +443,11 @@ if __name__ == "__main__":
for k in OE_vars:
if k == 'SRC_URI':
addEmptyLine = True
- if seen_vars[k] != []:
+ if seen_vars[k] != []:
if addEmptyLine and not k.startswith(previourVarPrefix):
olines.append("")
- for l in seen_vars[k]:
+ for l in seen_vars[k]:
olines.append(l)
previourVarPrefix = k.split('_')[0] == '' and "unknown" or k.split('_')[0]
for line in olines:
print(line)
-