From 04c477858b84c1a2dfcf450d0250f3527b56035b Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Mon, 30 Oct 2023 17:06:43 -0400 Subject: [PATCH 1/7] A few fixes for julia master (#1059) * Fix breakage due to JuliaLang/julia#51319 `cconvert` does not return an array anymore and cannot be used with `reinterpret`. Fix to use the underlying `transcode` function directly, which is also consistent with the `Cstring` version. * Fix doc test --- Project.toml | 3 ++- deps/depsutils.jl | 6 ++++-- test/runtests.jl | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 413c2820..565f73fb 100644 --- a/Project.toml +++ b/Project.toml @@ -20,6 +20,7 @@ julia = "1.4" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [targets] -test = ["Test"] +test = ["Test", "REPL"] 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..bc124a52 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) From 69f915709c977a38c05261ab2c2aa8c6e2768ebe Mon Sep 17 00:00:00 2001 From: Simeon Schaub Date: Wed, 8 Nov 2023 02:18:45 +0100 Subject: [PATCH 2/7] new release (#1062) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 565f73fb..e4d85067 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.1" +version = "1.96.2" [deps] Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d" From 3df5c48cdbb0c21b748bc12dbfd4e8fdd8e7ca30 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 8 Nov 2023 11:11:32 -0500 Subject: [PATCH 3/7] version stdlibs (#1063) * version stdlibs, which requires Julia 1.6 * try with Julia 1.4 * use "six" not "pyzmq" to test pyimport_conda * whoops --- Project.toml | 5 +++++ test/runtests.jl | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index e4d85067..3939e35d 100644 --- a/Project.toml +++ b/Project.toml @@ -16,7 +16,12 @@ VersionParsing = "81def892-9a0e-5fdd-b105-ffc91e053289" Conda = "1.9" MacroTools = "0.4, 0.5" VersionParsing = "1.0" + julia = "1.4" +Dates = "1.4" +Libdl = "1.4" +LinearAlgebra = "1.4" +Serialization = "1.4" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl index bc124a52..1486c480 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -393,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 From 9decc34d4f3f3aa5fa1af746b7c05be611b28d37 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Tue, 5 Dec 2023 21:39:41 -0500 Subject: [PATCH 4/7] Fix the stdlib compat entries (#1065) --- Project.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 3939e35d..a376f77d 100644 --- a/Project.toml +++ b/Project.toml @@ -18,10 +18,10 @@ MacroTools = "0.4, 0.5" VersionParsing = "1.0" julia = "1.4" -Dates = "1.4" -Libdl = "1.4" -LinearAlgebra = "1.4" -Serialization = "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" From d407513e667d259881fe04667fd74a8bb098253d Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Tue, 5 Dec 2023 21:43:19 -0500 Subject: [PATCH 5/7] bump to 1.96.3 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index a376f77d..b3cef1f2 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.3" [deps] Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d" From 790e62f8bfaeb17209ece53cc353b49b10b0e06f Mon Sep 17 00:00:00 2001 From: Miles Cranmer Date: Sat, 16 Dec 2023 08:02:58 -0600 Subject: [PATCH 6/7] Rename `distutils.sysconfig` to `sysconfig` (#1068) * Rename `distutils.sysconfig` to `sysconfig` - Required for Python 3.12 as distutils is removed. * Fallback to `distutils.sysconfig` --- deps/buildutils.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 From e54c4ee3962f423a4c77fbc8afc20f5fb66296c3 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Sat, 16 Dec 2023 09:03:58 -0500 Subject: [PATCH 7/7] bump to 1.96.4 (#1070) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index b3cef1f2..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.3" +version = "1.96.4" [deps] Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"