blob: ab1ea6cdfc2745fbe7000763a7e5c3c2fb2f492b [file] [log] [blame]
From 04852662bc68139e58bb51803cb32aa2d300c605 Mon Sep 17 00:00:00 2001
From: Patrick Williams <patrick@stwcx.xyz>
Date: Fri, 31 Jan 2020 18:47:38 -0800
Subject: [PATCH] sdbus++: switch to python3
Python2 is DEAD! Long live Python3!
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ifd46a4aeb41fb0e6db2f4310a603b727a5a2c2ff
---
configure.ac | 2 +-
tools/sdbus++ | 8 ++------
tools/sdbusplus/namedelement.py | 4 ++--
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 11c189b..ec65562 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ AC_PROG_INSTALL
AC_PROG_MAKE_SET
# setup sdbus++
-AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])])
+AM_PATH_PYTHON([3.0], [AC_SUBST([PYTHON], [echo "$PYTHON"])])
AC_SUBST([PYTHONDIR], ${pythondir})
AS_IF([test "$PYTHON" != :], [have_python=yes], [have_python=no])
diff --git a/tools/sdbus++ b/tools/sdbus++
index 26969f3..d709c19 100755
--- a/tools/sdbus++
+++ b/tools/sdbus++
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sdbusplus
import mako.lookup
import argparse
@@ -34,11 +34,7 @@ def main():
args = parser.parse_args()
- if sys.version_info < (3, 0):
- lookup = mako.lookup.TemplateLookup(directories=[args.templatedir],
- disable_unicode=True)
- else:
- lookup = mako.lookup.TemplateLookup(directories=[args.templatedir])
+ lookup = mako.lookup.TemplateLookup(directories=[args.templatedir])
instance = valid_types[args.typeName].load(args.item, args.rootdir)
function = getattr(instance, valid_processes[args.process])
diff --git a/tools/sdbusplus/namedelement.py b/tools/sdbusplus/namedelement.py
index 5048654..1548ef0 100644
--- a/tools/sdbusplus/namedelement.py
+++ b/tools/sdbusplus/namedelement.py
@@ -7,7 +7,7 @@ class NamedElement(object):
self.name = kwargs.pop('name', "unnamed")
self.description = kwargs.pop('description', "")
- def __getattr__(self, name):
+ def __getattribute__(self, name):
l = {'CamelCase': lambda: inflection.camelize(self.name),
'camelCase': lambda: inflection.camelize(self.name, False),
'snake_case': lambda: inflection.underscore(self.name)}\
@@ -16,7 +16,7 @@ class NamedElement(object):
if l:
return NamedElement.__fixup_name(l())
try:
- return super(NamedElement, self).__getattr__(name)
+ return super(NamedElement, self).__getattribute__(name)
except:
raise AttributeError("Attribute '%s' not found in %s.NamedElement"
% (name, self.__module__))
--
2.13.5