From 843960a05ac4f761239e53aa9cae9399f09476b5 Mon Sep 17 00:00:00 2001 From: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com> Date: Sun, 18 Aug 2024 18:35:20 -0400 Subject: [PATCH 1/4] Better error messages if artifact rename fails (#3827) (cherry picked from commit 8b2c0f32939042e5d77da05d2825de6ec56487e9) --- src/Artifacts.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Artifacts.jl b/src/Artifacts.jl index 9f236ddb9d..129677c8a9 100644 --- a/src/Artifacts.jl +++ b/src/Artifacts.jl @@ -98,8 +98,6 @@ function _mv_temp_artifact_dir(temp_dir::String, new_path::String)::Nothing Base.uv_error("rename of $(repr(temp_dir)) to $(repr(new_path))", err) end end - chmod(new_path, filemode(dirname(new_path))) - set_readonly(new_path) end end @@ -395,7 +393,12 @@ function download_artifact( return err finally # Always attempt to cleanup - rm(temp_dir; recursive=true, force=true) + try + rm(temp_dir; recursive=true, force=true) + catch e + e isa InterruptException && rethrow() + @warn("Failed to clean up temporary directory $(repr(temp_dir))", exception=e) + end end return true end From 9895ccdc15440524c53ecc518c14a7b92a069a61 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 22 Mar 2024 20:14:14 +0100 Subject: [PATCH 2/4] collect e.g. weak deps from project even if it is not a package (#3852) * collect e.g. weak deps from project even if it is not a package (cherry picked from commit 9c6356fa9d838388cc308cfedaec6cd38fdf00ba) --- src/Operations.jl | 4 ++-- test/extensions.jl | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Operations.jl b/src/Operations.jl index c6415f6886..18753c436d 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -248,8 +248,8 @@ function collect_project(pkg::Union{PackageSpec, Nothing}, path::String) #= # TODO, this should either error or be quiet julia_compat = get_compat(project, "julia") - if julia_compat !== nothing && !(VERSION in julia_compat) - println(io, "julia version requirement for package at `$path`"") + if !isnothing(julia_compat) && !(VERSION in julia_compat) + pkgerror("julia version requirement from Project.toml's compat section not satisfied for package at `$path`") end =# for (name, uuid) in project.deps diff --git a/test/extensions.jl b/test/extensions.jl index 271452d571..dde89756e9 100644 --- a/test/extensions.jl +++ b/test/extensions.jl @@ -99,4 +99,15 @@ using UUIDs @test !("LogExpFunctions" in keys(ctx.env.project.weakdeps)) end end + + isolate(loaded_depot=false) do + mktempdir() do dir + Pkg.Registry.add("General") + path = joinpath(@__DIR__, "test_packages", "TestWeakDepProject") + cp(path, joinpath(dir, "TestWeakDepProject")) + Pkg.activate(joinpath(dir, "TestWeakDepProject")) + Pkg.resolve() + @test Pkg.dependencies()[UUID("2ab3a3ac-af41-5b50-aa03-7779005ae688")].version == v"0.3.26" + end + end end From 61ea85be707f91b6c0b1d3c5a255134de4f53fe6 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Wed, 10 Apr 2024 11:17:16 +0200 Subject: [PATCH 3/4] make `add` and `dev` on a package remove it from the set of weak dependencies (#3865) * make `add` and `dev` on a package remove it from the weakdeps section (cherry picked from commit 88c38b2cd00e93e77c78ab952ffb6a06e6e1828b) --- test/extensions.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/extensions.jl b/test/extensions.jl index dde89756e9..56b93ffb4d 100644 --- a/test/extensions.jl +++ b/test/extensions.jl @@ -108,6 +108,15 @@ using UUIDs Pkg.activate(joinpath(dir, "TestWeakDepProject")) Pkg.resolve() @test Pkg.dependencies()[UUID("2ab3a3ac-af41-5b50-aa03-7779005ae688")].version == v"0.3.26" + + # Check that explicitly adding a package that is a weak dep removes it from the set of weak deps + ctx = Pkg.Types.Context() + @test "LogExpFunctions" in keys(ctx.env.project.weakdeps) + @test !("LogExpFunctions" in keys(ctx.env.project.deps)) + Pkg.add("LogExpFunctions") + ctx = Pkg.Types.Context() + @test "LogExpFunctions" in keys(ctx.env.project.deps) + @test !("LogExpFunctions" in keys(ctx.env.project.weakdeps)) end end end From be8f4caf4852448da10b7689227f16b490faa190 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Thu, 19 Sep 2024 07:37:17 -0400 Subject: [PATCH 4/4] update package extension naming docs (#4000) (cherry picked from commit 5fbfa125045ce3e68ce10bf9fc1727bb3232c123) --- docs/src/creating-packages.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/src/creating-packages.md b/docs/src/creating-packages.md index 9c70ebe402..cb5ab78890 100644 --- a/docs/src/creating-packages.md +++ b/docs/src/creating-packages.md @@ -324,7 +324,7 @@ Contour = "d38c429a-6771-53c6-b99e-75d170b6e991" # name of extension to the left # extension dependencies required to load the extension to the right # use a list for multiple extension dependencies -PlottingContourExt = "Contour" +ContourExt = "Contour" [compat] Contour = "0.6.2" @@ -341,9 +341,9 @@ end end # module ``` -`ext/PlottingContourExt.jl` (can also be in `ext/PlottingContourExt/PlottingContourExt.jl`): +`ext/ContourExt.jl` (can also be in `ext/ContourExt/ContourExt.jl`): ```julia -module PlottingContourExt # Should be same name as the file (just like a normal package) +module ContourExt # Should be same name as the file (just like a normal package) using Plotting, Contour @@ -354,8 +354,8 @@ end end # module ``` -Extensions can have any arbitrary name (here `PlottingContourExt`), but using something similar to the format of -this example that makes the extended functionality and dependency of the extension clear is likely a good idea. +Extensions can have arbitrary names (here `ContourExt`), following the format of this example is likely a good idea for extensions with a single dependency. +In `Pkg` output, extension names are always shown together with their parent package name. A user that depends only on `Plotting` will not pay the cost of the "extension" inside the `PlottingContourExt` module. It is only when the `Contour` package actually gets loaded that the `PlottingContourExt` extension is loaded @@ -396,7 +396,7 @@ This is done by making the following changes (using the example above): @static if !isdefined(Base, :get_extension) function __init__() - @require Contour = "d38c429a-6771-53c6-b99e-75d170b6e991" include("../ext/PlottingContourExt.jl") + @require Contour = "d38c429a-6771-53c6-b99e-75d170b6e991" include("../ext/ContourExt.jl") end end ``` @@ -410,11 +410,11 @@ This is done by making the following changes (using the example above): # Other init functionality here @static if !isdefined(Base, :get_extension) - @require Contour = "d38c429a-6771-53c6-b99e-75d170b6e991" include("../ext/PlottingContourExt.jl") + @require Contour = "d38c429a-6771-53c6-b99e-75d170b6e991" include("../ext/ContourExt.jl") end end ``` -- Make the following change in the conditionally-loaded code: +- Make the following change in the conditionally-loaded code in `ContourExt.jl`: ```julia isdefined(Base, :get_extension) ? (using Contour) : (using ..Contour) ``` @@ -431,7 +431,7 @@ This is done by making the following changes (using the example above): - Add the following to your main package file (typically at the bottom): ```julia if !isdefined(Base, :get_extension) - include("../ext/PlottingContourExt.jl") + include("../ext/ContourExt.jl") end ```