aboutsummaryrefslogtreecommitdiffstats
path: root/templatefile.py
AgeCommit message (Collapse)AuthorFilesLines
2019-05-15Add SPDX-License-Identifier: LGPL-2.1-only to filesRichard Purdie1-0/+4
This adds SPDX license headers to all source files in pseudo so license identification models current best practise. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-12Python 3 says:Seebs1-4/+4
File "./makewrappers", line 459 print port ^ SyntaxError: Missing parentheses in call to 'print' Signed-off-by: Gaƫl PORTAY <gael.portay@savoirfairelinux.com> Signed-off-by: Seebs <seebs@seebs.net> --- maketables | 12 ++++++------ makewrappers | 32 ++++++++++++++++---------------- templatefile.py | 8 ++++---- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/maketables b/maketables index b32312e..0726485 100755 --- a/maketables +++ b/maketables @@ -73,7 +73,7 @@ class DataType: for col in columns: indexed = False if col.startswith("FLAGS"): - print "Flags: set for %s" % self.name + print("Flags: set for %s" % self.name) self.flags = True continue if col.startswith("INDEXED "): @@ -248,7 +248,7 @@ def main(): template_file.emit('header') templates.append(template_file) except IOError: - print "Invalid or malformed template %s. Aborting." % path + print("Invalid or malformed template %s. Aborting." % path) exit(1) for filename in sys.argv[1:]: @@ -256,15 +256,15 @@ def main(): sys.stdout.write("%s: " % filename) datatype = DataType(filename) datatypes.append(datatype) - print datatype.__repr__() - print "" + print(datatype.__repr__()) + print("") - print "Writing datatypes...", + print("Writing datatypes...") for datatype in datatypes: # populate various tables and files with each datatype for template_file in templates: template_file.emit('body', datatype) - print "done. Cleaning up." + print("done. Cleaning up.") for template_file in templates: # clean up files diff --git a/makewrappers b/makewrappers index 303e2cc..bac856b 100755 --- a/makewrappers +++ b/makewrappers @@ -456,7 +456,7 @@ additional ports to include. self.name = port self.subports = [] self.preports = [] - print port + print(port) if os.path.exists(self.portfile("pseudo_wrappers.c")): self.wrappers = self.portfile("pseudo_wrappers.c") @@ -504,17 +504,17 @@ additional ports to include. prefuncs = pre.functions() for name in prefuncs.keys(): if name in mergedfuncs: - print "Warning: %s from %s overriding %s" % (name, pre.name, mergedfuncs[name].port) + print("Warning: %s from %s overriding %s" % (name, pre.name, mergedfuncs[name].port)) mergedfuncs[name] = prefuncs[name] for name in self.funcs.keys(): if name in mergedfuncs: - print "Warning: %s from %s overriding %s" % (name, self.name, mergedfuncs[name].port) + print("Warning: %s from %s overriding %s" % (name, self.name, mergedfuncs[name].port)) mergedfuncs[name] = self.funcs[name] for sub in self.subports: subfuncs = sub.functions() for name in subfuncs.keys(): if name in mergedfuncs: - print "Warning: %s from %s overriding %s" % (name, sub.name, mergedfuncs[name].port) + print("Warning: %s from %s overriding %s" % (name, sub.name, mergedfuncs[name].port)) mergedfuncs[name] = subfuncs[name] return mergedfuncs @@ -576,11 +576,11 @@ def process_wrapfuncs(port): func.directory = directory funcs[func.name] = func sys.stdout.write(".") - except Exception, e: - print "Parsing failed:", e + except Exception(e): + print("Parsing failed:", e) exit(1) funclist.close() - print "" + print("") return funcs def main(argv): @@ -599,35 +599,35 @@ def main(argv): for path in glob.glob('templates/*'): try: - print "Considering template: " + path + print("Considering template: " + path) source = TemplateFile(path) if source.name.endswith('.c') or source.name.endswith('.h'): source.emit('copyright') source.emit('header') sources.append(source) except IOError: - print "Invalid or malformed template %s. Aborting." % path + print("Invalid or malformed template %s. Aborting." % path) exit(1) try: port = Port('common', sources) except KeyError: - print "Unknown uname -s result: '%s'." % uname_s - print "Known system types are:" - print "%-20s %-10s %s" % ("uname -s", "port name", "description") + print("Unknown uname -s result: '%s'." % uname_s) + print("Known system types are:") + print("%-20s %-10s %s" % ("uname -s", "port name", "description")) for key in host_ports: - print "%-20s %-10s %s" % (key, host_ports[key], - host_descrs[host_ports[key]]) + print("%-20s %-10s %s" % (key, host_ports[key], + host_descrs[host_ports[key]])) # the per-function stuff - print "Writing functions...", + print("Writing functions...") all_funcs = port.functions() for name in sorted(all_funcs.keys()): # populate various tables and files with each function for source in sources: source.emit('body', all_funcs[name]) - print "done. Cleaning up." + print("done. Cleaning up.") for source in sources: # clean up files diff --git a/templatefile.py b/templatefile.py index 2789b22..abf9a2c 100644 --- a/templatefile.py +++ b/templatefile.py @@ -79,13 +79,13 @@ class TemplateFile: return path = Template(self.path).safe_substitute(item) if os.path.exists(path): - # print "We don't overwrite existing files." + # print("We don't overwrite existing files.") return self.file = open(path, 'w') if not self.file: - print "Couldn't open '%s' (expanded from %s), " \ + print("Couldn't open '%s' (expanded from %s), " \ "not emitting '%s'." % \ - (path, self.path, template) + (path, self.path, template)) return def emit(self, template, item=None): @@ -103,7 +103,7 @@ class TemplateFile: self.file.write(templ.safe_substitute(item)) self.file.write("\n") else: - print "Warning: Unknown template '%s'." % template + print("Warning: Unknown template '%s'." % template) if self.file_per_item: if self.file: -- 2.10.1
2011-04-04Whitespace changes.Peter Seebach1-10/+10
2011-03-25Merge in ports workPeter Seebach1-7/+19
This is a spiffied-up rebase of a bunch of intermediate changes, presented as a whole because it is, surprisingly, less confusing that way. The basic idea is to separate the guts code into categories ranging from generic stuff that can be the same everywhere and specific variants. The big scary one is the Darwin support, which actually seems to run okay on 64-bit OS X 10.6. (No other variants were tested.) The other example given is support for the old clone() syscall on RHEL 4, which affects some wrlinux use cases. There's a few minor cleanup bits here, such as a function with inconsistent calling conventions, but nothing really exciting.
2010-11-18Messing with makewrappers: Move templating code out (for planned usePeter Seebach1-0/+99
in an incoming "maketables".)