Skip to content

Commit 3d1c60a

Browse files
committed
lib: accept Python 3 by default
PR-URL: #1844 Reviewed-By: Christian Clauss <cclauss@me.com>
1 parent 8e9ec3b commit 3d1c60a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ matrix:
3131

3232
- name: "Node.js 6 & Python 3.7 on Linux"
3333
python: 3.7
34-
env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1
34+
env: NODE_GYP_FORCE_PYTHON=python3
3535
before_install: nvm install 6
3636
- name: "Node.js 8 & Python 3.7 on Linux"
3737
python: 3.7
38-
env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1
38+
env: NODE_GYP_FORCE_PYTHON=python3
3939
before_install: nvm install 8
4040
- name: "Node.js 10 & Python 3.7 on Linux"
4141
python: 3.7
42-
env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1
42+
env: NODE_GYP_FORCE_PYTHON=python3
4343
before_install: nvm install 10
4444
- name: "Node.js 12 & Python 3.7 on Linux"
4545
python: 3.7
46-
env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1
46+
env: NODE_GYP_FORCE_PYTHON=python3
4747
before_install: nvm install 12
4848
- name: "Python 3.7 on macOS"
4949
os: osx
5050
#osx_image: xcode11
5151
language: shell # 'language: python' is not yet supported on macOS
52-
env: NODE_GYP_FORCE_PYTHON=python3 EXPERIMENTAL_NODE_GYP_PYTHON3=1
52+
env: NODE_GYP_FORCE_PYTHON=python3
5353
before_install: HOMEBREW_NO_AUTO_UPDATE=1 brew install npm
5454
- name: "Node.js 12 & Python 3.7 on Windows"
5555
os: windows
@@ -58,7 +58,6 @@ matrix:
5858
env: >-
5959
PATH=/c/Python37:/c/Python37/Scripts:$PATH
6060
NODE_GYP_FORCE_PYTHON=/c/Python37/python.exe
61-
EXPERIMENTAL_NODE_GYP_PYTHON3=1
6261
before_install: choco install python
6362

6463
install:
@@ -71,6 +70,7 @@ before_script:
7170
# exit-zero treats all errors as warnings. Two space indentation is OK. The GitHub editor is 127 chars wide
7271
- flake8 . --count --exit-zero --ignore=E111,E114,W503 --max-complexity=10 --max-line-length=127 --statistics
7372
- npm install
73+
- npm list
7474
script:
7575
- node -e 'require("npmlog").level="verbose"; require("./lib/find-python")(null,()=>{})'
7676
- npm test

lib/find-python.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ PythonFinder.prototype = {
1818
log: logWithPrefix(log, 'find Python'),
1919
argsExecutable: [ '-c', 'import sys; print(sys.executable);' ],
2020
argsVersion: [ '-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);' ],
21-
semverRange: process.env.EXPERIMENTAL_NODE_GYP_PYTHON3 ? '2.7.x || >=3.5.0'
22-
: '>=2.7.0 <3.0.0',
21+
semverRange: '2.7.x || >=3.5.0',
2322

2423
// These can be overridden for testing:
2524
execFile: cp.execFile,
@@ -93,6 +92,11 @@ PythonFinder.prototype = {
9392
check: this.checkCommand,
9493
arg: 'python'
9594
},
95+
{
96+
before: () => { this.addLog('checking if "python3" can be used') },
97+
check: this.checkCommand,
98+
arg: 'python3'
99+
},
96100
{
97101
before: () => { this.addLog('checking if "python2" can be used') },
98102
check: this.checkCommand,
@@ -286,7 +290,7 @@ PythonFinder.prototype = {
286290
// X
287291
const info = [
288292
'**********************************************************',
289-
'You need to install the latest version of Python 2.7.',
293+
'You need to install the latest version of Python.',
290294
'Node-gyp should be able to find and use Python. If not,',
291295
'you can try one of the following options:',
292296
`- Use the switch --python="${pathExample}"`,

0 commit comments

Comments
 (0)