projects
/
openwrt
/
staging
/
lynxis.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
scripts/dl_github_archive.py: convert to Python 3 with 2-to-3
[openwrt/staging/lynxis.git]
/
scripts
/
dl_github_archive.py
diff --git
a/scripts/dl_github_archive.py
b/scripts/dl_github_archive.py
index 4bb7d131bb8303e397649fddbf63e1df96b20b18..671a7acfacdcc88f0456ed4ea29b22788069895a 100755
(executable)
--- a/
scripts/dl_github_archive.py
+++ b/
scripts/dl_github_archive.py
@@
-1,4
+1,4
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
#
# Copyright (c) 2018 Yousong Zhou <yszhou4tech@gmail.com>
#
#
# Copyright (c) 2018 Yousong Zhou <yszhou4tech@gmail.com>
#
@@
-20,7
+20,7
@@
import ssl
import subprocess
import sys
import time
import subprocess
import sys
import time
-import urllib
2
+import urllib
.request
TMPDIR = os.environ.get('TMP_DIR') or '/tmp'
TMPDIR_DL = os.path.join(TMPDIR, 'dl')
TMPDIR = os.environ.get('TMP_DIR') or '/tmp'
TMPDIR_DL = os.path.join(TMPDIR, 'dl')
@@
-194,7
+194,7
@@
class GitHubCommitTsCache(object):
self.cache[k] = (ts, updated)
def _cache_flush(self, fout):
self.cache[k] = (ts, updated)
def _cache_flush(self, fout):
- cache = sorted(self.cache.ite
ritems(), cmp=lambda a, b: b[1][1] -
a[1][1])
+ cache = sorted(self.cache.ite
ms(), key=lambda a:
a[1][1])
cache = cache[:self.__cachen]
self.cache = {}
os.ftruncate(fout.fileno(), 0)
cache = cache[:self.__cachen]
self.cache = {}
os.ftruncate(fout.fileno(), 0)
@@
-397,9
+397,9
@@
class DownloadGitHubTarball(object):
'Accept': 'application/vnd.github.v3+json',
'User-Agent': 'OpenWrt',
}
'Accept': 'application/vnd.github.v3+json',
'User-Agent': 'OpenWrt',
}
- req = urllib
2
.Request(url, headers=headers)
+ req = urllib
.request
.Request(url, headers=headers)
sslcontext = ssl._create_unverified_context()
sslcontext = ssl._create_unverified_context()
- fileobj = urllib
2
.urlopen(req, context=sslcontext)
+ fileobj = urllib
.request
.urlopen(req, context=sslcontext)
return fileobj
def _error(self, msg):
return fileobj
def _error(self, msg):