From d8aa84401f2ec96aa6701ad9dc3911633db7b330 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Wed, 17 Oct 2018 01:05:54 -0700 Subject: [PATCH 1/2] Fix show_dlopen_error See the first version of the comment https://github.com/JuliaPy/PyCall.jl/issues/592#issuecomment-430517684 --- deps/build.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index ab43ddea..57a1c801 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -58,9 +58,9 @@ function exec_find_libpython(python::AbstractString, options) return readlines(pythonenv(cmd)) end -function show_dlopen_error(e) +function show_dlopen_error(lib, e) if PYCALL_DEBUG_BUILD - println(stderr, "dlopen($libpath_lib) ==> ", e) + println(stderr, "dlopen($lib) ==> ", e) # Using STDERR since find_libpython.py prints debugging # messages to STDERR too. end @@ -75,7 +75,7 @@ function find_libpython(python::AbstractString) try return (Libdl.dlopen(lib, dlopen_flags), lib) catch e - show_dlopen_error(e) + show_dlopen_error(lib, e) end end @@ -94,7 +94,7 @@ function find_libpython(python::AbstractString) # compare libpython. return (libpython, Libdl.dlpath(libpython)) catch e - show_dlopen_error(e) + show_dlopen_error(lib, e) end end From 8afbd5861d9271dbde2b4f7478af613f49ff75c7 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Wed, 17 Oct 2018 01:06:32 -0700 Subject: [PATCH 2/2] Fix a possible bug in exec_find_libpython The previous code accidentally worked presumably because $PWD was set do deps when running deps/build.jl. Cherry-picked from #595. --- deps/build.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deps/build.jl b/deps/build.jl index 57a1c801..a464b069 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -51,7 +51,10 @@ const dlprefix = Compat.Sys.iswindows() ? "" : "lib" const PYCALL_DEBUG_BUILD = "yes" == get(ENV, "PYCALL_DEBUG_BUILD", "no") function exec_find_libpython(python::AbstractString, options) - cmd = `$python $(joinpath(@__DIR__, "find_libpython.py")) $options` + # Do not inline `@__DIR__` into the backticks to expand correctly. + # See: https://github.com/JuliaLang/julia/issues/26323 + script = joinpath(@__DIR__, "find_libpython.py") + cmd = `$python $script $options` if PYCALL_DEBUG_BUILD cmd = `$cmd --verbose` end