diff --git a/.travis.yml b/.travis.yml index 5703bfa01d..a427558393 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ matrix: python: 3.7 before_install: nvm install 12 allow_failures: + - os: osx - os: windows install: #- pip install -r requirements.txt diff --git a/lib/configure.js b/lib/configure.js index 530b9b6357..39f36a4e8d 100644 --- a/lib/configure.js +++ b/lib/configure.js @@ -385,7 +385,7 @@ PythonFinder.prototype = { log: logWithPrefix(log, 'find Python'), argsExecutable: [ '-c', 'import sys; print(sys.executable);' ], argsVersion: [ '-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);' ], - semverRange: '>=2.6.0 <3.0.0', + semverRange: '>=2.7.0 <3.0.0', // These can be overridden for testing: execFile: cp.execFile, diff --git a/test/test-find-python.js b/test/test-find-python.js index 23dddc7bfb..b43f7297dc 100644 --- a/test/test-find-python.js +++ b/test/test-find-python.js @@ -58,7 +58,7 @@ test('find python - python', function (t) { poison(f, 'execFile') t.strictEqual(program, '/path/python') t.ok(/sys\.version_info/.test(args[1])) - cb(null, '2.7.15') + cb(null, '3.6.7') } t.strictEqual(program, process.platform === 'win32' ? '"python"' : 'python') @@ -102,7 +102,7 @@ test('find python - python too new', function (t) { if (/sys\.executable/.test(args[args.length - 1])) { cb(null, '/path/python') } else if (/sys\.version_info/.test(args[args.length - 1])) { - cb(null, '3.0.0') + cb(null, '3.8.0') } else { t.fail() } @@ -136,19 +136,19 @@ test('find python - no python', function (t) { } }) -test('find python - no python2', function (t) { +test('find python - no python3', function (t) { t.plan(2) var f = new TestPythonFinder(null, done) f.execFile = function (program, args, opts, cb) { if (/sys\.executable/.test(args[args.length - 1])) { - if (program === 'python2') { + if (program === 'python3') { cb(new Error('not found')) } else { cb(null, '/path/python') } } else if (/sys\.version_info/.test(args[args.length - 1])) { - cb(null, '2.7.14') + cb(null, '3.6.7') } else { t.fail() } @@ -161,7 +161,7 @@ test('find python - no python2', function (t) { } }) -test('find python - no python2, no python, unix', function (t) { +test('find python - no python3, no python, unix', function (t) { t.plan(2) var f = new TestPythonFinder(null, done) @@ -199,7 +199,7 @@ test('find python - no python, use python launcher', function (t) { cb(new Error('not found')) } else if (/sys\.version_info/.test(args[args.length - 1])) { if (program === 'Z:\\snake.exe') { - cb(null, '2.7.14') + cb(null, '3.6.7') } else { t.fail() } @@ -226,7 +226,7 @@ test('find python - python 3, use python launcher', function (t) { f.execFile = function (program, args, opts, cb) { poison(f, 'execFile') if (/sys\.version_info/.test(args[args.length - 1])) { - cb(null, '2.7.14') + cb(null, '3.6.7') } else { t.fail() } @@ -238,7 +238,7 @@ test('find python - python 3, use python launcher', function (t) { if (/sys\.executable/.test(args[args.length - 1])) { cb(null, '/path/python') } else if (/sys\.version_info/.test(args[args.length - 1])) { - cb(null, '3.0.0') + cb(null, '3.8.0') } else { t.fail() } @@ -288,6 +288,16 @@ test('find python - python 3, use python launcher, python 2 too old', } else { t.fail() } + t.notEqual(args.indexOf('-2'), -1) + t.notEqual(args.indexOf('-c'), -1) + return cb(null, 'Z:\\snake.exe') + } + if (/sys\.executable/.test(args[args.length-1])) { + cb(null, '/path/python') + } else if (/sys\.version_info/.test(args[args.length-1])) { + cb(null, '3.8.0') + } else { + t.fail() } f.findPython() @@ -310,7 +320,7 @@ test('find python - no python, no python launcher, good guess', function (t) { poison(f, 'execFile') t.ok(re.test(program)) t.ok(/sys\.version_info/.test(args[args.length - 1])) - cb(null, '2.7.14') + cb(null, '3.6.7') } return cb(new Error('not found')) }