sdbus++: work around unicode support in python2
unicode strings in python2 do not have certain functions, such
as 'rstrip'. Send an option to Mako for python2 to ensure
unicode support is disabled.
Change-Id: Ia85581b5a091eec10e9999f30425a40e02de2ffc
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tools/sdbus++ b/tools/sdbus++
index 6051046..01922c9 100755
--- a/tools/sdbus++
+++ b/tools/sdbus++
@@ -2,6 +2,7 @@
import sdbusplus
import mako.lookup
import argparse
+import sys
def main():
valid_types = { 'interface': sdbusplus.Interface }
@@ -26,7 +27,11 @@
args = parser.parse_args();
- lookup = mako.lookup.TemplateLookup(directories=[args.templatedir])
+ if sys.version_info < (3,0):
+ lookup = mako.lookup.TemplateLookup(directories=[args.templatedir],
+ disable_unicode=True)
+ else:
+ lookup = mako.lookup.TemplateLookup(directories=[args.templatedir])
instance = valid_types[args.typeName].load(args.item, args.rootdir)
function = getattr(instance, valid_processes[args.process])