Skip to content

Commit

Permalink
Merge branch 'master' into modify_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored Jan 8, 2024
2 parents 8874585 + e54c4ee commit efdf3f8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
10 changes: 8 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PyCall"
uuid = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
authors = ["Steven G. Johnson <[email protected]>", "Yichao Yu <[email protected]>", "Takafumi Arakaki <[email protected]>", "Simon Kornblith <[email protected]>", "Páll Haraldsson <[email protected]>", "Jon Malmaud <[email protected]>", "Jake Bolewski <[email protected]>", "Keno Fischer <[email protected]>", "Joel Mason <[email protected]>", "Jameson Nash <[email protected]>", "The JuliaPy development team"]
version = "1.96.2"
version = "1.96.4"

[deps]
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
Expand All @@ -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"]
10 changes: 9 additions & 1 deletion deps/buildutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions deps/depsutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit efdf3f8

Please sign in to comment.