aboutsummaryrefslogtreecommitdiffstats
path: root/mpm
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-05-31 19:02:58 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:58 -0800
commit6183d9eeaa2cae6ca859b0a2f125d13842f57c39 (patch)
tree4f9f21529896aa90010239c16e17b6776e9f9c7e /mpm
parent34c2fa0beea10308bc9afe6f20b734fc0839b226 (diff)
downloaduhd-6183d9eeaa2cae6ca859b0a2f125d13842f57c39.tar.gz
uhd-6183d9eeaa2cae6ca859b0a2f125d13842f57c39.tar.bz2
uhd-6183d9eeaa2cae6ca859b0a2f125d13842f57c39.zip
mpm: Made code Python3-compatible
Diffstat (limited to 'mpm')
-rw-r--r--mpm/python/usrp_mpm/chips/lmk04828.py1
-rw-r--r--mpm/python/usrp_mpm/cores/tdc_sync.py2
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/base.py1
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/eiscat.py2
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/lmk_mg.py2
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/magnesium.py5
-rw-r--r--mpm/python/usrp_mpm/dboard_manager/test.py2
-rw-r--r--mpm/python/usrp_mpm/dtoverlay.py2
-rw-r--r--mpm/python/usrp_mpm/eeprom.py4
-rw-r--r--mpm/python/usrp_mpm/ethtable.py2
-rw-r--r--mpm/python/usrp_mpm/mpmlog.py1
-rw-r--r--mpm/python/usrp_mpm/mpmtypes.py3
-rw-r--r--mpm/python/usrp_mpm/nijesdcore.py2
-rw-r--r--mpm/python/usrp_mpm/periph_manager/base.py9
-rw-r--r--mpm/python/usrp_mpm/periph_manager/n310.py4
-rw-r--r--mpm/python/usrp_mpm/periph_manager/test.py1
-rw-r--r--mpm/python/usrp_mpm/rpc_server.py3
-rw-r--r--mpm/python/usrp_mpm/sysfs_gpio.py2
-rw-r--r--mpm/python/usrp_mpm/uio.py2
19 files changed, 41 insertions, 9 deletions
diff --git a/mpm/python/usrp_mpm/chips/lmk04828.py b/mpm/python/usrp_mpm/chips/lmk04828.py
index a67ca05fd..91112817b 100644
--- a/mpm/python/usrp_mpm/chips/lmk04828.py
+++ b/mpm/python/usrp_mpm/chips/lmk04828.py
@@ -18,6 +18,7 @@
LMK04828 parent driver class
"""
+from builtins import object
from ..mpmlog import get_logger
class LMK04828(object):
diff --git a/mpm/python/usrp_mpm/cores/tdc_sync.py b/mpm/python/usrp_mpm/cores/tdc_sync.py
index d85dbadde..9ed825e1c 100644
--- a/mpm/python/usrp_mpm/cores/tdc_sync.py
+++ b/mpm/python/usrp_mpm/cores/tdc_sync.py
@@ -18,6 +18,8 @@ TDC clock synchronization
"""
import time
+from builtins import object
+from functools import reduce
def mean(vals):
" Calculate arithmetic mean of vals "
diff --git a/mpm/python/usrp_mpm/dboard_manager/base.py b/mpm/python/usrp_mpm/dboard_manager/base.py
index cc18292c1..724558445 100644
--- a/mpm/python/usrp_mpm/dboard_manager/base.py
+++ b/mpm/python/usrp_mpm/dboard_manager/base.py
@@ -18,6 +18,7 @@
dboard base implementation module
"""
+from builtins import object
from six import iteritems
from ..mpmlog import get_logger
diff --git a/mpm/python/usrp_mpm/dboard_manager/eiscat.py b/mpm/python/usrp_mpm/dboard_manager/eiscat.py
index 4a4d4a256..6997e2fc9 100644
--- a/mpm/python/usrp_mpm/dboard_manager/eiscat.py
+++ b/mpm/python/usrp_mpm/dboard_manager/eiscat.py
@@ -17,6 +17,8 @@
"""
EISCAT rx board implementation module
"""
+from builtins import range
+from builtins import object
import time
from ..mpmlog import get_logger
diff --git a/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py b/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py
index 96795f7fd..6c2660521 100644
--- a/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py
+++ b/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py
@@ -19,6 +19,8 @@ LMK04828 driver for use with Magnesium
"""
from time import sleep
+from builtins import zip
+from builtins import hex
from ..mpmlog import get_logger
from ..chips import LMK04828
diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
index 9edfe497c..b779607c8 100644
--- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py
+++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py
@@ -18,6 +18,7 @@
magnesium dboard implementation module
"""
+from __future__ import print_function
import struct
import time
from six import iteritems
@@ -141,8 +142,8 @@ class Magnesium(DboardManagerBase):
def dump_jesd_core(self):
for i in range(0x2000, 0x2110, 0x10):
- print("0x%04X " % i),
+ print(("0x%04X " % i), end=' ')
for j in range(0, 0x10, 0x4):
- print("%08X" % self.radio_regs.peek32(i + j)),
+ print(("%08X" % self.radio_regs.peek32(i + j)), end=' ')
print("")
diff --git a/mpm/python/usrp_mpm/dboard_manager/test.py b/mpm/python/usrp_mpm/dboard_manager/test.py
index da7b34c7a..3dfeab167 100644
--- a/mpm/python/usrp_mpm/dboard_manager/test.py
+++ b/mpm/python/usrp_mpm/dboard_manager/test.py
@@ -17,6 +17,8 @@
"""
magnesium dboard implementation module
"""
+
+from builtins import object
from . import lib
from .base import DboardManagerBase
from logging import getLogger
diff --git a/mpm/python/usrp_mpm/dtoverlay.py b/mpm/python/usrp_mpm/dtoverlay.py
index a16b8a40e..7f1bf653f 100644
--- a/mpm/python/usrp_mpm/dtoverlay.py
+++ b/mpm/python/usrp_mpm/dtoverlay.py
@@ -120,7 +120,7 @@ def rm_overlay_safe(overlay_name):
"""
Only remove an overlay if it's already applied.
"""
- if overlay_name in list_overlays(applied_only=True).keys():
+ if overlay_name in list(list_overlays(applied_only=True).keys()):
rm_overlay(overlay_name)
else:
get_logger("DTO").debug(
diff --git a/mpm/python/usrp_mpm/eeprom.py b/mpm/python/usrp_mpm/eeprom.py
index 67920e885..e61b8ee09 100644
--- a/mpm/python/usrp_mpm/eeprom.py
+++ b/mpm/python/usrp_mpm/eeprom.py
@@ -19,6 +19,8 @@ EEPROM management code
"""
import struct
+from builtins import zip
+from builtins import object
EEPROM_DEFAULT_HEADER = struct.Struct("!I I")
@@ -124,7 +126,7 @@ def read_eeprom(
eeprom_parser = struct.Struct(eeprom_header_format[version])
eeprom_keys = eeprom_header_keys[version]
parsed_data = eeprom_parser.unpack_from(data)
- return dict(zip(eeprom_keys, parsed_data))
+ return dict(list(zip(eeprom_keys, parsed_data)))
# Dawaj, dawaj
max_size = max_size or -1
with open(nvmem_path, "rb") as nvmem_file:
diff --git a/mpm/python/usrp_mpm/ethtable.py b/mpm/python/usrp_mpm/ethtable.py
index aa57c6d01..e97b05856 100644
--- a/mpm/python/usrp_mpm/ethtable.py
+++ b/mpm/python/usrp_mpm/ethtable.py
@@ -18,6 +18,8 @@
Ethernet dispatcher table control
"""
+from builtins import str
+from builtins import object
import netaddr
from .mpmlog import get_logger
from .uio import UIO
diff --git a/mpm/python/usrp_mpm/mpmlog.py b/mpm/python/usrp_mpm/mpmlog.py
index 3df505f1a..b039424be 100644
--- a/mpm/python/usrp_mpm/mpmlog.py
+++ b/mpm/python/usrp_mpm/mpmlog.py
@@ -22,6 +22,7 @@ from __future__ import print_function
import copy
import logging
from logging import CRITICAL, ERROR, WARNING, INFO, DEBUG
+from builtins import str
# Colors
BOLD = str('\033[1m')
diff --git a/mpm/python/usrp_mpm/mpmtypes.py b/mpm/python/usrp_mpm/mpmtypes.py
index b355e15a1..48f40f47e 100644
--- a/mpm/python/usrp_mpm/mpmtypes.py
+++ b/mpm/python/usrp_mpm/mpmtypes.py
@@ -17,11 +17,12 @@
"""
MPM types
"""
+
import ctypes
from multiprocessing import Value
from multiprocessing import Array
from multiprocessing import RLock
-import struct
+from builtins import object
MPM_RPC_PORT = 49601
MPM_DISCOVERY_PORT = 49600
diff --git a/mpm/python/usrp_mpm/nijesdcore.py b/mpm/python/usrp_mpm/nijesdcore.py
index bb8a3ad43..b3f6af355 100644
--- a/mpm/python/usrp_mpm/nijesdcore.py
+++ b/mpm/python/usrp_mpm/nijesdcore.py
@@ -19,6 +19,8 @@ JESD FPGA Core Interface
"""
import time
+from builtins import hex
+from builtins import object
from .mpmlog import get_logger
class NIMgJESDCore(object):
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
diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py
index 7b8d1edba..844c3e2bf 100644
--- a/mpm/python/usrp_mpm/rpc_server.py
+++ b/mpm/python/usrp_mpm/rpc_server.py
@@ -17,6 +17,7 @@
"""
Implemented RPC Servers
"""
+
from __future__ import print_function
from random import choice
from string import ascii_letters, digits
@@ -28,6 +29,8 @@ from gevent import spawn_later
from gevent import Greenlet
from gevent import monkey
monkey.patch_all()
+from builtins import str
+from builtins import range
from mprpc import RPCServer
from .mpmlog import get_main_logger
diff --git a/mpm/python/usrp_mpm/sysfs_gpio.py b/mpm/python/usrp_mpm/sysfs_gpio.py
index fa07921d8..6473d87ee 100644
--- a/mpm/python/usrp_mpm/sysfs_gpio.py
+++ b/mpm/python/usrp_mpm/sysfs_gpio.py
@@ -19,6 +19,8 @@ Access to GPIOs mapped into the PS via sysfs
"""
import os
+from builtins import range
+from builtins import object
import pyudev
from .mpmlog import get_logger
diff --git a/mpm/python/usrp_mpm/uio.py b/mpm/python/usrp_mpm/uio.py
index a3441a7d7..2ea76233f 100644
--- a/mpm/python/usrp_mpm/uio.py
+++ b/mpm/python/usrp_mpm/uio.py
@@ -21,6 +21,8 @@ Access to UIO mapped memory.
import struct
import os
import mmap
+from builtins import hex
+from builtins import object
import pyudev
from .mpmlog import get_logger