This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change. ( https://gerrit.osmocom.org/c/libusrp/+/19675 )
Change subject: migrate to python3
......................................................................
migrate to python3
Let's move to python3, it's 2020 and the conversion seemed
actually rather trivial (famous last words).
Change-Id: Ib1604b36c32630e1360e06567cbd5f63a78df547
---
M contrib/libusrp.spec.in
M debian/control
M firmware/include/generate_regs.py
M firmware/src/common/build_eeprom.py
M firmware/src/common/edit-gpif
M firmware/src/usrp2/edit-gpif
6 files changed, 14 insertions(+), 17 deletions(-)
Approvals:
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/contrib/libusrp.spec.in b/contrib/libusrp.spec.in
index 75ceeaa..de4404c 100644
--- a/contrib/libusrp.spec.in
+++ b/contrib/libusrp.spec.in
@@ -29,11 +29,7 @@
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: sdcc
-%if 0%{?suse_version} < 1320
-BuildRequires: python
-%else
-BuildRequires: python2
-%endif
+BuildRequires: python3
BuildRequires: pkgconfig(libusb-1.0)
%if 0%{?suse_version} > 1325
BuildRequires: libboost_date_time-devel
diff --git a/debian/control b/debian/control
index 247a661..cb3b90d 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@
doxygen,
libtool,
pkg-config,
- python,
+ python3,
sdcc,
libusb-1.0-0-dev,
libboost-all-dev
diff --git a/firmware/include/generate_regs.py b/firmware/include/generate_regs.py
index f11baad..7416302 100755
--- a/firmware/include/generate_regs.py
+++ b/firmware/include/generate_regs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
import os, os.path
import re
@@ -8,7 +8,7 @@
# set srcdir to the directory that contains Makefile.am
try:
srcdir = os.environ['srcdir']
-except KeyError, e:
+except KeyError as e:
srcdir = "."
srcdir = srcdir + '/'
diff --git a/firmware/src/common/build_eeprom.py b/firmware/src/common/build_eeprom.py
index 6092d61..435b826 100755
--- a/firmware/src/common/build_eeprom.py
+++ b/firmware/src/common/build_eeprom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
#
# Copyright 2004,2006 Free Software Foundation, Inc.
#
@@ -24,6 +24,7 @@
import sys
import os, os.path
from optparse import OptionParser
+from functools import reduce
# USB Vendor and Product ID's
@@ -33,7 +34,7 @@
def hex_to_bytes (s):
if len (s) & 0x1:
- raise ValueError, "Length must be even"
+ raise ValueError("Length must be even")
r = []
for i in range (0, len(s), 2):
r.append (int (s[i:i+2], 16))
@@ -59,17 +60,17 @@
for line in file:
line = line.strip().upper ()
if not self.pat.match (line):
- raise ValueError, "Invalid hex record format"
+ raise ValueError("Invalid hex record format")
bytes = hex_to_bytes (line[1:])
sum = reduce (lambda x, y: x + y, bytes, 0) % 256
if sum != 0:
- raise ValueError, "Bad hex checksum"
+ raise ValueError("Bad hex checksum")
lenx = bytes[0]
addr = (bytes[1] << 8) + bytes[2]
type = bytes[3]
data = bytes[4:-1]
if lenx != len (data):
- raise ValueError, "Invalid hex record (bad length)"
+ raise ValueError("Invalid hex record (bad length)")
if type != 0:
break;
r.append (ihx_rec (addr, type, data))
@@ -83,7 +84,7 @@
f = open (filename, 'r')
ifx = ihx_file ()
r = ifx.read (f)
- r.sort (lambda a,b: a.addr - b.addr)
+ r.sort (key=lambda a: a.addr)
code_start = r[0].addr
code_end = r[-1].addr + len (r[-1].data)
code_len = code_end - code_start
@@ -153,7 +154,7 @@
i2c_addr = 0x50
rom_addr = 0x00
- hex_image = map (lambda x : "%02x" % (x,), image)
+ hex_image = ["%02x" % (x,) for x in image]
while (len (hex_image) > 0):
l = min (len (hex_image), 16)
diff --git a/firmware/src/common/edit-gpif b/firmware/src/common/edit-gpif
index 87e16eb..1a63791 100755
--- a/firmware/src/common/edit-gpif
+++ b/firmware/src/common/edit-gpif
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- Python -*-
#
# Copyright 2003 Free Software Foundation, Inc.
diff --git a/firmware/src/usrp2/edit-gpif b/firmware/src/usrp2/edit-gpif
index 87e16eb..1a63791 100755
--- a/firmware/src/usrp2/edit-gpif
+++ b/firmware/src/usrp2/edit-gpif
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- Python -*-
#
# Copyright 2003 Free Software Foundation, Inc.
--
To view, visit https://gerrit.osmocom.org/c/libusrp/+/19675
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libusrp
Gerrit-Branch: master
Gerrit-Change-Id: Ib1604b36c32630e1360e06567cbd5f63a78df547
Gerrit-Change-Number: 19675
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: roox <mardnh at gmx.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211112/f7bcd54f/attachment.htm>