Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: set Python semverRange: '>=2.7.0 <3.8.0' #1813

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ matrix:
python: 3.7
before_install: nvm install 12
allow_failures:
- os: osx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

- os: windows
install:
#- pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
30 changes: 20 additions & 10 deletions test/test-find-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -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()
}
Expand All @@ -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)
Expand Down Expand Up @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand Down Expand Up @@ -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()

Expand All @@ -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'))
}
Expand Down