diff options
| author | Balaji B Rao <balajibapu@gmail.com> | 2017-11-09 14:34:57 -0600 |
|---|---|---|
| committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-01-30 13:07:39 -0500 |
| commit | f99783be6592130bbad2d0f69ada2b7ac61618f3 (patch) | |
| tree | afabf32549b7d38d08f18af309030748e84fcf2b /obmc/dbuslib | |
| parent | dc7f067d73397610a1a202ae0af86f4ad55490e7 (diff) | |
| download | pyphosphor-f99783be6592130bbad2d0f69ada2b7ac61618f3.tar.gz pyphosphor-f99783be6592130bbad2d0f69ada2b7ac61618f3.zip | |
Port obmc to python3.5
Change-Id: I1ed6c6bd914635485a697369048a8be9e5919fc6
Signed-off-by: Balaji B Rao <balajibapu@gmail.com>
Diffstat (limited to 'obmc/dbuslib')
| -rw-r--r-- | obmc/dbuslib/bindings.py | 4 | ||||
| -rw-r--r-- | obmc/dbuslib/introspection.py | 2 | ||||
| -rw-r--r-- | obmc/dbuslib/propertycacher.py | 18 |
3 files changed, 12 insertions, 12 deletions
diff --git a/obmc/dbuslib/bindings.py b/obmc/dbuslib/bindings.py index 3eea6a5..8a04447 100644 --- a/obmc/dbuslib/bindings.py +++ b/obmc/dbuslib/bindings.py @@ -187,7 +187,7 @@ class DbusObjectManager(dbus.service.Object): obj = self.objects.pop(object_path, None) obj.remove_from_connection() if self._export: - self.InterfacesRemoved(object_path, obj.properties.keys()) + self.InterfacesRemoved(object_path, list(obj.properties.keys())) def get(self, object_path, default=None): return self.objects.get(object_path, default) @@ -197,7 +197,7 @@ class DbusObjectManager(dbus.service.Object): in_signature='', out_signature='a{oa{sa{sv}}}') def GetManagedObjects(self): data = {} - for objpath in self.objects.keys(): + for objpath in list(self.objects.keys()): data[objpath] = self.objects[objpath].properties return data diff --git a/obmc/dbuslib/introspection.py b/obmc/dbuslib/introspection.py index 9ec9c05..5288bcb 100644 --- a/obmc/dbuslib/introspection.py +++ b/obmc/dbuslib/introspection.py @@ -104,7 +104,7 @@ class IntrospectionParser: def _discover_flat(self, path, parser): items = {} - interfaces = parser.get_interfaces().keys() + interfaces = list(parser.get_interfaces().keys()) if interfaces: items[path] = {} items[path]['interfaces'] = interfaces diff --git a/obmc/dbuslib/propertycacher.py b/obmc/dbuslib/propertycacher.py index 7888b46..ebbe92a 100644 --- a/obmc/dbuslib/propertycacher.py +++ b/obmc/dbuslib/propertycacher.py @@ -15,7 +15,7 @@ # permissions and limitations under the License. import os -import cPickle +import pickle import json CACHE_PATH = '/var/cache/obmc/' @@ -28,7 +28,7 @@ def getCacheFilename(obj_path, iface_name): def save(obj_path, iface_name, properties): - print "Caching: "+obj_path + print("Caching: "+obj_path) filename = getCacheFilename(obj_path, iface_name) parent = os.path.dirname(filename) try: @@ -39,11 +39,11 @@ def save(obj_path, iface_name, properties): ## use json module to convert dbus datatypes props = json.dumps(properties[iface_name]) prop_obj = json.loads(props) - cPickle.dump(prop_obj, output) + pickle.dump(prop_obj, output) except Exception as e: - print "ERROR: "+str(e) + print("ERROR: "+str(e)) except: - print "ERROR opening cache file: "+filename + print("ERROR opening cache file: "+filename) def load(obj_path, iface_name, properties): @@ -52,14 +52,14 @@ def load(obj_path, iface_name, properties): if (os.path.isfile(filename)): if iface_name in properties: properties[iface_name] = {} - print "Loading from cache: "+filename + print("Loading from cache: "+filename) try: p = open(filename, 'rb') - data = cPickle.load(p) - for prop in data.keys(): + data = pickle.load(p) + for prop in list(data.keys()): properties[iface_name][prop] = data[prop] except Exception as e: - print "ERROR: Loading cache file: " + str(e) + print("ERROR: Loading cache file: " + str(e)) finally: p.close() |

