support build with python3
authorJérémy Lal <kapouer@melix.org>
Sat, 8 Aug 2020 12:09:43 +0000 (13:09 +0100)
committerJérémy Lal <kapouer@melix.org>
Sat, 8 Aug 2020 12:09:43 +0000 (13:09 +0100)
Forwarded: not-needed
Last-Update: 2020-08-08

Gbp-Pq: Name python3.patch

configure
test/parallel/test-child-process-set-blocking.js
test/pummel/test-child-process-spawn-loop.js

index 9156e13f7aed0dad68fc3f89a94f12a33d4525c8..440938b0448b8556986bd820f315729ddb7991b1 100755 (executable)
--- a/configure
+++ b/configure
@@ -4,7 +4,7 @@
 # mix of single and double quotes is intentional, as is the fact that
 # the ] goes on a new line.
 _=[ 'exec' '/bin/sh' '-c' '''
-which python2.7 >/dev/null && exec python2.7 "$0" "$@"
+which python3 >/dev/null && exec python3 "$0" "$@"
 which python2 >/dev/null && exec python2 "$0" "$@"
 exec python "$0" "$@"
 ''' "$0" "$@"
@@ -13,16 +13,5 @@ del _
 
 import sys
 from distutils.spawn import find_executable as which
-if sys.version_info[:2] != (2, 7):
-  sys.stderr.write('Please use Python 2.7')
-
-  python2 = which('python2') or which('python2.7')
-
-  if python2:
-    sys.stderr.write(':\n\n')
-    sys.stderr.write('  ' + python2 + ' ' + ' '.join(sys.argv))
-
-  sys.stderr.write('\n')
-  sys.exit(1)
 
 import configure
index b78b71e545b004d5cbec6ad04b7e92b3c0e13f43..1db27ca6ca57c5cde3d29ba16db50dc22ba12bfe 100644 (file)
@@ -26,7 +26,8 @@ const ch = require('child_process');
 
 const SIZE = 100000;
 
-const cp = ch.spawn('python', ['-c', `print(${SIZE} * "C")`], {
+const python = process.env.PYTHON || 'python';
+const cp = ch.spawn(python, ['-c', `print(${SIZE} * "C")`], {
   stdio: 'inherit'
 });
 
index f6d8207df85b9b2acc1fd826aa9d855618549ca4..b7df0b6e470f5115a5a4ac52b806c6b642331e86 100644 (file)
@@ -30,7 +30,8 @@ const N = 40;
 let finished = false;
 
 function doSpawn(i) {
-  const child = spawn('python', ['-c', `print ${SIZE} * "C"`]);
+  const python = process.env.PYTHON || 'python';
+  const child = spawn(python, ['-c', `print ${SIZE} * "C"`]);
   let count = 0;
 
   child.stdout.setEncoding('ascii');