1 From 651e39dee8605995b736b6056c6f7dc5c5a9c948 Mon Sep 17 00:00:00 2001
2 From: Johannes Berg <johannes.berg@intel.com>
3 Date: Thu, 22 Aug 2019 21:46:27 +0200
4 Subject: [PATCH] regdb: fix compatibility with python2
6 Various changes in the commit mentioned below broke
7 compatibility with python2. Restore it in a way that
8 makes it worth with both versions.
10 Fixes: f3c4969c2485 ("wireless-regdb: make scripts compatible with Python 3")
11 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
17 3 files changed, 3 insertions(+), 4 deletions(-)
21 @@ -118,7 +118,7 @@ reg_country_ptr.set()
22 for alpha2 in countrynames:
23 coll = countries[alpha2]
24 # struct regdb_file_reg_country
25 - output.write(struct.pack('>BBxBI', alpha2[0], alpha2[1], coll.dfs_region, reg_rules_collections[coll.permissions]))
26 + output.write(struct.pack('>2sxBI', alpha2, coll.dfs_region, reg_rules_collections[coll.permissions]))
32 @@ -85,7 +85,7 @@ countrynames = list(countries)
34 for alpha2 in countrynames:
35 coll = countries[alpha2]
36 - output.write(struct.pack('>BB', alpha2[0], alpha2[1]))
37 + output.write(struct.pack('>2s', alpha2))
38 country_ptrs[alpha2] = PTR(output)
39 output.write(b'\x00' * 4)
46 -from builtins import bytes
47 from functools import total_ordering
49 from math import ceil, log
50 @@ -359,7 +358,7 @@ class DBParser(object):
53 self._warn("country '%s' not alpha2" % cname)
54 - cname = bytes(cname, 'ascii')
55 + cname = cname.encode('ascii')
56 if not cname in self._countries:
57 self._countries[cname] = Country(dfs_region, comments=self._comments)
58 self._current_countries[cname] = self._countries[cname]