diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-05-31 19:02:58 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:58 -0800 |
commit | 6183d9eeaa2cae6ca859b0a2f125d13842f57c39 (patch) | |
tree | 4f9f21529896aa90010239c16e17b6776e9f9c7e /mpm/python/usrp_mpm/periph_manager | |
parent | 34c2fa0beea10308bc9afe6f20b734fc0839b226 (diff) | |
download | uhd-6183d9eeaa2cae6ca859b0a2f125d13842f57c39.tar.gz uhd-6183d9eeaa2cae6ca859b0a2f125d13842f57c39.tar.bz2 uhd-6183d9eeaa2cae6ca859b0a2f125d13842f57c39.zip |
mpm: Made code Python3-compatible
Diffstat (limited to 'mpm/python/usrp_mpm/periph_manager')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/base.py | 9 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/n310.py | 4 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/test.py | 1 |
3 files changed, 10 insertions, 4 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index 031573551..4e6d461d8 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -19,6 +19,9 @@ Mboard implementation base class """ import os +from builtins import str +from builtins import range +from builtins import object from six import iteritems, itervalues from ..mpmlog import get_logger from .udev import get_eeprom_paths @@ -142,7 +145,7 @@ class PeriphManagerBase(object): self._init_mboard_with_eeprom() self._init_mboard_overlays(self._eeprom_head, args) self._init_dboards(args.override_db_pids) - self._available_endpoints = range(256) + self._available_endpoints = list(range(256)) self._init_args = {} self._chdr_interfaces = [] @@ -166,7 +169,7 @@ class PeriphManagerBase(object): # In C++, we can only handle dicts if all the values are of the # same type. So we must convert them all to strings here: self.mboard_info[key] = str(self._eeprom_head.get(key, '')) - if self._eeprom_head.has_key('pid') and self._eeprom_head['pid'] not in self.pids: + if 'pid' in self._eeprom_head and self._eeprom_head['pid'] not in self.pids: self.log.error("Found invalid PID in EEPROM: 0x{:04X}. Valid PIDs are: {}".format( self._eeprom_head['pid'], ", ".join(["0x{:04X}".format(x) for x in self.pids]), @@ -315,7 +318,7 @@ class PeriphManagerBase(object): for dboard in self.dboards: dboard.deinit() self.log.trace("Resetting SID pool...") - self._available_endpoints = range(256) + self._available_endpoints = list(range(256)) def safe_list_updateable_components(self): """ diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py index a5036121a..5817998e7 100644 --- a/mpm/python/usrp_mpm/periph_manager/n310.py +++ b/mpm/python/usrp_mpm/periph_manager/n310.py @@ -17,9 +17,11 @@ """ N310 implementation module """ + from __future__ import print_function import time from six import iteritems +from builtins import object from .base import PeriphManagerBase from ..net import get_iface_addrs from ..net import byte_to_mac @@ -144,7 +146,7 @@ class n310(PeriphManagerBase): super(n310, self).init(args) self._eth_dispatchers = { x: EthDispatcherTable(self.eth_tables.get(x)) - for x in self._chdr_interfaces.keys() + for x in list(self._chdr_interfaces.keys()) } for ifname, table in iteritems(self._eth_dispatchers): table.set_ipv4_addr(self._chdr_interfaces[ifname]['ip_addr']) diff --git a/mpm/python/usrp_mpm/periph_manager/test.py b/mpm/python/usrp_mpm/periph_manager/test.py index 4daa876cb..03bd28956 100644 --- a/mpm/python/usrp_mpm/periph_manager/test.py +++ b/mpm/python/usrp_mpm/periph_manager/test.py @@ -17,6 +17,7 @@ """ test periph_manager implementation module """ + from __future__ import print_function from .base import PeriphManagerBase from . import dboard_manager |