summaryrefslogblamecommitdiff
path: root/user/node/python3.patch
blob: dca32c7e4ec02167ae8fbafd28613d1a6300bf6e (plain) (tree)


































































































































































                                                                                                            
--- node-v10.15.3/tools/configure.d/nodedownload.py	(original)
+++ node-v10.15.3/tools/configure.d/nodedownload.py	(refactored)
@@ -1,7 +1,10 @@
 #!/usr/bin/env python
 # Moved some utilities here from ../../configure
 
+try:
-import urllib
+    import urllib
+except ImportError:
+    import urllib.request, urllib.parse, urllib.error
 import hashlib
 import sys
 import zipfile
@@ -18,10 +18,10 @@
     spin = ".:|'"
     return (spin[c % len(spin)])
 
-class ConfigOpener(urllib.FancyURLopener):
+class ConfigOpener(urllib.request.FancyURLopener):
     """fancy opener used by retrievefile. Set a UA"""
     # append to existing version (UA)
-    version = '%s node.js/configure' % urllib.URLopener.version
+    version = '%s node.js/configure' % urllib.request.URLopener.version
 
 def reporthook(count, size, total):
     """internal hook used by retrievefile"""
@@ -36,10 +36,10 @@
         sys.stdout.write(' <%s>\nConnecting...\r' % url)
         sys.stdout.flush()
         ConfigOpener().retrieve(url, targetfile, reporthook=reporthook)
-        print ''  # clear the line
+        print('')  # clear the line
         return targetfile
     except:
-        print ' ** Error occurred while downloading\n <%s>' % url
+        print(' ** Error occurred while downloading\n <%s>' % url)
         raise
 
 def md5sum(targetfile):
@@ -56,12 +56,12 @@
     """Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path"""
     if zipfile.is_zipfile(packedfile):
         with contextlib.closing(zipfile.ZipFile(packedfile, 'r')) as icuzip:
-            print ' Extracting zipfile: %s' % packedfile
+            print(' Extracting zipfile: %s' % packedfile)
             icuzip.extractall(parent_path)
             return parent_path
     elif tarfile.is_tarfile(packedfile):
         with contextlib.closing(tarfile.TarFile.open(packedfile, 'r')) as icuzip:
-            print ' Extracting tarfile: %s' % packedfile
+            print(' Extracting tarfile: %s' % packedfile)
             icuzip.extractall(parent_path)
             return parent_path
     else:
@@ -112,16 +112,16 @@
         theRet[anOpt] = True
       else:
         # future proof: ignore unknown types
-        print 'Warning: ignoring unknown --download= type "%s"' % anOpt
+        print('Warning: ignoring unknown --download= type "%s"' % anOpt)
   # all done
   return theRet
 
 def candownload(auto_downloads, package):
-  if not (package in auto_downloads.keys()):
+  if not (package in list(auto_downloads.keys())):
     raise Exception('Internal error: "%s" is not in the --downloads list. Check nodedownload.py' % package)
   if auto_downloads[package]:
     return True
   else:
-    print """Warning: Not downloading package "%s". You could pass "--download=all"
-    (Windows: "download-all") to try auto-downloading it.""" % package
+    print("""Warning: Not downloading package "%s". You could pass "--download=all"
+    (Windows: "download-all") to try auto-downloading it.""" % package)
     return False
--- node-v10.15.3/tools/configure.d/nodedownload.py.old	2019-04-02 00:56:07.533200475 +0000
+++ node-v10.15.3/tools/configure.d/nodedownload.py	2019-04-02 00:58:09.019947842 +0000
@@ -6,12 +6,11 @@
 import sys
 import zipfile
 import tarfile
-import fpformat
 import contextlib
 
 def formatSize(amt):
     """Format a size as a string in MB"""
-    return fpformat.fix(amt / 1024000., 1)
+    return "%{size}.1f" % (amt / 1024000.)
 
 def spin(c):
     """print out an ASCII 'spinner' based on the value of counter 'c'"""
--- node-v10.15.3/configure.py.old	2019-03-05 15:16:24.000000000 +0000
+++ node-v10.15.3/configure.py	2019-04-02 01:09:04.948394534 +0000
@@ -649,8 +649,8 @@
   except OSError:
     return (False, False, '', '')
 
-  proc.stdin.write('__clang__ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ '
-                   '__clang_major__ __clang_minor__ __clang_patchlevel__')
+  proc.stdin.write(b'__clang__ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ '
+                   b'__clang_major__ __clang_minor__ __clang_patchlevel__')
 
   values = (proc.communicate()[0].split() + ['0'] * 7)[0:7]
   is_clang = values[0] == '1'
@@ -727,7 +727,7 @@
        consider adjusting the CC environment variable if you installed
        it in a non-standard prefix.''')
 
-  gas_ret = proc.communicate()[1]
+  gas_ret = proc.communicate()[1].decode('utf-8')
   match = re.match(r"GNU assembler version ([2-9]\.[0-9]+)", gas_ret)
 
   if match:
@@ -794,7 +794,7 @@
        consider adjusting the CC environment variable if you installed
        it in a non-standard prefix.''')
 
-  p.stdin.write('\n')
+  p.stdin.write(b'\n')
   out = p.communicate()[0]
 
   out = str(out).split('\n')
@@ -1351,7 +1351,7 @@
     o['variables']['icu_small'] = b(True)
     locs = set(options.with_icu_locales.split(','))
     locs.add('root')  # must have root
-    o['variables']['icu_locales'] = string.join(locs,',')
+    o['variables']['icu_locales'] = ','.join(locs)
     # We will check a bit later if we can use the canned deps/icu-small
   elif with_intl == 'full-icu':
     # full ICU
@@ -1655,7 +1655,7 @@
 if options.prefix:
   config['PREFIX'] = options.prefix
 
-config = '\n'.join(map('='.join, config.iteritems())) + '\n'
+config = '\n'.join(map('='.join, config.items())) + '\n'
 
 # On Windows there's no reason to search for a different python binary.
 bin_override = None if sys.platform == 'win32' else make_bin_override()
--- node-v10.15.3/configure.py.old	2019-04-02 01:12:29.786049396 +0000
+++ node-v10.15.3/configure.py	2019-04-02 01:21:08.499637208 +0000
@@ -634,7 +634,7 @@
       proc = subprocess.Popen(
           shlex.split(pkg_config) + ['--silence-errors', flag, pkg],
           stdout=subprocess.PIPE)
-      val = proc.communicate()[0].strip()
+      val = proc.communicate()[0].strip().decode('utf-8')
     except OSError as e:
       if e.errno != errno.ENOENT: raise e  # Unexpected error.
       return (None, None, None, None)  # No pkg-config/pkgconf installed.
--- node-v10.15.3/configure.py.old	2019-04-02 01:27:36.437454388 +0000
+++ node-v10.15.3/configure.py	2019-04-02 01:28:06.954136125 +0000
@@ -795,7 +795,7 @@
        it in a non-standard prefix.''')
 
   p.stdin.write(b'\n')
-  out = p.communicate()[0]
+  out = p.communicate()[0].decode('utf-8')
 
   out = str(out).split('\n')