summaryrefslogtreecommitdiffstats
path: root/external/meta-openembedded/meta-networking/recipes-connectivity/openconnect/openconnect/0001-trojans-tncc-wrapper.py-convert-to-python3.patch
blob: 623ec101d3412963ad17646972372c890841696d (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
71
From de78bcac5e1fd13de0371c8e14b062b8786ade56 Mon Sep 17 00:00:00 2001
From: Max Krummenacher <max.krummenacher@toradex.com>
Date: Sun, 2 Feb 2020 15:53:05 +0000
Subject: [PATCH] trojans/tncc-wrapper.py: convert to python3

Use 2to3 to convert the script to python3.

Upstream-Status: Pending

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
---
 trojans/tncc-wrapper.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/trojans/tncc-wrapper.py b/trojans/tncc-wrapper.py
index 0d4587bf..1a9a1f4d 100755
--- a/trojans/tncc-wrapper.py
+++ b/trojans/tncc-wrapper.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 
 # Lifted from Russ Dill's juniper-vpn-wrap.py, thus:
 #
@@ -18,19 +18,19 @@
 
 import subprocess
 import mechanize
-import cookielib
+import http.cookiejar
 import getpass
 import sys
 import os
 import zipfile
-import urllib
+import urllib.request, urllib.parse, urllib.error
 import socket
 import ssl
 import errno
 import argparse
 import atexit
 import signal
-import ConfigParser
+import configparser
 import time
 import binascii
 import hmac
@@ -39,7 +39,7 @@ import hashlib
 def mkdir_p(path):
     try:
         os.mkdir(path)
-    except OSError, exc:
+    except OSError as exc:
         if exc.errno == errno.EEXIST and os.path.isdir(path):
             pass
         else:
@@ -64,9 +64,9 @@ class Tncc:
             if zipfile.ZipFile(self.tncc_jar, 'r').testzip() is not None:
                 raise Exception()
         except:
-            print 'Downloading tncc.jar...'
+            print('Downloading tncc.jar...')
             mkdir_p(os.path.expanduser('~/.juniper_networks'))
-            urllib.urlretrieve('https://' + self.vpn_host
+            urllib.request.urlretrieve('https://' + self.vpn_host
                                + '/dana-cached/hc/tncc.jar', self.tncc_jar)
 
         with zipfile.ZipFile(self.tncc_jar, 'r') as jar:
-- 
2.20.1