summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpersianpros <persianpros@yahoo.com>2021-04-13 23:18:05 +0430
committerKhem Raj <raj.khem@gmail.com>2021-04-15 09:28:44 -0700
commitaf6838a62c53dab71941b2cc31f0e32387cd30e0 (patch)
treedcc38ac0eaa19ad4672b87be02002a3e7cebf8b4
parent144c107c42be19cedd58e5971b827c7ca91b7b53 (diff)
downloadmeta-openembedded-af6838a62c53dab71941b2cc31f0e32387cd30e0.tar.gz
PEP8 double aggressive E301 ~ E306
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rwxr-xr-xcontrib/oe-stylize.py35
-rw-r--r--meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py1
2 files changed, 36 insertions, 0 deletions
diff --git a/contrib/oe-stylize.py b/contrib/oe-stylize.py
index 9d95911ae..cfabb90b1 100755
--- a/contrib/oe-stylize.py
+++ b/contrib/oe-stylize.py
@@ -221,41 +221,59 @@ for v in OE_vars:
221# _Format guideline #0_: 221# _Format guideline #0_:
222# No spaces are allowed at the beginning of lines that define a variable or 222# No spaces are allowed at the beginning of lines that define a variable or
223# a do_ routine 223# a do_ routine
224
225
224def respect_rule0(line): 226def respect_rule0(line):
225 return line.lstrip() == line 227 return line.lstrip() == line
228
229
226def conformTo_rule0(line): 230def conformTo_rule0(line):
227 return line.lstrip() 231 return line.lstrip()
228 232
229# _Format guideline #1_: 233# _Format guideline #1_:
230# No spaces are allowed behind the line continuation symbol '\' 234# No spaces are allowed behind the line continuation symbol '\'
235
236
231def respect_rule1(line): 237def respect_rule1(line):
232 if line.rstrip().endswith('\\'): 238 if line.rstrip().endswith('\\'):
233 return line.endswith('\\') 239 return line.endswith('\\')
234 else: 240 else:
235 return True 241 return True
242
243
236def conformTo_rule1(line): 244def conformTo_rule1(line):
237 return line.rstrip() 245 return line.rstrip()
238 246
239# _Format guideline #2_: 247# _Format guideline #2_:
240# Tabs should not be used (use spaces instead). 248# Tabs should not be used (use spaces instead).
249
250
241def respect_rule2(line): 251def respect_rule2(line):
242 return line.count('\t') == 0 252 return line.count('\t') == 0
253
254
243def conformTo_rule2(line): 255def conformTo_rule2(line):
244 return line.expandtabs() 256 return line.expandtabs()
245 257
246# _Format guideline #3_: 258# _Format guideline #3_:
247# Comments inside bb files are allowed using the '#' character at the 259# Comments inside bb files are allowed using the '#' character at the
248# beginning of a line. 260# beginning of a line.
261
262
249def respect_rule3(line): 263def respect_rule3(line):
250 if line.lstrip().startswith('#'): 264 if line.lstrip().startswith('#'):
251 return line.startswith('#') 265 return line.startswith('#')
252 else: 266 else:
253 return True 267 return True
268
269
254def conformTo_rule3(line): 270def conformTo_rule3(line):
255 return line.lstrip() 271 return line.lstrip()
256 272
257# _Format guideline #4_: 273# _Format guideline #4_:
258# Use quotes on the right hand side of assignments FOO = "BAR" 274# Use quotes on the right hand side of assignments FOO = "BAR"
275
276
259def respect_rule4(line): 277def respect_rule4(line):
260 r = re.search(varRegexp, line) 278 r = re.search(varRegexp, line)
261 if r is not None: 279 if r is not None:
@@ -263,33 +281,48 @@ def respect_rule4(line):
263 # do not test for None it because always match 281 # do not test for None it because always match
264 return r2.group(1) == '"' and r2.group(3) != '' 282 return r2.group(1) == '"' and r2.group(3) != ''
265 return False 283 return False
284
285
266def conformTo_rule4(line): 286def conformTo_rule4(line):
267 r = re.search(varRegexp, line) 287 r = re.search(varRegexp, line)
268 return ''.join([r.group(1), ' ', r.group(3), ' "', r.group(5), r.group(5).endswith('"') and '' or '"']) 288 return ''.join([r.group(1), ' ', r.group(3), ' "', r.group(5), r.group(5).endswith('"') and '' or '"'])
269 289
270# _Format guideline #5_: 290# _Format guideline #5_:
271# The correct spacing for a variable is FOO = "BAR". 291# The correct spacing for a variable is FOO = "BAR".
292
293
272def respect_rule5(line): 294def respect_rule5(line):
273 r = re.search(varRegexp, line) 295 r = re.search(varRegexp, line)
274 return r is not None and r.group(2) == " " and r.group(4) == " " 296 return r is not None and r.group(2) == " " and r.group(4) == " "
297
298
275def conformTo_rule5(line): 299def conformTo_rule5(line):
276 r = re.search(varRegexp, line) 300 r = re.search(varRegexp, line)
277 return ''.join([r.group(1), ' ', r.group(3), ' ', r.group(5)]) 301 return ''.join([r.group(1), ' ', r.group(3), ' ', r.group(5)])
278 302
279# _Format guideline #6_: 303# _Format guideline #6_:
280# Don't use spaces or tabs on empty lines 304# Don't use spaces or tabs on empty lines
305
306
281def respect_rule6(line): 307def respect_rule6(line):
282 return not line.isspace() or line == "\n" 308 return not line.isspace() or line == "\n"
309
310
283def conformTo_rule6(line): 311def conformTo_rule6(line):
284 return "" 312 return ""
285 313
286# _Format guideline #7_: 314# _Format guideline #7_:
287# Indentation of multiline variables such as SRC_URI is desireable. 315# Indentation of multiline variables such as SRC_URI is desireable.
316
317
288def respect_rule7(line): 318def respect_rule7(line):
289 return True 319 return True
320
321
290def conformTo_rule7(line): 322def conformTo_rule7(line):
291 return line 323 return line
292 324
325
293rules = ( 326rules = (
294 (respect_rule0, conformTo_rule0, "No spaces are allowed at the beginning of lines that define a variable or a do_ routine"), 327 (respect_rule0, conformTo_rule0, "No spaces are allowed at the beginning of lines that define a variable or a do_ routine"),
295 (respect_rule1, conformTo_rule1, "No spaces are allowed behind the line continuation symbol '\\'"), 328 (respect_rule1, conformTo_rule1, "No spaces are allowed behind the line continuation symbol '\\'"),
@@ -303,6 +336,8 @@ rules = (
303 336
304# Function to check that a line respects a rule. If not, it tries to conform 337# Function to check that a line respects a rule. If not, it tries to conform
305# the line to the rule. Reminder or Disgression message are dump accordingly. 338# the line to the rule. Reminder or Disgression message are dump accordingly.
339
340
306def follow_rule(i, line): 341def follow_rule(i, line):
307 oldline = line 342 oldline = line
308 # if the line does not respect the rule 343 # if the line does not respect the rule
diff --git a/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py b/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py
index b17c7950c..c5a9a2794 100644
--- a/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py
+++ b/meta-oe/lib/oeqa/selftest/cases/meta_oe_sources.py
@@ -6,6 +6,7 @@ import tempfile
6from oeqa.selftest.case import OESelftestTestCase 6from oeqa.selftest.case import OESelftestTestCase
7from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars 7from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
8 8
9
9class MetaOESourceMirroring(OESelftestTestCase): 10class MetaOESourceMirroring(OESelftestTestCase):
10 # Can we download everything from the OpenEmbedded Sources Mirror over http only 11 # Can we download everything from the OpenEmbedded Sources Mirror over http only
11 def test_oe_source_mirror(self): 12 def test_oe_source_mirror(self):