summaryrefslogtreecommitdiff
path: root/debian/patches/remove-future.patch
blob: 553775b8ab061c9f0b6895ff87b876778ed5647e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Description: Replacement for python3-future.
Author: Yogeswaran Umasankar <kd8mbd@gmail.com>
Last-Update: 2024-01-19

--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,6 @@ six
 wxPython>=4.0,<4.2.0 ; platform_system=="Linux" # See https://github.com/wxWidgets/Phoenix/issues/2225
 wxPython==4.2.0 ; platform_system!="Linux"
 pyserial
-future
 requests
 pywin32; platform_system=="Windows"
 suds
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,6 @@ setup(name='chirp',
           'pyserial',
           'requests',
           'six',
-          'future',
           'importlib-resources;python_version<"3.10"',
           'yattag',
       ],
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -5,7 +5,6 @@ pytest-html
 six
 pep8
 pyserial
-future
 requests
 pyyaml
 pywin32; platform_system=="Windows"
--- a/chirp/chirp_common.py
+++ b/chirp/chirp_common.py
@@ -14,7 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from builtins import bytes
-from future import standard_library
+#from future import standard_library
 
 import base64
 import json
@@ -1959,17 +1959,19 @@ def http_user_agent():
 def urlretrieve(url, fn):
     """Grab an URL and save it in a specified file"""
 
-    standard_library.install_aliases()
+    #standard_library.install_aliases()
     import urllib.request
-    import urllib.error
+    from urllib.error import URLError, HTTPError
 
     headers = {
         'User-Agent': http_user_agent(),
     }
     req = urllib.request.Request(url, headers=headers)
-    resp = urllib.request.urlopen(req)
-    with open(fn, 'wb') as f:
-        f.write(resp.read())
+
+    try:
+        urllib.request.urlretrieve(req, fn)
+    except (URLError, HTTPError) as e:
+        print(f"Error downloading {url}: {e}")
 
 
 def mem_from_text(text):