summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index c4754dbcdd..99d9cc850e 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -46,10 +46,26 @@ class RecipeHandler():
46 results.extend(glob.glob(os.path.join(path, spec))) 46 results.extend(glob.glob(os.path.join(path, spec)))
47 return results 47 return results
48 48
49 def genfunction(self, outlines, funcname, content): 49 def genfunction(self, outlines, funcname, content, python=False, forcespace=False):
50 outlines.append('%s () {' % funcname) 50 if python:
51 prefix = 'python '
52 else:
53 prefix = ''
54 outlines.append('%s%s () {' % (prefix, funcname))
55 if python or forcespace:
56 indent = ' '
57 else:
58 indent = '\t'
59 addnoop = not python
51 for line in content: 60 for line in content:
52 outlines.append('\t%s' % line) 61 outlines.append('%s%s' % (indent, line))
62 if addnoop:
63 strippedline = line.lstrip()
64 if strippedline and not strippedline.startswith('#'):
65 addnoop = False
66 if addnoop:
67 # Without this there'll be a syntax error
68 outlines.append('%s:' % indent)
53 outlines.append('}') 69 outlines.append('}')
54 outlines.append('') 70 outlines.append('')
55 71