Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw an error if the current Julia version (Base.VERSION) is incompatible with the [compat] entry for julia in the Project.toml file #3526

Merged
merged 19 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Krastanov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Pkg v1.11 Release Notes
=======================

- Pkg now obeys `[compat]` bounds for `julia` and raises an error if the version of the running Julia binary is incompatible with the bounds in `Project.toml`.
Pkg has always obeyed this compat when working with Registry packages. This change affects mostly local packages. ([#3526])

Pkg v1.10 Release Notes
=======================

Pkg v1.9 Release Notes
=======================

Expand Down
7 changes: 2 additions & 5 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,10 @@ function collect_project(pkg::PackageSpec, path::String)
pkgerror("could not find project file for package $(err_rep(pkg)) at `$path`")
end
project = read_package(project_file)
#=
# 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 $(err_rep(pkg)) not satisfied")
if !isnothing(julia_compat) && !(VERSION in julia_compat)
pkgerror("julia version requirement from Project.toml's compat section not satisfied for package $(err_rep(pkg)) at `$path`")
end
=#
for (name, uuid) in project.deps
vspec = get_compat(project, name)
push!(deps, PackageSpec(name, uuid, vspec))
Expand Down
9 changes: 9 additions & 0 deletions test/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,13 @@ end
end
end

@testset "`[compat]` entries for `julia`" begin
isolate(loaded_depot=true) do; mktempdir() do tempdir
pathf = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarFuture"))
pathp = git_init_package(tempdir, joinpath(@__DIR__, "test_packages", "FarPast"))
@test_throws "julia version requirement from Project.toml's compat section not satisfied for package" Pkg.add(path=pathf)
@test_throws "julia version requirement from Project.toml's compat section not satisfied for package" Pkg.add(path=pathp)
end end
end

end # module APITests
7 changes: 7 additions & 0 deletions test/test_packages/FarFuture/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name = "FarFuture"
uuid = "501ba3b0-7baa-46f4-8e2b-5f7988aeacaf"
authors = ["The Jetsons"]
version = "0.1.0"

[compat]
julia = "1.999.0"
5 changes: 5 additions & 0 deletions test/test_packages/FarFuture/src/FarFuture.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module FarFuture

greet() = print("Hello World!")

end # module
7 changes: 7 additions & 0 deletions test/test_packages/FarPast/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name = "FarPast"
uuid = "501ba3b0-7baa-46f4-8e2b-5f7988aeaca0"
authors = ["The Flintstones"]
version = "0.1.0"

[compat]
julia = "<1.1.0"
5 changes: 5 additions & 0 deletions test/test_packages/FarPast/src/FarPast.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module FarPast

greet() = print("Hello World!")

end # module