summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2022-11-08 12:05:53 +0100
committerChristoph Berg <christoph.berg@credativ.de>2022-11-08 12:05:53 +0100
commitf8eec65c1efb93fb30a81b4c11c08a160ee55066 (patch)
treede5d3fcd0912a9438ec98be1369b79c700722937
parent42b1373eff59af2aebb218ded3d2d55cc96dc630 (diff)
New upstream version 20221106+py3.debian/1%20221106+py3-1
Switch upstream to github. (Closes: #1012538)
-rw-r--r--debian/changelog8
-rw-r--r--debian/control2
-rw-r--r--debian/copyright6
-rw-r--r--debian/patches/09-adopt-atpage-changes.patch1824
-rw-r--r--debian/patches/99.patch338
-rw-r--r--debian/patches/py3232
-rw-r--r--debian/patches/series3
-rwxr-xr-xdebian/rules3
8 files changed, 582 insertions, 1834 deletions
diff --git a/debian/changelog b/debian/changelog
index c056d39..326ee46 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-chirp (1:20211015+py3-1) UNRELEASED; urgency=medium
+chirp (1:20221106+py3-1) unstable; urgency=medium
[ Debian Janitor ]
* Bump debhelper from old 12 to 13.
@@ -6,10 +6,10 @@ chirp (1:20211015+py3-1) UNRELEASED; urgency=medium
* Update standards version to 4.6.0, no changes needed.
[ Christoph Berg ]
- * New upstream version 20211015+py3.
- * Upstream py3 branch changeset 3608:5da559ffde25.
+ * New upstream version 20221106+py3.
+ * Switch upstream to github. (Closes: #1012538)
- -- Christoph Berg <myon@debian.org> Sun, 06 Nov 2022 21:01:26 +0100
+ -- Christoph Berg <myon@debian.org> Tue, 08 Nov 2022 12:03:58 +0100
chirp (1:20200227+py3+20200213-4) unstable; urgency=medium
diff --git a/debian/control b/debian/control
index 926e4a0..ddc3595 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Build-Depends:
dh-python,
python3,
python3-future,
+ python3-requests,
python3-serial,
python3-six,
Standards-Version: 4.6.0
@@ -25,6 +26,7 @@ Architecture: all
Multi-Arch: foreign
Depends:
python3-future,
+ python3-requests,
python3-serial,
python3-six,
python3-wxgtk4.0,
diff --git a/debian/copyright b/debian/copyright
index d8bdbd4..95f8019 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,17 +1,13 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: chirp
Upstream-Contact: Dan Smith <dsmith@danplanet.com>
-Source: https://trac.chirp.danplanet.com/chirp_daily/LATEST/chirp-daily-20151225.tar.gz
+Source: https://github.com/kk7ds/chirp/tree/py3
Copyright: GPL-3+
Files: *
Copyright: 2012 Dan Smith <dsmith@danplanet.com>
License: GPL-3+
-Files: debian/patches/09-adopt-atpage-changes.patch
-Copyright: Alex Page <a.t.page@gmail.com>, 2020
-License: GPL-3+
-
Files: debian/*
Copyright: 2013 Christopher Knadle <Chris.Knadle@coredump.us>
2011 Steve Conklin AI4QR <steve@conklinhouse.com>
diff --git a/debian/patches/09-adopt-atpage-changes.patch b/debian/patches/09-adopt-atpage-changes.patch
deleted file mode 100644
index a3bdb7f..0000000
--- a/debian/patches/09-adopt-atpage-changes.patch
+++ /dev/null
@@ -1,1824 +0,0 @@
-Description: Fix the massive number of Python3 bugs in the py3 branch.
- Upstream has not acted on the patches sent to their branch. A long lived
- repo containing changes forward to upstream is being maintained in Git, and
- this patch is a massive set of deltas between base upstream and their fork.
- .
- Upstream has not put effort into their Python 3 work, so this is the best we
- have while we wait on upstream, since the Python 2 dependencies for the prior
- version are removed from the Debian archive.
- .
- This is the only way we can keep Chirp in Debian in a usable state.
-Forwarded: https://github.com/atpage/chirp/issues/7
-Author: Alex Page <a.t.page@gmail.com>, 2020
-Last-Update: 2020-06-14
-
---- a/chirp/drivers/alinco.py
-+++ b/chirp/drivers/alinco.py
-@@ -199,7 +199,7 @@
- self._mmap = self._download(self._memsize)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
-
-@@ -208,7 +208,7 @@
- self._upload(self._memsize)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def get_raw_memory(self, number):
---- a/chirp/drivers/anytone.py
-+++ b/chirp/drivers/anytone.py
-@@ -177,7 +177,7 @@
- try:
- radio.pipe.write(data)
- radio.pipe.read(len(data))
-- except Exception, e:
-+ except Exception as e:
- LOG.error("Error writing to radio: %s" % e)
- raise errors.RadioError("Unable to write to radio")
-
-@@ -185,7 +185,7 @@
- def _read(radio, length):
- try:
- data = radio.pipe.read(length)
-- except Exception, e:
-+ except Exception as e:
- LOG.error("Error reading from radio: %s" % e)
- raise errors.RadioError("Unable to read from radio")
-
---- a/chirp/drivers/anytone_ht.py
-+++ b/chirp/drivers/anytone_ht.py
-@@ -233,7 +233,7 @@
- def _echo_write(radio, data):
- try:
- radio.pipe.write(data)
-- except Exception, e:
-+ except Exception as e:
- LOG.error("Error writing to radio: %s" % e)
- raise errors.RadioError("Unable to write to radio")
-
-@@ -241,7 +241,7 @@
- def _read(radio, length):
- try:
- data = radio.pipe.read(length)
-- except Exception, e:
-+ except Exception as e:
- LOG.error("Error reading from radio: %s" % e)
- raise errors.RadioError("Unable to read from radio")
-
-@@ -930,7 +930,7 @@
- else:
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ap510.py
-+++ b/chirp/drivers/ap510.py
-@@ -242,7 +242,7 @@
-
- class AP510Memory20141215(AP510Memory):
- """Compatible with firmware version 20141215"""
-- ATTR_MAP = dict(AP510Memory.ATTR_MAP.items() + {
-+ ATTR_MAP = dict(list(AP510Memory.ATTR_MAP.items()) + list({
- 'tx_volume': '21', # 1-6
- 'rx_volume': '22', # 1-9
- 'tx_power': '23', # 1: 1 watt, 0: 0.5 watt
-@@ -252,7 +252,7 @@
- 'path3': '27', # like "WIDE1 1" else "0"
- 'multiple': '28',
- 'auto_on': '29',
-- }.items())
-+ }.items()))
-
- def get_multiple(self):
- return dict(zip(
-@@ -380,7 +380,7 @@
- data = download(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- # _mmap isn't a Chirp MemoryMap, but since AP510Memory implements
-@@ -398,7 +398,7 @@
- upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def load_mmap(self, filename):
---- a/chirp/drivers/baofeng_common.py
-+++ b/chirp/drivers/baofeng_common.py
-@@ -164,8 +164,8 @@
- try:
- data = _do_ident(radio, magic)
- return data
-- except errors.RadioError, e:
-- print e
-+ except errors.RadioError as e:
-+ print(e)
- error = e
- time.sleep(2)
- if error:
-@@ -336,7 +336,7 @@
- _upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- # If anything unexpected happens, make sure we raise
- # a RadioError and log the problem
- LOG.exception('Unexpected error during upload')
-@@ -622,7 +622,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -636,6 +636,6 @@
- value = int(val.get_value() * 10)
- LOG.debug("Setting fm_presets = %s" % (value))
- self._memobj.fm_presets = value
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
---- a/chirp/drivers/baofeng_uv3r.py
-+++ b/chirp/drivers/baofeng_uv3r.py
-@@ -19,7 +19,7 @@
- import os
- import logging
-
--from wouxun_common import do_download, do_upload
-+from chirp.drivers.wouxun_common import do_download, do_upload
- from chirp import util, chirp_common, bitwise, errors, directory
- from chirp.settings import RadioSetting, RadioSettingGroup, \
- RadioSettingValueBoolean, RadioSettingValueList, \
-@@ -51,7 +51,7 @@
- for _i in range(0, 10):
- try:
- return _uv3r_prep(radio)
-- except errors.RadioError, e:
-+ except errors.RadioError as e:
- time.sleep(1)
-
- raise e
-@@ -64,7 +64,7 @@
- return do_download(radio, 0x0000, 0x0E40, 0x0010)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-
-@@ -75,7 +75,7 @@
- return do_upload(radio, 0x0000, 0x0E40, 0x0010)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-
-@@ -623,7 +623,7 @@
- else:
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -639,7 +639,7 @@
- LOG.debug("Setting fm_presets[%1i] = %s" % (index, value))
- setting = self._memobj.fm_presets
- setting[index] = value
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/bf-t1.py
-+++ b/chirp/drivers/bf-t1.py
-@@ -225,7 +225,7 @@
-
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Error sending Magic to radio:\n%s" % e)
-
-
-@@ -561,7 +561,7 @@
- _upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Error: %s" % e)
-
- def _decode_tone(self, val, inv):
-@@ -894,7 +894,7 @@
- setattr(_settings, name, value)
-
- LOG.debug("Setting %s: %s" % (name, value))
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/bj9900.py
-+++ b/chirp/drivers/bj9900.py
-@@ -178,7 +178,7 @@
- self._mmap = self._clone_in()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
-
-@@ -187,7 +187,7 @@
- self._clone_out()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def process_mmap(self):
---- a/chirp/drivers/bjuv55.py
-+++ b/chirp/drivers/bjuv55.py
-@@ -647,6 +647,6 @@
- value = int(val.get_value() * 10 - 870)
- LOG.debug("Setting fm_preset = %s" % (value))
- self._memobj.fm_preset = value
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
---- a/chirp/drivers/fd268.py
-+++ b/chirp/drivers/fd268.py
-@@ -790,11 +790,11 @@
- obj = getattr(_mem, sett)
- setattr(obj, name, element.value)
-
-- except AttributeError, e:
-+ except AttributeError as e:
- m = "Setting %s is not in this setting block" % name
- LOG.debug(m)
-
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ft1d.py
-+++ b/chirp/drivers/ft1d.py
-@@ -1890,7 +1890,7 @@
- except AttributeError as e:
- LOG.error("Setting %s is not in the memory map: %s" %
- (element.get_name(), e))
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ft2800.py
-+++ b/chirp/drivers/ft2800.py
-@@ -18,7 +18,7 @@
- import logging
-
- from chirp import util, memmap, chirp_common, bitwise, directory, errors
--from yaesu_clone import YaesuCloneModeRadio
-+from chirp.drivers.yaesu_clone import YaesuCloneModeRadio
-
- LOG = logging.getLogger(__name__)
-
-@@ -201,7 +201,7 @@
- self._mmap = _download(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- LOG.info("Downloaded in %.2f sec" % (time.time() - start))
- self.process_mmap()
-@@ -214,7 +214,7 @@
- _upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- LOG.info("Uploaded in %.2f sec" % (time.time() - start))
-
---- a/chirp/drivers/ft2900.py
-+++ b/chirp/drivers/ft2900.py
-@@ -537,7 +537,7 @@
- self._mmap = _download(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- LOG.info("Downloaded in %.2f sec" % (time.time() - start))
- self.process_mmap()
-@@ -549,7 +549,7 @@
- _upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- LOG.info("Uploaded in %.2f sec" % (time.time() - start))
-
-@@ -1210,7 +1210,7 @@
- setattr(_settings, name, value)
-
- LOG.debug("Setting %s: %s" % (name, value))
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ft450d.py
-+++ b/chirp/drivers/ft450d.py
-@@ -304,8 +304,8 @@
- struct mem_struct current;
-
- """
-- _CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9") + 1) +
-- range(ord("A"), ord("Z") + 1) + [ord(" ")]]
-+ _CALLSIGN_CHARSET = [chr(x) for x in list(range(ord("0"), ord("9") + 1)) +
-+ list(range(ord("A"), ord("Z") + 1)) + [ord(" ")]]
- _CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET,
- range(0, len(_CALLSIGN_CHARSET))))
-
-@@ -499,7 +499,7 @@
- self._mmap = self._clone_in()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s"
- % e)
- self.process_mmap()
-@@ -509,7 +509,7 @@
- self._clone_out()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s"
- % e)
-
-@@ -1489,6 +1489,6 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
---- a/chirp/drivers/ft50.py
-+++ b/chirp/drivers/ft50.py
-@@ -586,7 +586,7 @@
- def _clone_out(radio):
- try:
- return __clone_out(radio)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with the radio: %s" % e)
-
-
---- a/chirp/drivers/ft60.py
-+++ b/chirp/drivers/ft60.py
-@@ -403,7 +403,7 @@
- self._mmap = _download(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
- self.check_checksums()
-@@ -414,7 +414,7 @@
- _upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def process_mmap(self):
-@@ -716,7 +716,7 @@
- setattr(_settings, name, value)
-
- LOG.debug("Setting %s: %s" % (name, value))
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ft70.py
-+++ b/chirp/drivers/ft70.py
-@@ -528,7 +528,7 @@
- _GM_RING = ("OFF", "IN RING", "AlWAYS")
- _GM_INTERVAL = ("LONG", "NORMAL", "OFF")
-
-- _MYCALL_CHR_SET = list(string.uppercase) + list(string.digits) + ['-','/' ]
-+ _MYCALL_CHR_SET = list(string.ascii_uppercase) + list(string.digits) + ['-','/' ]
-
- @classmethod
- def get_prompts(cls):
-@@ -1162,7 +1162,7 @@
- except AttributeError as e:
- LOG.error("Setting %s is not in the memory map: %s" %
- (element.get_name(), e))
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ft7100.py
-+++ b/chirp/drivers/ft7100.py
-@@ -568,7 +568,7 @@
- self._mmap = _download(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- LOG.info("Downloaded in %.2f sec", (time.time() - start))
- self.process_mmap()
-@@ -580,7 +580,7 @@
- _upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- LOG.info("Uploaded in %.2f sec", (time.time() - start))
-
-@@ -1091,7 +1091,7 @@
- setattr(_overlay, name, value)
-
- LOG.debug("Setting %s: %s", name, value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ft8100.py
-+++ b/chirp/drivers/ft8100.py
-@@ -175,7 +175,7 @@
-
- if _mem.duplex == DUPLEX.index("split"):
- tx_freq = int(_mem.offset) * 1000
-- print self.VARIANT, number, tx_freq, mem.freq
-+ print( self.VARIANT, number, tx_freq, mem.freq )
- mem.offset = tx_freq - mem.freq
- else:
- mem.offset = int(_mem.offset) * 1000
-@@ -189,7 +189,7 @@
- if not self._memobj.enables[byte] & bit and number != 1:
- mem.empty = True
-
-- print 'R', self.VARIANT, number, _mem.baud9600
-+ print( 'R', self.VARIANT, number, _mem.baud9600 )
-
- return mem
-
-@@ -270,7 +270,7 @@
- def _clone_out(radio):
- try:
- return __clone_out(radio)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with the radio: %s" % e)
-
-
-@@ -291,7 +291,7 @@
- pos = 0
- for block in radio._block_lengths:
- if os.getenv("CHIRP_DEBUG"):
-- print "\nSending %i-%i" % (pos, pos + block)
-+ print( "\nSending %i-%i" % (pos, pos + block) )
- out = radio.get_mmap()[pos:pos + block]
-
- # need to chew byte-by-byte here or else we lose the ACK...not sure why
-@@ -309,6 +309,6 @@
-
- pos += block
-
-- print "Clone completed in %i seconds" % (time.time() - start)
-+ print( "Clone completed in %i seconds" % (time.time() - start) )
-
- return True
---- a/chirp/drivers/ft90.py
-+++ b/chirp/drivers/ft90.py
-@@ -52,7 +52,7 @@
- chirp_common.PowerLevel("Low", watts=5)]
-
- FT90_DUPLEX = ["", "-", "+", "split"]
--FT90_CWID_CHARS = list(string.digits) + list(string.uppercase) + list(" ")
-+FT90_CWID_CHARS = list(string.digits) + list(string.ascii_uppercase) + list(" ")
- FT90_DTMF_CHARS = list("0123456789ABCD*#")
- FT90_SPECIAL = ["vfo_vhf", "home_vhf", "vfo_uhf", "home_uhf",
- "pms_1L", "pms_1U", "pms_2L", "pms_2U"]
-@@ -332,7 +332,7 @@
- self._mmap = self._clone_in()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- trace = traceback.format_exc()
- raise errors.RadioError(
- "Failed to communicate with radio: %s" % trace)
-@@ -343,7 +343,7 @@
- self._clone_out()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- trace = traceback.format_exc()
- raise errors.RadioError(
- "Failed to communicate with radio: %s" % trace)
-@@ -670,6 +670,6 @@
- newval = self._dtmf2bbcd(newval)
- LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
- setattr(_settings, setting, newval)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
---- a/chirp/drivers/ftm350.py
-+++ b/chirp/drivers/ftm350.py
-@@ -278,7 +278,7 @@
- self._mmap = _clone_in(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to download from radio (%s)" % e)
- self.process_mmap()
-
-@@ -287,7 +287,7 @@
- _clone_out(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to upload to radio (%s)" % e)
-
- def process_mmap(self):
---- a/chirp/drivers/kguv8d.py
-+++ b/chirp/drivers/kguv8d.py
-@@ -376,7 +376,7 @@
- self._mmap = self._download()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
-
-@@ -393,7 +393,7 @@
- return self._do_download(0, 32768, 64)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- LOG.exception('Unknown error during download process')
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-@@ -426,7 +426,7 @@
- self._do_upload(0, 32768, 64)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- return
-
---- a/chirp/drivers/kguv8dplus.py
-+++ b/chirp/drivers/kguv8dplus.py
-@@ -418,7 +418,7 @@
- self._mmap = self._download()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
-
-@@ -435,7 +435,7 @@
- return self._do_download(0, 32768, 64)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- LOG.exception('Unknown error during download process')
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-@@ -467,7 +467,7 @@
- self._do_upload(0, 32768, 64)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- return
-
-@@ -1103,7 +1103,7 @@
- setattr(obj, setting, int(element.value)/10)
- else:
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/kguv8e.py
-+++ b/chirp/drivers/kguv8e.py
-@@ -337,7 +337,7 @@
-
- try:
- self.pipe.write(_header)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def _read_record(self):
-@@ -423,7 +423,7 @@
- self._mmap = self._download()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
-
-@@ -440,7 +440,7 @@
- return self._do_download(0, 32768, 64)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- LOG.exception('Unknown error during download process')
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-@@ -472,7 +472,7 @@
- self._do_upload(0, 32768, 64)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- return
-
-@@ -1138,7 +1138,7 @@
- setattr(obj, setting, int(element.value)/10)
- else:
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/kguv9dplus.py
-+++ b/chirp/drivers/kguv9dplus.py
-@@ -877,7 +877,7 @@
- self._write_record(CMD_HANGUP)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- LOG.exception('Unknown error during download process')
- raise errors.RadioError(
- "Failed to communicate with radio: %s" % e)
-@@ -894,7 +894,7 @@
- self._write_record(CMD_HANGUP)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError(
- "Failed to communicate with radio: %s" % e)
- return
-@@ -1887,7 +1887,7 @@
- setattr(obj, setting, int(element.value)/10)
- else:
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug("set_settings: Exception with %s" %
- element.get_name())
- raise
---- a/chirp/drivers/kyd.py
-+++ b/chirp/drivers/kyd.py
-@@ -500,7 +500,7 @@
-
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/kyd_IP620.py
-+++ b/chirp/drivers/kyd_IP620.py
-@@ -181,7 +181,7 @@
- self.pipe.write("\x06")
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Radio refused to exit programming mode: %s" % e)
-
- def _ip620_enter_programming_mode(self):
-@@ -192,7 +192,7 @@
- _ack = self.pipe.read(1)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Error communicating with radio: %s" % e)
- if not _ack:
- raise errors.RadioError("No response from radio")
-@@ -203,17 +203,17 @@
- _ident = self.pipe.read(8)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Error communicating with radio: %s" % e)
- if not _ident.startswith("\x06\x4B\x47\x36\x37\x01\x56\xF8"):
-- print util.hexprint(_ident)
-+ print( util.hexprint(_ident) )
- raise errors.RadioError("Radio returned unknown identification string")
- try:
- self.pipe.write(CMD_ACK)
- _ack = self.pipe.read(1)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Error communicating with radio: %s" % e)
- if _ack != CMD_ACK:
- raise errors.RadioError("Radio refused to enter programming mode")
-@@ -316,7 +316,7 @@
- self._mmap = self._do_download()
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
-
-@@ -597,7 +597,7 @@
- setattr(self._memobj.settings_misc,
- element.get_name(),
- element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -624,6 +624,6 @@
- setattr(_settings_misc, setting, newval)
- else:
- setattr(_settings, setting, newval)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
---- a/chirp/drivers/leixen.py
-+++ b/chirp/drivers/leixen.py
-@@ -226,7 +226,7 @@
- ]
-
- MODES = ["NFM", "FM"]
--WTFTONES = map(float, xrange(56, 64))
-+WTFTONES = list(map(float, range(56, 64)))
- TONES = WTFTONES + chirp_common.TONES
- DTCS_CODES = [17, 50, 645] + chirp_common.DTCS_CODES
- DTCS_CODES.sort()
-@@ -261,7 +261,7 @@
- # util.hexprint(frame).replace("\n", "\n ")))
- try:
- radio.pipe.write(frame)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-
-@@ -427,7 +427,7 @@
- def sync_in(self):
- try:
- self._mmap = do_download(self)
-- except Exception, e:
-+ except Exception as e:
- finish(self)
- raise errors.RadioError("Failed to download from radio: %s" % e)
- self.process_mmap()
-@@ -442,7 +442,7 @@
- except errors.RadioError:
- finish(self)
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to upload to radio: %s" % e)
-
- def get_raw_memory(self, number):
-@@ -941,7 +941,7 @@
- else:
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/lt725uv.py
-+++ b/chirp/drivers/lt725uv.py
-@@ -1393,7 +1393,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/puxing.py
-+++ b/chirp/drivers/puxing.py
-@@ -47,7 +47,7 @@
- for _i in range(0, 10):
- try:
- return _puxing_prep(radio)
-- except Exception, e:
-+ except Exception as e:
- time.sleep(1)
-
- raise e
-@@ -60,7 +60,7 @@
- return do_download(radio, 0x0000, 0x0C60, 0x0008)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-
-@@ -71,7 +71,7 @@
- return do_upload(radio, 0x0000, 0x0C40, 0x0008)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00),
-@@ -372,7 +372,7 @@
- return do_download(radio, 0x0000, 0x0FE0, 0x0010)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
-
-@@ -383,7 +383,7 @@
- return do_upload(radio, 0x0000, 0x0FE0, 0x0010)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- PUXING_2R_MEM_FORMAT = """
---- a/chirp/drivers/puxing_px888k.py
-+++ b/chirp/drivers/puxing_px888k.py
-@@ -527,7 +527,7 @@
- TONE_RESET_TIME = ['Off'] + ['%ds' % x for x in range(1, 256)]
- DTMF_TONE_RESET_TIME = TONE_RESET_TIME[0:16]
-
--DTMF_GROUPS = zip(["Off", "A", "B", "C", "D", "*", "#"], [255]+range(10, 16))
-+DTMF_GROUPS = zip(["Off", "A", "B", "C", "D", "*", "#"], [255]+list(range(10, 16)))
- FIVE_TONE_STANDARDS = ['ZVEI1', 'ZVEI2', 'CCIR1', 'CCITT']
-
- # should mimic the defaults in the memedit MemoryEditor somewhat
-@@ -543,10 +543,10 @@
- DTMF_ALERT_TRANSPOND = zip(['Off', 'Call alert',
- 'Transpond-alert',
- 'Transpond-ID code'],
-- [255]+range(1, 4))
-+ [255]+list(range(1, 4)))
- FIVE_TONE_ALERT_TRANSPOND = zip(['Off', 'Alert tone',
- 'Transpond', 'Transpond-ID code'],
-- [255]+range(1, 4))
-+ [255]+list(range(1, 4)))
-
- BFM_BANDS = ['87.5-108MHz', '76.0-91.0MHz', '76.0-108.0MHz', '65.0-76.0MHz']
- BFM_STRIDE = ['100kHz', '50kHz']
---- a/chirp/drivers/radioddity_r2.py
-+++ b/chirp/drivers/radioddity_r2.py
-@@ -611,7 +611,7 @@
-
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/radtel_t18.py
-+++ b/chirp/drivers/radtel_t18.py
-@@ -478,7 +478,7 @@
- else:
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/retevis_rt1.py
-+++ b/chirp/drivers/retevis_rt1.py
-@@ -726,7 +726,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/retevis_rt21.py
-+++ b/chirp/drivers/retevis_rt21.py
-@@ -561,7 +561,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/retevis_rt22.py
-+++ b/chirp/drivers/retevis_rt22.py
-@@ -605,7 +605,7 @@
-
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/retevis_rt23.py
-+++ b/chirp/drivers/retevis_rt23.py
-@@ -846,7 +846,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/retevis_rt26.py
-+++ b/chirp/drivers/retevis_rt26.py
-@@ -897,7 +897,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/rfinder.py
-+++ b/chirp/drivers/rfinder.py
-@@ -240,7 +240,7 @@
- dist = distance(self.__lat, self.__lon, lat, lon)
- bear = fuzzy_to(self.__lat, self.__lon, lat, lon)
- mem.comment = "(%imi %s) %s" % (dist, bear, mem.comment)
-- except Exception, e:
-+ except Exception as e:
- LOG.error("Failed to calculate distance: %s" % e)
-
- return mem
-@@ -258,7 +258,7 @@
- mem.number = number
- number += 1
- self.__memories.append(mem)
-- except Exception, e:
-+ except Exception as e:
- import traceback
- LOG.error(traceback.format_exc())
- LOG.error("Error in received data, cannot continue")
-@@ -287,10 +287,10 @@
-
- self._rfp = None
-
-- def set_params(self, (lat, lon), miles, email, password):
-+ def set_params(self, lat_lon, miles, email, password):
- """Sets the parameters to use for the query"""
-- self._lat = lat
-- self._lon = lon
-+ self._lat = lat_lon[0]
-+ self._lon = lat_lon[1]
- self._miles = miles
- self._user = email
- self._pass = password
---- a/chirp/drivers/rh5r_v2.py
-+++ b/chirp/drivers/rh5r_v2.py
-@@ -167,7 +167,7 @@
- filedata[0x840:0x848] == cls._FILEID)
-
- def process_mmap(self):
-- print MEM_FORMAT
-+ print( MEM_FORMAT )
- self._memobj = bitwise.parse(MEM_FORMAT, self._mmap)
-
- def get_raw_memory(self, number):
---- a/chirp/drivers/tdxone_tdq8a.py
-+++ b/chirp/drivers/tdxone_tdq8a.py
-@@ -301,8 +301,8 @@
- try:
- data = _do_ident(radio, magic)
- return data
-- except errors.RadioError, e:
-- print e
-+ except errors.RadioError as e:
-+ print(e)
- error = e
- time.sleep(2)
- if error:
-@@ -426,7 +426,7 @@
-
- if len(data) == 0x2008:
- rid = data[0x2000:0x2008]
-- print rid
-+ print(rid)
- return rid.startswith(cls.MODEL)
- else:
- return False
-@@ -1117,7 +1117,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -1131,7 +1131,7 @@
- value = int(val.get_value() * 10)
- LOG.debug("Setting fm_presets = %s" % (value))
- self._memobj.fm_presets = value
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/th7800.py
-+++ b/chirp/drivers/th7800.py
-@@ -536,7 +536,7 @@
-
- LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
- setattr(_settings, setting, newval)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -726,7 +726,7 @@
- def sync_in(self):
- try:
- self._mmap = _download(self)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError(
- "Failed to communicate with the radio: %s" % e)
- self.process_mmap()
-@@ -734,6 +734,6 @@
- def sync_out(self):
- try:
- _upload(self)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError(
- "Failed to communicate with the radio: %s" % e)
---- a/chirp/drivers/th9000.py
-+++ b/chirp/drivers/th9000.py
-@@ -352,7 +352,7 @@
- try:
- radio.pipe.write(data)
- radio.pipe.read(len(data))
-- except Exception, e:
-+ except Exception as e:
- LOG.error("Error writing to radio: %s" % e)
- raise errors.RadioError("Unable to write to radio")
-
-@@ -366,7 +366,7 @@
- def _read(radio, length):
- try:
- data = radio.pipe.read(length)
-- except Exception, e:
-+ except Exception as e:
- LOG.error( "Error reading from radio: %s" % e)
- raise errors.RadioError("Unable to read from radio")
-
-@@ -793,7 +793,7 @@
- else:
- LOG.debug( "Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug( element.get_name())
- raise
-
---- a/chirp/drivers/th9800.py
-+++ b/chirp/drivers/th9800.py
-@@ -598,7 +598,7 @@
-
- LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
- setattr(_settings, setting, newval)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -785,7 +785,7 @@
- def sync_in(self):
- try:
- self._mmap = _download(self)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError(
- "Failed to communicate with the radio: %s" % e)
- self.process_mmap()
-@@ -793,6 +793,6 @@
- def sync_out(self):
- try:
- _upload(self)
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError(
- "Failed to communicate with the radio: %s" % e)
---- a/chirp/drivers/th_uv3r25.py
-+++ b/chirp/drivers/th_uv3r25.py
-@@ -22,7 +22,7 @@
- RadioSettingValueInteger, RadioSettingValueList, \
- RadioSettingValueBoolean, RadioSettingValueString
-
--from th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET
-+from chirp.drivers.th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET
-
-
- def tyt_uv3r_download(radio):
---- a/chirp/drivers/th_uv8000.py
-+++ b/chirp/drivers/th_uv8000.py
-@@ -1486,6 +1486,6 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
---- a/chirp/drivers/thd72.py
-+++ b/chirp/drivers/thd72.py
-@@ -581,7 +581,7 @@
- except AttributeError as e:
- LOG.error("Setting %s is not in the memory map: %s" %
- (element.get_name(), e))
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -738,9 +738,9 @@
- return r
-
- def usage():
-- print "Usage: %s <-i input.img>|<-o output.img> -p port " \
-+ print( "Usage: %s <-i input.img>|<-o output.img> -p port " \
- "[[-f first-addr] [-l last-addr] | [-b list,of,blocks]]" % \
-- sys.argv[0]
-+ sys.argv[0] )
- sys.exit(1)
-
- opts, args = getopt.getopt(sys.argv[1:], "i:o:p:f:l:b:")
-@@ -793,4 +793,4 @@
- else:
- r._mmap = file(fname, "rb").read(r._memsize)
- r.upload(blocks)
-- print "\nDone"
-+ print( "\nDone" )
---- a/chirp/drivers/thuv1f.py
-+++ b/chirp/drivers/thuv1f.py
-@@ -214,7 +214,7 @@
- self._mmap = uvf1_download(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
- self.process_mmap()
-
-@@ -223,7 +223,7 @@
- uvf1_upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- @classmethod
---- a/chirp/drivers/tk270.py
-+++ b/chirp/drivers/tk270.py
-@@ -96,7 +96,7 @@
-
- MEM_SIZE = 0x400
- BLOCK_SIZE = 8
--MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE))
-+MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE))
- ACK_CMD = "\x06"
- TIMEOUT = 0.05 # from 0.03 up it' s safe, we set in 0.05 for a margin
-
-@@ -242,7 +242,7 @@
- # UI progress
- status = chirp_common.Status()
- status.cur = 0
-- status.max = MEM_SIZE / BLOCK_SIZE
-+ status.max = MEM_SIZE // BLOCK_SIZE
- status.msg = "Cloning from radio..."
- radio.status_fn(status)
-
-@@ -269,7 +269,7 @@
- # UI progress
- status = chirp_common.Status()
- status.cur = 0
-- status.max = MEM_SIZE / BLOCK_SIZE
-+ status.max = MEM_SIZE // BLOCK_SIZE
- status.msg = "Cloning to radio..."
- radio.status_fn(status)
- count = 0
-@@ -630,7 +630,7 @@
- return
-
- # freq rx
-- _mem.rxfreq = mem.freq / 10
-+ _mem.rxfreq = mem.freq // 10
-
- # rx enabled if valid channel,
- # set tx to on, we decide if off after duplex = off
-@@ -639,9 +639,9 @@
-
- # freq tx
- if mem.duplex == "+":
-- _mem.txfreq = (mem.freq + mem.offset) / 10
-+ _mem.txfreq = (mem.freq + mem.offset) // 10
- elif mem.duplex == "-":
-- _mem.txfreq = (mem.freq - mem.offset) / 10
-+ _mem.txfreq = (mem.freq - mem.offset) // 10
- elif mem.duplex == "off":
- # set tx freq on the memap to xff
- for i in range(0, 4):
-@@ -649,7 +649,7 @@
- # erase the txen flag
- _mem.txen = 255
- else:
-- _mem.txfreq = mem.freq / 10
-+ _mem.txfreq = mem.freq // 10
-
- # tone data
- ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \
---- a/chirp/drivers/tk760.py
-+++ b/chirp/drivers/tk760.py
-@@ -97,7 +97,7 @@
-
- MEM_SIZE = 0x400
- BLOCK_SIZE = 8
--MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE))
-+MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE))
- ACK_CMD = "\x06"
- # from 0.03 up it' s safe
- # I have to turn it up, some users reported problems with this, was 0.05
-@@ -256,7 +256,7 @@
- # UI progress
- status = chirp_common.Status()
- status.cur = 0
-- status.max = MEM_SIZE / BLOCK_SIZE
-+ status.max = MEM_SIZE // BLOCK_SIZE
- status.msg = "Cloning from radio..."
- radio.status_fn(status)
-
-@@ -283,7 +283,7 @@
- # UI progress
- status = chirp_common.Status()
- status.cur = 0
-- status.max = MEM_SIZE / BLOCK_SIZE
-+ status.max = MEM_SIZE // BLOCK_SIZE
- status.msg = "Cloning to radio..."
- radio.status_fn(status)
- count = 0
-@@ -637,18 +637,18 @@
- return
-
- # freq rx
-- _mem.rxfreq = mem.freq / 10
-+ _mem.rxfreq = mem.freq // 10
-
- # freq tx
- if mem.duplex == "+":
-- _mem.txfreq = (mem.freq + mem.offset) / 10
-+ _mem.txfreq = (mem.freq + mem.offset) // 10
- elif mem.duplex == "-":
-- _mem.txfreq = (mem.freq - mem.offset) / 10
-+ _mem.txfreq = (mem.freq - mem.offset) // 10
- elif mem.duplex == "off":
- for byte in _mem.txfreq:
- byte.set_raw("\xFF")
- else:
-- _mem.txfreq = mem.freq / 10
-+ _mem.txfreq = mem.freq // 10
-
- # tone data
- ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \
---- a/chirp/drivers/tk760g.py
-+++ b/chirp/drivers/tk760g.py
-@@ -263,13 +263,13 @@
-
- MEM_SIZE = 0x8000 # 32,768 bytes
- BLOCK_SIZE = 256
--BLOCKS = MEM_SIZE / BLOCK_SIZE
-+BLOCKS = MEM_SIZE // BLOCK_SIZE
- MEM_BLOCKS = range(0, BLOCKS)
-
- # define and empty block of data, as it will be used a lot in this code
- EMPTY_BLOCK = "\xFF" * 256
-
--RO_BLOCKS = range(0x10, 0x1F) + range(0x59, 0x5f)
-+RO_BLOCKS = list(range(0x10, 0x1F)) + list(range(0x59, 0x5f))
- ACK_CMD = "\x06"
-
- POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=1),
-@@ -529,7 +529,7 @@
-
- # reset UI data
- status.cur = 0
-- status.max = MEM_SIZE / 256
-+ status.max = MEM_SIZE // 256
- status.msg = "Cloning from radio..."
- radio.status_fn(status)
-
-@@ -580,7 +580,7 @@
-
- # update UI
- status.cur = 0
-- status.max = MEM_SIZE / 256
-+ status.max = MEM_SIZE // 256
- status.msg = "Cloning to radio..."
- radio.status_fn(status)
-
-@@ -843,7 +843,7 @@
- bdata += (256 - (len(bdata)) % 256) * "\xFF"
-
- # fill to match the whole area
-- bdata += (16 - len(bdata) / 256) * EMPTY_BLOCK
-+ bdata += (16 - len(bdata) // 256) * EMPTY_BLOCK
-
- # updating the data in the memmap [x1000]
- self._fill(0x1000, bdata)
-@@ -907,7 +907,7 @@
- do_upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def process_mmap(self):
-@@ -958,7 +958,7 @@
- """Get the channel scan status from the 16 bytes array on the eeprom
- then from the bits on the byte, return '' or 'S' as needed"""
- result = "S"
-- byte = int(chan/8)
-+ byte = int(chan//8)
- bit = chan % 8
- res = self._memobj.settings.add[byte] & (pow(2, bit))
- if res > 0:
-@@ -968,7 +968,7 @@
-
- def _set_scan(self, chan, value):
- """Set the channel scan status from UI to the mem_map"""
-- byte = int(chan/8)
-+ byte = int(chan//8)
- bit = chan % 8
-
- # get the actual value to see if I need to change anything
-@@ -1086,7 +1086,7 @@
- return
-
- # frequency
-- _mem.rxfreq = mem.freq / 10
-+ _mem.rxfreq = mem.freq // 10
-
- # this are a mistery yet, but so falr there is no impact
- # whit this default values for new channels
-@@ -1096,14 +1096,14 @@
-
- # duplex
- if mem.duplex == "+":
-- _mem.txfreq = (mem.freq + mem.offset) / 10
-+ _mem.txfreq = (mem.freq + mem.offset) // 10
- elif mem.duplex == "-":
-- _mem.txfreq = (mem.freq - mem.offset) / 10
-+ _mem.txfreq = (mem.freq - mem.offset) // 10
- elif mem.duplex == "off":
- for byte in _mem.txfreq:
- byte.set_raw("\xFF")
- else:
-- _mem.txfreq = mem.freq / 10
-+ _mem.txfreq = mem.freq // 10
-
- # tone data
- ((txmode, txtone, txpol), (rxmode, rxtone, rxpol)) = \
---- a/chirp/drivers/ts2000.py
-+++ b/chirp/drivers/ts2000.py
-@@ -217,7 +217,7 @@
- duplex = 0
- offset = 0
- else:
-- print "Bug: unsupported duplex `%s'" % mem.duplex
-+ print( "Bug: unsupported duplex `%s'" % mem.duplex )
- if mem.mode in ["AM", "FM"]:
- step = TS2000_FM_STEPS.index(mem.tuning_step)
- else:
-@@ -259,7 +259,7 @@
- elif mem.duplex == "split":
- duplex = 0
- else:
-- print "Bug: unsupported duplex `%s'" % mem.duplex
-+ print( "Bug: unsupported duplex `%s'" % mem.duplex )
- if mem.mode in ["AM", "FM"]:
- step = TS2000_FM_STEPS.index(mem.tuning_step)
- else:
---- a/chirp/drivers/ts480.py
-+++ b/chirp/drivers/ts480.py
-@@ -1138,7 +1138,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
- return
---- a/chirp/drivers/ts590.py
-+++ b/chirp/drivers/ts590.py
-@@ -1644,7 +1644,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/ts850.py
-+++ b/chirp/drivers/ts850.py
-@@ -26,7 +26,7 @@
- TS850_SKIP = ["", "S"]
-
- TS850_MODES = {
-- "N/A": " ",
-+ "N/A": " ", # why is this here? the line below removes it.
- "N/A": "0",
- "LSB": "1",
- "USB": "2",
-@@ -37,7 +37,7 @@
- "CW-R": "7",
- "FSK-R": "9",
- }
--TS850_MODES_REV = {val: mode for mode, val in TS850_MODES.iteritems()}
-+TS850_MODES_REV = {val: mode for mode, val in TS850_MODES.items()}
-
- TS850_TONES = list(chirp_common.OLD_TONES)
- TS850_TONES.remove(69.3)
---- a/chirp/drivers/uv5r.py
-+++ b/chirp/drivers/uv5r.py
-@@ -587,7 +587,7 @@
- data += _read_block(radio, i, 0x40, False)
-
- if append_model:
-- data += radio.MODEL.ljust(8)
-+ data += radio.MODEL.ljust(8).encode()
-
- LOG.debug("done.")
- return memmap.MemoryMapBytes(data)
---- a/chirp/drivers/uvb5.py
-+++ b/chirp/drivers/uvb5.py
-@@ -209,7 +209,7 @@
- data += (b"\x00" * 16)
- firstack = None
- for i in range(0, 0x1000, 16):
-- frame = struct.pack(">cHB", "R", i, 16)
-+ frame = struct.pack(">cHB", b"R", i, 16)
- radio.pipe.write(frame)
- result = radio.pipe.read(20)
- if frame[1:4] != result[1:4]:
---- a/chirp/drivers/vgc.py
-+++ b/chirp/drivers/vgc.py
-@@ -1410,7 +1410,7 @@
- elif element.value.get_mutable():
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/drivers/vx6.py
-+++ b/chirp/drivers/vx6.py
-@@ -871,5 +871,5 @@
- elif setting == "password":
- newval = self._encode_chars(newval, 4)
- setattr(_settings, setting, newval)
-- except Exception, e:
-+ except Exception as e:
- raise
---- a/chirp/drivers/vxa700.py
-+++ b/chirp/drivers/vxa700.py
-@@ -177,7 +177,7 @@
- self._mmap = _download(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate " +
- "with the radio: %s" % e)
- self.process_mmap()
-@@ -192,7 +192,7 @@
- _upload(self)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate " +
- "with the radio: %s" % e)
-
---- a/chirp/drivers/wouxun.py
-+++ b/chirp/drivers/wouxun.py
-@@ -23,7 +23,7 @@
- RadioSettingValueBoolean, RadioSettingValueList, \
- RadioSettingValueInteger, RadioSettingValueString, \
- RadioSettingValueFloat, RadioSettings
--from wouxun_common import wipe_memory, do_download, do_upload
-+from chirp.drivers.wouxun_common import wipe_memory, do_download, do_upload
- from textwrap import dedent
-
- LOG = logging.getLogger(__name__)
-@@ -274,7 +274,7 @@
- return do_download(self, 0x0000, 0x2000, 0x0040)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def _upload(self):
-@@ -285,7 +285,7 @@
- return do_upload(self, 0x0000, 0x2000, 0x0010)
- except errors.RadioError:
- raise
-- except Exception, e:
-+ except Exception as e:
- raise errors.RadioError("Failed to communicate with radio: %s" % e)
-
- def sync_in(self):
-@@ -658,7 +658,7 @@
- else:
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -680,7 +680,7 @@
- else:
- setting = self._memobj.fm_presets_1
- setting[index] = value
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -690,7 +690,7 @@
- setattr(self._memobj.freq_ranges,
- element.get_name(),
- encode_freq(int(element.value)))
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -1397,7 +1397,7 @@
- else:
- LOG.debug("Setting %s = %s" % (setting, element.value))
- setattr(obj, setting, element.value)
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
-@@ -1419,7 +1419,7 @@
- else:
- setting = self._memobj.fm_presets_1
- setting[index] = value
-- except Exception, e:
-+ except Exception as e:
- LOG.debug(element.get_name())
- raise
-
---- a/chirp/ui/importdialog.py
-+++ b/chirp/ui/importdialog.py
-@@ -50,13 +50,13 @@
-
- def grind(self):
- while gtk.events_pending():
-- gtk.main_iteration(False)
-+ gtk.main_iteration_do(False)
-
- self.prog.pulse()
-
- def set(self, fraction):
- while gtk.events_pending():
-- gtk.main_iteration(False)
-+ gtk.main_iteration_do(False)
-
- self.prog.set_fraction(fraction)
-
-@@ -299,8 +299,6 @@
- self.__view = gtk.TreeView(self.__store)
- self.__view.show()
-
-- tips = gtk.Tooltips()
--
- for k in list(self.caps.keys()):
- t = self.types[k]
-
-@@ -327,7 +325,7 @@
- LOG.debug("Doing %s" % k)
- lab = gtk.Label(self.caps[k])
- column.set_widget(lab)
-- tips.set_tip(lab, self.tips[k])
-+ lab.set_tooltip_text(self.tips[k])
- lab.show()
- column.set_sort_column_id(k)
- self.__view.append_column(column)
-@@ -408,7 +406,8 @@
- inv.show()
- hbox.pack_start(inv, 0, 0, 0)
-
-- frame = gtk.Frame(_("Select"))
-+ frame = gtk.Frame()
-+ frame.set_label("Select")
- frame.show()
- frame.add(hbox)
- hbox.show()
-@@ -466,7 +465,8 @@
- revr.show()
- hbox.pack_start(revr, 0, 0, 0)
-
-- frame = gtk.Frame(_("Adjust New Location"))
-+ frame = gtk.Frame()
-+ frame.set_label("Adjust New Location")
- frame.show()
- frame.add(hbox)
- hbox.show()
---- a/chirp/ui/inputdialog.py
-+++ b/chirp/ui/inputdialog.py
-@@ -101,11 +101,9 @@
- if "buttons" not in kwargs.keys():
- kwargs["buttons"] = (gtk.STOCK_OK, gtk.RESPONSE_OK,
- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
--
- self.__fields = {}
-- self.set_default_response(gtk.RESPONSE_OK)
--
- gtk.Dialog.__init__(self, **kwargs)
-+ self.set_default_response(gtk.RESPONSE_OK)
-
- def response(self, _):
- LOG.debug("Blocking response")
---- a/chirp/ui/mainapp.py
-+++ b/chirp/ui/mainapp.py
-@@ -898,9 +898,9 @@
-
- # Do this in case the import process is going to take a while
- # to make sure we process events leading up to this
-- gtk.gdk.window_process_all_updates()
-+ gtk.gdk.Window.process_all_updates()
- while gtk.events_pending():
-- gtk.main_iteration(False)
-+ gtk.main_iteration_do(False)
-
- if do_import:
- eset = self.get_current_editorset()
-@@ -1030,9 +1030,9 @@
- # Do this in case the import process is going to take a while
- # to make sure we process events leading up to this
- with compat.py3safe():
-- gtk.gdk.window_process_all_updates()
-+ gtk.gdk.Window.process_all_updates()
- while gtk.events_pending():
-- gtk.main_iteration(False)
-+ gtk.main_iteration_do(False)
-
- fn = tempfile.mktemp(".csv")
- try:
-@@ -1137,14 +1137,14 @@
-
- query = "http://chirp.danplanet.com/query/rb/1.0/app_direct" \
- "?loc=%s&band=%s&dist=%s" % (loc, band, dist)
-- print query
-+ print( query )
-
- # Do this in case the import process is going to take a while
- # to make sure we process events leading up to this
- with compat.py3safe():
-- gtk.gdk.window_process_all_updates()
-+ gtk.gdk.Window.process_all_updates()
- while gtk.events_pending():
-- gtk.main_iteration(False)
-+ gtk.main_iteration_do(False)
-
- fn = tempfile.mktemp(".csv")
- try:
-@@ -1316,9 +1316,9 @@
-
- # Do this in case the import process is going to take a while
- # to make sure we process events leading up to this
-- gtk.gdk.window_process_all_updates()
-+ gtk.gdk.Window.process_all_updates()
- while gtk.events_pending():
-- gtk.main_iteration(False)
-+ gtk.main_iteration_do(False)
-
- if do_import:
- eset = self.get_current_editorset()
-@@ -1379,9 +1379,9 @@
-
- # Do this in case the import process is going to take a while
- # to make sure we process events leading up to this
-- gtk.gdk.window_process_all_updates()
-+ gtk.gdk.Window.process_all_updates()
- while gtk.events_pending():
-- gtk.main_iteration(False)
-+ gtk.main_iteration_do(False)
-
- if do_import:
- eset = self.get_current_editorset()
-@@ -1426,7 +1426,8 @@
- os.remove(filen)
-
- count = eset.do_export(filen)
-- reporting.report_model_usage(eset.rthread.radio, "export", count > 0)
-+ success = count > 0 if count is not None else False
-+ reporting.report_model_usage(eset.rthread.radio, "export", success)
-
- def do_about(self):
- d = gtk.AboutDialog()
-@@ -1528,7 +1529,7 @@
- conf = config.get("memedit")
- conf.set_bool("hide_unused", action.get_active())
- else:
-- for editortype, editor in eset.editors.iteritems():
-+ for editortype, editor in eset.editors.items():
- if "memedit" in editortype:
- editor.set_hide_unused(action.get_active())
-
diff --git a/debian/patches/99.patch b/debian/patches/99.patch
new file mode 100644
index 0000000..7c70ade
--- /dev/null
+++ b/debian/patches/99.patch
@@ -0,0 +1,338 @@
+From 83fcd463f0c613d04dddb997891e289213b69f01 Mon Sep 17 00:00:00 2001
+From: Apostolos Kefalas <akef@freemail.gr>
+Date: Sat, 5 Nov 2022 17:50:37 +0200
+Subject: [PATCH 1/3] Fix registration, invalid syntax of ap510 driver
+
+---
+ chirp/drivers/ap510.py | 19 ++++++++++---------
+ tests/Python3_Driver_Testing.md | 7 ++++---
+ 2 files changed, 14 insertions(+), 12 deletions(-)
+
+--- a/chirp/drivers/ap510.py
++++ b/chirp/drivers/ap510.py
+@@ -44,7 +44,7 @@ def decode_base100(u16):
+
+ def drain(pipe):
+ """Chew up any data waiting on @pipe"""
+- for x in xrange(3):
++ for x in range(3):
+ buf = pipe.read(4096)
+ if not buf:
+ return
+@@ -53,7 +53,7 @@ def drain(pipe):
+
+ def enter_setup(pipe):
+ """Put AP510 in configuration mode."""
+- for x in xrange(30):
++ for x in range(30):
+ if x % 2:
+ pipe.write("@SETUP")
+ else:
+@@ -84,7 +84,7 @@ def download(radio):
+ radio.pipe.write("@DISP")
+ buf = ""
+
+- for status.cur in xrange(status.cur, status.max):
++ for status.cur in range(status.cur, status.max):
+ buf += radio.pipe.read(1024)
+ if buf.endswith("\r\n"):
+ status.cur = status.max
+@@ -242,7 +242,7 @@ class AP510Memory(object):
+
+ class AP510Memory20141215(AP510Memory):
+ """Compatible with firmware version 20141215"""
+- ATTR_MAP = dict(AP510Memory.ATTR_MAP.items() + {
++ ATTR_MAP = dict(list(AP510Memory.ATTR_MAP.items()) + list({
+ 'tx_volume': '21', # 1-6
+ 'rx_volume': '22', # 1-9
+ 'tx_power': '23', # 1: 1 watt, 0: 0.5 watt
+@@ -252,7 +252,7 @@ class AP510Memory20141215(AP510Memory):
+ 'path3': '27', # like "WIDE1 1" else "0"
+ 'multiple': '28',
+ 'auto_on': '29',
+- }.items())
++ }.items()))
+
+ def get_multiple(self):
+ return dict(zip(
+@@ -343,13 +343,14 @@ RP_IMMUTABLE = ["number", "skip", "bank"
+ "offset", "mode", "tuning_step", "bank_index"]
+
+
++@directory.register
+ class AP510Radio(chirp_common.CloneModeRadio):
+ """Sainsonic AP510"""
+ BAUD_RATE = 9600
+ VENDOR = "Sainsonic"
+ MODEL = "AP510"
+
+- _model = "AVRT5"
++ _model = b"AVRT5"
+ mem_upper_limit = 0
+
+ def get_features(self):
+@@ -380,7 +381,7 @@ class AP510Radio(chirp_common.CloneModeR
+ data = download(self)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+ # _mmap isn't a Chirp MemoryMap, but since AP510Memory implements
+@@ -398,7 +399,7 @@ class AP510Radio(chirp_common.CloneModeR
+ upload(self)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+ def load_mmap(self, filename):
+@@ -804,4 +805,4 @@ class AP510Radio(chirp_common.CloneModeR
+
+ @classmethod
+ def match_model(cls, filedata, filename):
+- return filedata.startswith('\r\n00=' + cls._model)
++ return filedata.startswith(b'\r\n00=' + cls._model)
+--- a/tests/Python3_Driver_Testing.md
++++ b/tests/Python3_Driver_Testing.md
+@@ -263,6 +263,7 @@
+ | <a name="Retevis_RT95_VOX"></a> Retevis_RT95_VOX | | | Yes |
+ | <a name="Retevis_RT98"></a> Retevis_RT98 | | | |
+ | <a name="Rugged_RH5R-V2"></a> Rugged_RH5R-V2 | | | |
++| <a name="Sainsonic_AP510"></a> Sainsonic_AP510 | | | |
+ | <a name="TDXone_TD-Q8A"></a> TDXone_TD-Q8A | | | |
+ | <a name="TIDRADIO_TD-H6"></a> TIDRADIO_TD-H6 | [@kk7ds](https://github.com/kk7ds) | 21-Oct-2022 | Yes |
+ | <a name="TID_TD-M8"></a> TID_TD-M8 | | | |
+@@ -293,10 +294,12 @@
+ | <a name="Wouxun_KG-UV9D_Plus"></a> Wouxun_KG-UV9D_Plus | | | |
+ | <a name="Yaesu_FT-1500M"></a> Yaesu_FT-1500M | | | Yes |
+ | <a name="Yaesu_FT-1802M"></a> Yaesu_FT-1802M | | | Yes |
++| <a name="Yaesu_FT-1D_R"></a> Yaesu_FT-1D_R | | | Yes |
+ | <a name="Yaesu_FT-25R"></a> Yaesu_FT-25R | | | Yes |
+ | <a name="Yaesu_FT-2800M"></a> Yaesu_FT-2800M | | | Yes |
+ | <a name="Yaesu_FT-2900R_1900R"></a> Yaesu_FT-2900R_1900R | | | Yes |
+ | <a name="Yaesu_FT-2900R_1900RTXMod_Opened_Xmit"></a> Yaesu_FT-2900R_1900RTXMod_Opened_Xmit | | | Yes |
++| <a name="Yaesu_FT-450D"></a> Yaesu_FT-450D | | | Yes |
+ | <a name="Yaesu_FT-4VR"></a> Yaesu_FT-4VR | | | Yes |
+ | <a name="Yaesu_FT-4XE"></a> Yaesu_FT-4XE | | | Yes |
+ | <a name="Yaesu_FT-4XR"></a> Yaesu_FT-4XR | | | Yes |
+@@ -318,7 +321,12 @@
+ | <a name="Yaesu_FT-8800"></a> Yaesu_FT-8800 | [@kk7ds](https://github.com/kk7ds) | 24-Oct-2022 | Yes |
+ | <a name="Yaesu_FT-8900"></a> Yaesu_FT-8900 | | | Yes |
+ | <a name="Yaesu_FT-90"></a> Yaesu_FT-90 | | | Yes |
++| <a name="Yaesu_FT2D_R"></a> Yaesu_FT2D_R | | | Yes |
++| <a name="Yaesu_FT2D_Rv2"></a> Yaesu_FT2D_Rv2 | | | Yes |
++| <a name="Yaesu_FT3D_R"></a> Yaesu_FT3D_R | | | Yes |
++| <a name="Yaesu_FTM-3200D_R"></a> Yaesu_FTM-3200D_R | | | Yes |
+ | <a name="Yaesu_FTM-350"></a> Yaesu_FTM-350 | | | Yes |
++| <a name="Yaesu_FTM-7250D_R"></a> Yaesu_FTM-7250D_R | | | Yes |
+ | <a name="Yaesu_VX-170"></a> Yaesu_VX-170 | | | Yes |
+ | <a name="Yaesu_VX-2"></a> Yaesu_VX-2 | | | Yes |
+ | <a name="Yaesu_VX-3"></a> Yaesu_VX-3 | [@kk7ds](https://github.com/kk7ds) | 15-Feb-2019 | Yes |
+--- a/chirp/drivers/ft1d.py
++++ b/chirp/drivers/ft1d.py
+@@ -558,7 +558,7 @@ class FT1Radio(yaesu_clone.YaesuCloneMod
+ MODEL = "FT-1D"
+ VARIANT = "R"
+
+- _model = "AH44M"
++ _model = b"AH44M"
+ _memsize = 130507
+ _block_lengths = [10, 130497]
+ _block_size = 32
+@@ -698,7 +698,7 @@ class FT1Radio(yaesu_clone.YaesuCloneMod
+
+ @staticmethod
+ def _add_ff_pad(val, length):
+- return val.ljust(length, "\xFF")[:length]
++ return val.ljust(length, b"\xFF")[:length]
+
+ @classmethod
+ def _strip_ff_pads(cls, messages):
+@@ -740,7 +740,8 @@ class FT1Radio(yaesu_clone.YaesuCloneMod
+ return str(mem.label).rstrip("\xFF").translate(charset)
+
+ def _encode_label(self, mem):
+- label = "".join([chr(CHARSET.index(x)) for x in mem.name.rstrip()])
++ label = "".join([chr(CHARSET.index(x))
++ for x in mem.name.rstrip()]).encode()
+ return self._add_ff_pad(label, 16)
+
+ def _encode_charsetbits(self, mem):
+@@ -820,7 +821,7 @@ class FT1Radio(yaesu_clone.YaesuCloneMod
+
+ @classmethod
+ def _wipe_memory(cls, mem):
+- mem.set_raw("\x00" * (mem.size() / 8))
++ mem.set_raw("\x00" * (mem.size() // 8))
+ mem.unknown1 = 0x05
+
+ def get_bank_model(self):
+@@ -1131,7 +1132,8 @@ class FT1Radio(yaesu_clone.YaesuCloneMod
+ checksum = body[-2:]
+ body = ''.join(s for s in body[:-2]
+ if s in string.printable).translate(
+- None, "\x09\x0a\x0b\x0c\x0d")
++ str.maketrans(
++ "", "", "\x09\x0a\x0b\x0c\x0d"))
+ try:
+ val = RadioSettingValueString(0, 134, body.strip())
+ except Exception as e:
+@@ -1890,7 +1892,7 @@ class FT1Radio(yaesu_clone.YaesuCloneMod
+ except AttributeError as e:
+ LOG.error("Setting %s is not in the memory map: %s" %
+ (element.get_name(), e))
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
+
+--- a/chirp/drivers/ft2d.py
++++ b/chirp/drivers/ft2d.py
+@@ -117,7 +117,7 @@ class FT2D(ft1d.FT1Radio):
+ return mem
+
+ def _decode_label(self, mem):
+- return str(mem.label).rstrip("\xFF").decode('ascii', 'replace')
++ return str(mem.label).rstrip("\xFF")
+
+ def _encode_label(self, mem):
+ label = mem.name.rstrip().encode('ascii', 'ignore')
+--- a/chirp/drivers/ftm3200d.py
++++ b/chirp/drivers/ftm3200d.py
+@@ -124,7 +124,7 @@ class FTM3200Radio(ft1d.FT1Radio):
+
+ def _decode_label(self, mem):
+ # TODO preserve the unknown \x80-x86 chars?
+- return str(mem.label).rstrip("\xFF").decode('ascii', 'replace')
++ return str(mem.label).rstrip("\xFF")
+
+ def _encode_label(self, mem):
+ label = mem.name.rstrip().encode('ascii', 'ignore')
+@@ -193,7 +193,7 @@ class FTM3200Radio(ft1d.FT1Radio):
+
+ @classmethod
+ def _wipe_memory(cls, mem):
+- mem.set_raw("\x00" * (mem.size() / 8))
++ mem.set_raw("\x00" * (mem.size() // 8))
+
+ def sync_out(self):
+ # Need to give enough time for the radio to ACK after writes
+--- a/chirp/drivers/ftm7250d.py
++++ b/chirp/drivers/ftm7250d.py
+@@ -125,7 +125,7 @@ class FTM7250Radio(ft1d.FT1Radio):
+
+ def _decode_label(self, mem):
+ # TODO preserve the unknown \x80-x86 chars?
+- return str(mem.label).rstrip("\xFF").decode('ascii', 'replace')
++ return str(mem.label).rstrip("\xFF")
+
+ def _encode_label(self, mem):
+ label = mem.name.rstrip().encode('ascii', 'ignore')
+@@ -194,7 +194,7 @@ class FTM7250Radio(ft1d.FT1Radio):
+
+ @classmethod
+ def _wipe_memory(cls, mem):
+- mem.set_raw("\x00" * (mem.size() / 8))
++ mem.set_raw("\x00" * (mem.size() // 8))
+
+ def sync_out(self):
+ # Need to give enough time for the radio to ACK after writes
+--- a/tests/py3_remaining.txt
++++ b/tests/py3_remaining.txt
+@@ -9,9 +9,3 @@ Wouxun_KG-816.img
+ Wouxun_KG-818.img
+ Wouxun_KG-UV6.img
+ Wouxun_KG-UVD1P.img
+-Yaesu_FT-1D_R.img
+-Yaesu_FT2D_R.img
+-Yaesu_FT3D_R.img
+-Yaesu_FT-450D.img
+-Yaesu_FTM-3200D_R.img
+-Yaesu_FTM-7250D_R.img
+--- a/chirp/drivers/ft450d.py
++++ b/chirp/drivers/ft450d.py
+@@ -305,8 +305,8 @@ class FT450DRadio(yaesu_clone.YaesuClone
+ struct mem_struct current;
+
+ """
+- _CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9") + 1) +
+- range(ord("A"), ord("Z") + 1) + [ord(" ")]]
++ _CALLSIGN_CHARSET = [chr(x) for x in list(range(ord("0"), ord("9") + 1)) +
++ list(range(ord("A"), ord("Z") + 1)) + [ord(" ")]]
+ _CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET,
+ range(0, len(_CALLSIGN_CHARSET))))
+
+@@ -500,7 +500,7 @@ class FT450DRadio(yaesu_clone.YaesuClone
+ self._mmap = self._clone_in()
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s"
+ % e)
+ self.process_mmap()
+@@ -510,7 +510,7 @@ class FT450DRadio(yaesu_clone.YaesuClone
+ self._clone_out()
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s"
+ % e)
+
+@@ -705,18 +705,18 @@ class FT450DRadio(yaesu_clone.YaesuClone
+ if mem.number == 1:
+ raise Exception("Sorry, can't delete first memory")
+ if wasvalid and not wasused:
+- self._memobj.filled[(mem.number - 1) / 8] &= \
++ self._memobj.filled[(mem.number - 1) // 8] &= \
+ ~(1 << (mem.number - 1) % 8)
+- _mem.set_raw("\xFF" * (_mem.size() / 8)) # clean up
+- self._memobj.visible[(mem.number - 1) / 8] &= \
++ _mem.set_raw("\xFF" * (_mem.size() // 8)) # clean up
++ self._memobj.visible[(mem.number - 1) // 8] &= \
+ ~(1 << (mem.number - 1) % 8)
+ return
+ if not wasvalid:
+- _mem.set_raw("\x00" * (_mem.size() / 8)) # clean up
++ _mem.set_raw("\x00" * (_mem.size() // 8)) # clean up
+
+- self._memobj.visible[(mem.number - 1) / 8] |= 1 << (mem.number - 1) \
++ self._memobj.visible[(mem.number - 1) // 8] |= 1 << (mem.number - 1) \
+ % 8
+- self._memobj.filled[(mem.number - 1) / 8] |= 1 << (mem.number - 1) \
++ self._memobj.filled[(mem.number - 1) // 8] |= 1 << (mem.number - 1) \
+ % 8
+ self._set_memory(mem, _mem)
+
+@@ -945,7 +945,7 @@ class FT450DRadio(yaesu_clone.YaesuClone
+ """Match the opened/downloaded image to the correct version"""
+ if len(filedata) == cls.MEM_SIZE + 7: # +7 bytes of model name
+ rid = filedata[cls.MEM_SIZE:cls.MEM_SIZE + 7]
+- if rid.startswith(cls.MODEL):
++ if rid.startswith(cls.MODEL.encode()):
+ return True
+ else:
+ return False
+@@ -959,8 +959,8 @@ class FT450DRadio(yaesu_clone.YaesuClone
+ def _chars2str(self, cary, knt):
+ """Convert raw memory char array to a string: NOT a callback."""
+ stx = ""
+- for char in cary[:knt]:
+- stx += chr(char)
++ for char in cary[0:knt]:
++ stx += chr(int(char))
+ return stx
+
+ def _my_str2ary(self, setting, obj, atrba, knt):
+@@ -1490,6 +1490,6 @@ class FT450DRadio(yaesu_clone.YaesuClone
+ elif element.value.get_mutable():
+ LOG.debug("Setting %s = %s" % (setting, element.value))
+ setattr(obj, setting, element.value)
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
diff --git a/debian/patches/py3 b/debian/patches/py3
new file mode 100644
index 0000000..d968180
--- /dev/null
+++ b/debian/patches/py3
@@ -0,0 +1,232 @@
+--- a/chirp/drivers/bj9900.py
++++ b/chirp/drivers/bj9900.py
+@@ -178,7 +178,7 @@ class BJ9900Radio(chirp_common.CloneMode
+ self._mmap = self._clone_in()
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+ self.process_mmap()
+
+@@ -187,7 +187,7 @@ class BJ9900Radio(chirp_common.CloneMode
+ self._clone_out()
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+ def process_mmap(self):
+--- a/chirp/drivers/lt725uv.py
++++ b/chirp/drivers/lt725uv.py
+@@ -1547,7 +1547,7 @@ class LT725UV(chirp_common.CloneModeRadi
+ elif element.value.get_mutable():
+ LOG.debug("Setting %s = %s" % (setting, element.value))
+ setattr(obj, setting, element.value)
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
+
+--- a/chirp/drivers/puxing.py
++++ b/chirp/drivers/puxing.py
+@@ -47,7 +47,7 @@ def puxing_prep(radio):
+ for _i in range(0, 10):
+ try:
+ return _puxing_prep(radio)
+- except Exception, e:
++ except Exception as e:
+ time.sleep(1)
+
+ raise e
+@@ -60,7 +60,7 @@ def puxing_download(radio):
+ return do_download(radio, 0x0000, 0x0C60, 0x0008)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+
+@@ -71,7 +71,7 @@ def puxing_upload(radio):
+ return do_upload(radio, 0x0000, 0x0C40, 0x0008)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+ POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00),
+@@ -372,7 +372,7 @@ def puxing_2r_download(radio):
+ return do_download(radio, 0x0000, 0x0FE0, 0x0010)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+
+@@ -383,7 +383,7 @@ def puxing_2r_upload(radio):
+ return do_upload(radio, 0x0000, 0x0FE0, 0x0010)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+ PUXING_2R_MEM_FORMAT = """
+--- a/chirp/drivers/rfinder.py
++++ b/chirp/drivers/rfinder.py
+@@ -236,7 +236,7 @@ class RFinderParser:
+ dist = distance(self.__lat, self.__lon, lat, lon)
+ bear = fuzzy_to(self.__lat, self.__lon, lat, lon)
+ mem.comment = "(%imi %s) %s" % (dist, bear, mem.comment)
+- except Exception, e:
++ except Exception as e:
+ LOG.error("Failed to calculate distance: %s" % e)
+
+ return mem
+@@ -254,7 +254,7 @@ class RFinderParser:
+ mem.number = number
+ number += 1
+ self.__memories.append(mem)
+- except Exception, e:
++ except Exception as e:
+ import traceback
+ LOG.error(traceback.format_exc())
+ LOG.error("Error in received data, cannot continue")
+@@ -283,8 +283,9 @@ class RFinderRadio(chirp_common.NetworkS
+
+ self._rfp = None
+
+- def set_params(self, (lat, lon), miles, email, password):
++ def set_params(self, ll, miles, email, password):
+ """Sets the parameters to use for the query"""
++ lat, lon = ll
+ self._lat = lat
+ self._lon = lon
+ self._miles = miles
+--- a/chirp/drivers/wouxun.py
++++ b/chirp/drivers/wouxun.py
+@@ -274,7 +274,7 @@ class KGUVD1PRadio(chirp_common.CloneMod
+ return do_download(self, 0x0000, 0x2000, 0x0040)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+ def _upload(self):
+@@ -285,7 +285,7 @@ class KGUVD1PRadio(chirp_common.CloneMod
+ return do_upload(self, 0x0000, 0x2000, 0x0010)
+ except errors.RadioError:
+ raise
+- except Exception, e:
++ except Exception as e:
+ raise errors.RadioError("Failed to communicate with radio: %s" % e)
+
+ def sync_in(self):
+@@ -658,7 +658,7 @@ class KGUVD1PRadio(chirp_common.CloneMod
+ else:
+ LOG.debug("Setting %s = %s" % (setting, element.value))
+ setattr(obj, setting, element.value)
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
+
+@@ -680,7 +680,7 @@ class KGUVD1PRadio(chirp_common.CloneMod
+ else:
+ setting = self._memobj.fm_presets_1
+ setting[index] = value
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
+
+@@ -690,7 +690,7 @@ class KGUVD1PRadio(chirp_common.CloneMod
+ setattr(self._memobj.freq_ranges,
+ element.get_name(),
+ encode_freq(int(element.value)))
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
+
+@@ -1397,7 +1397,7 @@ class KGUV6DRadio(KGUVD1PRadio):
+ else:
+ LOG.debug("Setting %s = %s" % (setting, element.value))
+ setattr(obj, setting, element.value)
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
+
+@@ -1419,7 +1419,7 @@ class KGUV6DRadio(KGUVD1PRadio):
+ else:
+ setting = self._memobj.fm_presets_1
+ setting[index] = value
+- except Exception, e:
++ except Exception as e:
+ LOG.debug(element.get_name())
+ raise
+
+--- a/chirp/ui/mainapp.py
++++ b/chirp/ui/mainapp.py
+@@ -1434,7 +1434,7 @@ of file.
+ radio = radioreference.RadioReferenceRadio(None)
+ radio.set_params(zipcode, username, passwd, 'US')
+ self.do_open_live(radio, read_only=True)
+- except errors.RadioError, e:
++ except errors.RadioError as e:
+ common.show_error(e)
+
+ self.window.set_cursor(None)
+--- a/rpttool
++++ b/rpttool
+@@ -28,7 +28,7 @@ def open_device():
+ s = serial.Serial(port="/dev/icom",
+ baudrate=idrp.IDRPx000V.BAUD_RATE,
+ timeout=0.1)
+- except Exception, e:
++ except Exception as e:
+ print "Unable to open serial port %s: %s" % ("/dev/icom", e)
+ return None
+
+@@ -44,7 +44,7 @@ def read_freq():
+
+ try:
+ mem = rp.get_memory(0)
+- except Exception, e:
++ except Exception as e:
+ print "Unable to read memory from device: %s" % e
+ return 0
+
+@@ -56,7 +56,7 @@ def read_freq():
+ def _set_freq(rp):
+ try:
+ mem = rp.get_memory(0)
+- except Exception, e:
++ except Exception as e:
+ print "Unable to read memory from device: %s" % e
+ return False
+
+@@ -75,7 +75,7 @@ def _set_freq(rp):
+
+ try:
+ rp.set_memory(mem)
+- except Exception, e:
++ except Exception as e:
+ print "Failed to set frequency to %s: %s" % \
+ (chirp_common.format_freq(mem.freq), e)
+ return False
+@@ -92,7 +92,7 @@ def set_freq():
+
+ try:
+ res = _set_freq(rp)
+- except Exception, e:
++ except Exception as e:
+ print "Unknown error while setting frequency: %s" % e
+ res = False
+
diff --git a/debian/patches/series b/debian/patches/series
index 843f687..b6d5763 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,4 +4,5 @@
05-manpage-updates.patch
07-disable-reporting.patch
08-disable-incorrect-mime-type
-09-adopt-atpage-changes.patch
+99.patch
+py3
diff --git a/debian/rules b/debian/rules
index 49de323..4fda8dc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,6 +3,9 @@
%:
dh $@ --with python3 --buildsystem=pybuild
+override_dh_auto_test:
+ # skip tests until upstream python3 migration is complete
+
execute_after_dh_auto_install:
mv debian/chirp/usr/bin/chirpwx.py debian/chirp/usr/bin/chirpw
find debian/chirp/usr/lib -type f -name debug.log -delete