Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 31c50e5

Browse filesBrowse files
cclausstargos
authored andcommitted
tools: make nodedownload.py Python 3 compatible
PR-URL: #29104 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 9057814 commit 31c50e5
Copy full SHA for 31c50e5

File tree

Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Open diff view settings
Collapse file

‎tools/configure.d/nodedownload.py‎

Copy file name to clipboardExpand all lines: tools/configure.d/nodedownload.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@
22
# Moved some utilities here from ../../configure
33

44
from __future__ import print_function
5-
import urllib
65
import hashlib
76
import sys
87
import zipfile
98
import tarfile
10-
import fpformat
119
import contextlib
10+
try:
11+
from urllib.request import FancyURLopener, URLopener
12+
except ImportError:
13+
from urllib import FancyURLopener, URLopener
1214

1315
def formatSize(amt):
1416
"""Format a size as a string in MB"""
15-
return fpformat.fix(amt / 1024000., 1)
17+
return "%.1f" % (amt / 1024000.)
1618

1719
def spin(c):
1820
"""print out an ASCII 'spinner' based on the value of counter 'c'"""
1921
spin = ".:|'"
2022
return (spin[c % len(spin)])
2123

22-
class ConfigOpener(urllib.FancyURLopener):
24+
class ConfigOpener(FancyURLopener):
2325
"""fancy opener used by retrievefile. Set a UA"""
2426
# append to existing version (UA)
25-
version = '%s node.js/configure' % urllib.URLopener.version
27+
version = '%s node.js/configure' % URLopener.version
2628

2729
def reporthook(count, size, total):
2830
"""internal hook used by retrievefile"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.