From f7a28c34c9622a7e1fadea51673924386423d569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Tue, 23 Jul 2019 16:29:17 +0100 Subject: [PATCH] lib: accept Python 3 by default PR-URL: https://github.com/nodejs/node-gyp/pull/1844 --- .travis.yml | 15 +++++---------- lib/find-python.js | 10 +++++++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab77f250af..fdac5dc74c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,25 +31,25 @@ matrix: - name: "Node.js 6 & Python 3.7 on Linux" python: 3.7 - env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + env: NODE_GYP_FORCE_PYTHON=python3 before_install: nvm install 6 - name: "Node.js 8 & Python 3.7 on Linux" python: 3.7 - env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + env: NODE_GYP_FORCE_PYTHON=python3 before_install: nvm install 8 - name: "Node.js 10 & Python 3.7 on Linux" python: 3.7 - env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + env: NODE_GYP_FORCE_PYTHON=python3 before_install: nvm install 10 - name: "Node.js 12 & Python 3.7 on Linux" python: 3.7 - env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + env: NODE_GYP_FORCE_PYTHON=python3 before_install: nvm install 12 - name: "Python 3.7 on macOS" os: osx #osx_image: xcode11 language: shell # 'language: python' is not yet supported on macOS - env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 + env: NODE_GYP_FORCE_PYTHON=python3 before_install: HOMEBREW_NO_AUTO_UPDATE=1 brew install npm - name: "Node.js 12 & Python 3.7 on Windows" os: windows @@ -58,12 +58,7 @@ matrix: env: >- PATH=/c/Python37:/c/Python37/Scripts:$PATH NODE_GYP_FORCE_PYTHON=/c/Python37/python.exe - EXPERIMENTAL_NODE_GYP_PYTHON3=1 before_install: choco install python - - allow_failures: - - os: osx - env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1 install: #- pip install -r requirements.txt - pip install flake8 # pytest # add another testing frameworks later diff --git a/lib/find-python.js b/lib/find-python.js index 30bb25fd36..bd7cb850ee 100644 --- a/lib/find-python.js +++ b/lib/find-python.js @@ -18,8 +18,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: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0' - : '>=2.7.0 <3.0.0', + semverRange: '2.7.x || >=3.5.0', // These can be overridden for testing: execFile: cp.execFile, @@ -93,6 +92,11 @@ PythonFinder.prototype = { check: this.checkCommand, arg: 'python' }, + { + before: () => { this.addLog('checking if "python3" can be used') }, + check: this.checkCommand, + arg: 'python3' + }, { before: () => { this.addLog('checking if "python2" can be used') }, check: this.checkCommand, @@ -286,7 +290,7 @@ PythonFinder.prototype = { // X const info = [ '**********************************************************', - 'You need to install the latest version of Python 2.7.', + 'You need to install the latest version of Python.', 'Node-gyp should be able to find and use Python. If not,', 'you can try one of the following options:', `- Use the switch --python="${pathExample}"`,