Fix dev-ing package locally when [sources] include a repo source#4370
Closed
IanButterworth wants to merge 1 commit intoJuliaLang:masterfrom
Closed
Fix dev-ing package locally when [sources] include a repo source#4370IanButterworth wants to merge 1 commit intoJuliaLang:masterfrom
IanButterworth wants to merge 1 commit intoJuliaLang:masterfrom
Conversation
KristofferC
reviewed
Aug 21, 2025
| subdir = get(source, "subdir", nothing)::Union{String, Nothing} | ||
| if path !== nothing && url !== nothing | ||
| pkgerror("`path` and `url` are conflicting specifications") | ||
| # When both path and url are specified, path takes precedence (for dev operations) |
Member
There was a problem hiding this comment.
This doesn't look right to me, you want the thing entered from the Pkg input to take precedence, or? At least, I think this condition should still never be hit.
Member
|
I think this should maybe be handled in this function Lines 196 to 247 in e15974a Basically, we should override the Also, I have some recollection that maybe this is fixed on master? |
Member
Author
Seems so, actually.. using Pkg
using Test
# Test for issue #4368: Cannot `] dev` package locally when `[sources]` include a repo source
@testset "Issue #4368: dev with existing url source" begin
mktempdir() do temp_dir
# Create a test project
project_path = joinpath(temp_dir, "test_project")
mkpath(project_path)
# Create Project.toml with a source that has a URL
project_toml = joinpath(project_path, "Project.toml")
write(project_toml, """
name = "TestProject"
uuid = "12345678-1234-1234-1234-123456789abc"
version = "0.1.0"
[deps]
Example = "7876af07-990d-54b4-ab0e-23690620f79a"
[sources]
Example = {url = "https://github.com/JuliaLang/Example.jl", rev="main"}
""")
# Create a local copy of the package to dev
local_pkg_path = joinpath(temp_dir, "Example")
mkpath(joinpath(local_pkg_path, "src"))
write(joinpath(local_pkg_path, "Project.toml"), """
name = "Example"
uuid = "7876af07-990d-54b4-ab0e-23690620f79a"
version = "0.5.4"
""")
write(joinpath(local_pkg_path, "src", "Example.jl"), """
module Example
greet() = print("Hello World!")
end
""")
# Try to dev the local package - this should work without conflict error
cd(project_path) do
Pkg.activate(".")
# The key test is that this doesn't throw "conflicting specifications" error
Pkg.develop(path=local_pkg_path)
# Verify the package was successfully added as a development dependency
@test haskey(Pkg.project().dependencies, "Example")
end
end
end
|
Member
|
IIRC, #4225 fixed it. That part of the PR should be backported to 1.12. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4368
cc. @topolarity