From dd9a82795033a9657f5323dfa2c44c63c5c42d94 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 1 Nov 2018 14:25:00 -0700 Subject: [PATCH] Rebuild PyCall after installing ipython --- test/install_dependencies.jl | 18 +++++++++++------- test/runtests.jl | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/test/install_dependencies.jl b/test/install_dependencies.jl index 5051cfc..c08dc15 100644 --- a/test/install_dependencies.jl +++ b/test/install_dependencies.jl @@ -12,16 +12,20 @@ Pkg.build("PyCall") using Compat: @info using IPython -if VERSION >= v"0.7.0-" - @info "PyCall/deps/build.log:" - print(read( - joinpath(dirname(dirname(pathof(IPython.PyCall))), "deps", "build.log"), - String)) -end - IPython.install_dependency("pytest"; force=true) IPython.install_dependency("ipython"; force=true) if get(ENV, "CONDA_JL_VERSION", "") == "2" # For IPython.testing.globalipapp IPython.install_dependency("mock"; force=true) end + +# Build PyCall again, since above installation could have changed +# Python versions. +Pkg.build("PyCall") + +if VERSION >= v"0.7.0-" + @info "PyCall/deps/build.log:" + print(read( + joinpath(dirname(dirname(pathof(IPython.PyCall))), "deps", "build.log"), + String)) +end diff --git a/test/runtests.jl b/test/runtests.jl index 96cb57c..d635a5d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,22 @@ # module TestIPython if lowercase(get(ENV, "CI", "false")) == "true" - include("install_dependencies.jl") + let + if VERSION < v"0.7.0-" + setup_code = "" + else + setup_code = Base.load_path_setup_code() + end + path = joinpath(@__DIR__, "install_dependencies.jl") + code = """ + $setup_code + include("$(escape_string(path))") + """ + run(`$(Base.julia_cmd()) -e $code`) + # Run install_dependencies.jl in a separate process since it + # may re-build PyCall. In that case, we need to load + # re-precompiled PyCall and IPython. + end end include("preamble.jl")