diff --git a/Project.toml b/Project.toml index 54661294..dd7269ee 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PyCall" uuid = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" authors = ["Steven G. Johnson ", "Yichao Yu ", "Takafumi Arakaki ", "Simon Kornblith ", "Páll Haraldsson ", "Jon Malmaud ", "Jake Bolewski ", "Keno Fischer ", "Joel Mason ", "Jameson Nash ", "The JuliaPy development team"] -version = "1.96.2" +version = "1.96.4" [deps] Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d" @@ -16,10 +16,16 @@ VersionParsing = "81def892-9a0e-5fdd-b105-ffc91e053289" Conda = "1.9" MacroTools = "0.4, 0.5" VersionParsing = "1.0" + julia = "1.4" +Dates = "<0.0.1, 1" +Libdl = "<0.0.1, 1" +LinearAlgebra = "<0.0.1, 1" +Serialization = "<0.0.1, 1" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [targets] -test = ["Test"] +test = ["Test", "REPL"] diff --git a/deps/buildutils.jl b/deps/buildutils.jl index 5eb27b94..f090875e 100644 --- a/deps/buildutils.jl +++ b/deps/buildutils.jl @@ -5,7 +5,15 @@ import Conda, Libdl pyvar(python::AbstractString, mod::AbstractString, var::AbstractString) = chomp(read(pythonenv(`$python -c "import $mod; print($mod.$(var))"`), String)) -pyconfigvar(python::AbstractString, var::AbstractString) = pyvar(python, "distutils.sysconfig", "get_config_var('$(var)')") +function pyconfigvar(python::AbstractString, var::AbstractString) + try + pyvar(python, "sysconfig", "get_config_var('$(var)')") + catch e + emsg = sprint(showerror, e) + @warn "Encountered error on using `sysconfig`: $emsg. Falling back to `distutils.sysconfig`." + pyvar(python, "distutils.sysconfig", "get_config_var('$(var)')") + end +end pyconfigvar(python, var, default) = let v = pyconfigvar(python, var) v == "None" ? default : v end diff --git a/deps/depsutils.jl b/deps/depsutils.jl index 35ed1e12..73ae2946 100644 --- a/deps/depsutils.jl +++ b/deps/depsutils.jl @@ -64,8 +64,10 @@ function _preserveas!(dest::Vector{UInt8}, ::Type{Cstring}, x::AbstractString) end function _preserveas!(dest::Vector{UInt8}, ::Type{Cwstring}, x::AbstractString) - s = reinterpret(UInt8, Base.cconvert(Cwstring, x)) - copyto!(resize!(dest, length(s)), s) + s = reinterpret(UInt8, transcode(Cwchar_t, String(x))) + len = length(s) + copyto!(resize!(dest, len + sizeof(Cwchar_t)), s) + dest[len + 1:len + sizeof(Cwchar_t)] .= 0 return pointer(dest) end diff --git a/test/runtests.jl b/test/runtests.jl index 96dc4fa3..1486c480 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,7 @@ using PyCall using PyCall: hasproperty using Test, Dates, Serialization +using REPL # for Docs.doc methods filter(f, itr) = collect(Iterators.filter(f, itr)) filter(f, d::AbstractDict) = Base.filter(f, d) @@ -392,12 +393,12 @@ const PyInt = pyversion < v"3" ? Int : Clonglong @test !ispynull(pyimport_conda("inspect", "not a conda package")) import Conda if PyCall.conda - # import pyzmq to test PR #294 - let already_installed = "pyzmq" ∈ Conda._installed_packages() - @test !ispynull(pyimport_conda("zmq", "pyzmq")) - @test "pyzmq" ∈ Conda._installed_packages() + # import six to test PR #294 + let already_installed = "six" ∈ Conda._installed_packages() + @test !ispynull(pyimport_conda("six", "six")) + @test "six" ∈ Conda._installed_packages() if !already_installed - Conda.rm("pyzmq") + Conda.rm("six") end end end