Skip to content

Commit 21aae13

Browse files
author
Christopher Doris
committed
ensure pycall has the right interpreter
1 parent 5082ef6 commit 21aae13

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

test/runtests.jl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
# build PyCall with the same interpreter as PythonCall
2+
using PythonCall: PythonCall
3+
using Pkg: Pkg
4+
ENV["PYTHON"] = PythonCall.python_executable_path()
5+
@info "Building PyCall..." ENV["PYTHON"]
6+
Pkg.build("PyCall")
7+
18
using TestItemRunner
29

310
@run_package_tests
411

512
@testmodule PyCall begin
13+
# build PyCall with the same interpreter as PythonCall
614
using PythonCall: PythonCall
7-
using Pkg: Pkg
8-
ENV["PYTHON"] = PythonCall.python_executable_path()
9-
@info "Building PyCall..." ENV["PYTHON"]
10-
Pkg.build("PyCall")
15+
if get(ENV, "PYTHON", "") != PythonCall.python_executable_path()
16+
# ... but only if we didn't already do this
17+
using Pkg: Pkg
18+
ENV["PYTHON"] = PythonCall.python_executable_path()
19+
@info "Building PyCall..." ENV["PYTHON"]
20+
Pkg.build("PyCall")
21+
end
1122
using PyCall
1223
end

0 commit comments

Comments
 (0)