Skip to content

Commit 7802601

Browse files
KristofferCKristofferC
andauthored
Revert "Fixes for julia_version. Expand and consolidate julia_version tests. (#4151)" (#4255)
Co-authored-by: KristofferC <[email protected]> Fixes for julia_version. Expand and consolidate julia_version tests. (#4151)"
2 parents 968d16c + ef996d4 commit 7802601

File tree

6 files changed

+228
-363
lines changed

6 files changed

+228
-363
lines changed

src/Operations.jl

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -222,42 +222,21 @@ end
222222
# This has to be done after the packages have been downloaded
223223
# since we need access to the Project file to read the information
224224
# about extensions
225-
function fixups_from_projectfile!(ctx::Context)
226-
env = ctx.env
225+
function fixups_from_projectfile!(env::EnvCache)
227226
for pkg in values(env.manifest)
228-
if ctx.julia_version !== VERSION && is_stdlib(pkg.uuid, ctx.julia_version)
229-
# Special handling for non-current julia_version resolving given the source for historical stdlibs
230-
# isn't available at this stage as Pkg thinks it should not be needed, so rely on STDLIBS_BY_VERSION
231-
stdlibs = Types.get_last_stdlibs(ctx.julia_version)
232-
p = stdlibs[pkg.uuid]
233-
pkg.weakdeps = Dict{String, Base.UUID}(stdlibs[uuid].name => uuid for uuid in p.weakdeps)
234-
# pkg.exts = p.exts # TODO: STDLIBS_BY_VERSION doesn't record this
235-
# pkg.entryfile = p.entryfile # TODO: STDLIBS_BY_VERSION doesn't record this
236-
for (name, _) in pkg.weakdeps
227+
# isfile_casesenstive within locate_project_file used to error on Windows if given a
228+
# relative path so abspath it to be extra safe https://github.com/JuliaLang/julia/pull/55220
229+
project_file = Base.locate_project_file(abspath(source_path(env.manifest_file, pkg)))
230+
if project_file isa String && isfile(project_file)
231+
p = Types.read_project(project_file)
232+
pkg.weakdeps = p.weakdeps
233+
pkg.exts = p.exts
234+
pkg.entryfile = p.entryfile
235+
for (name, _) in p.weakdeps
237236
if !haskey(p.deps, name)
238237
delete!(pkg.deps, name)
239238
end
240239
end
241-
else
242-
# normal mode based on project files.
243-
# isfile_casesenstive within locate_project_file used to error on Windows if given a
244-
# relative path so abspath it to be extra safe https://github.com/JuliaLang/julia/pull/55220
245-
sourcepath = source_path(env.manifest_file, pkg)
246-
if sourcepath === nothing
247-
pkgerror("could not find source path for package $(pkg.name) based on manifest $(env.manifest_file)")
248-
end
249-
project_file = Base.locate_project_file(abspath(sourcepath))
250-
if project_file isa String && isfile(project_file)
251-
p = Types.read_project(project_file)
252-
pkg.weakdeps = p.weakdeps
253-
pkg.exts = p.exts
254-
pkg.entryfile = p.entryfile
255-
for (name, _) in p.weakdeps
256-
if !haskey(p.deps, name)
257-
delete!(pkg.deps, name)
258-
end
259-
end
260-
end
261240
end
262241
end
263242
prune_manifest(env)
@@ -1679,7 +1658,7 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}, new_git=Set{UUID}();
16791658
man_pkgs, deps_map = _resolve(ctx.io, ctx.env, ctx.registries, pkgs, preserve, ctx.julia_version)
16801659
update_manifest!(ctx.env, man_pkgs, deps_map, ctx.julia_version)
16811660
new_apply = download_source(ctx)
1682-
fixups_from_projectfile!(ctx)
1661+
fixups_from_projectfile!(ctx.env)
16831662

16841663
# After downloading resolutionary packages, search for (Julia)Artifacts.toml files
16851664
# and ensure they are all downloaded and unpacked as well:
@@ -1726,7 +1705,7 @@ function develop(ctx::Context, pkgs::Vector{PackageSpec}, new_git::Set{UUID};
17261705
pkgs, deps_map = _resolve(ctx.io, ctx.env, ctx.registries, pkgs, preserve, ctx.julia_version)
17271706
update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
17281707
new_apply = download_source(ctx)
1729-
fixups_from_projectfile!(ctx)
1708+
fixups_from_projectfile!(ctx.env)
17301709
download_artifacts(ctx; platform=platform, julia_version=ctx.julia_version)
17311710
write_env(ctx.env) # write env before building
17321711
show_update(ctx.env, ctx.registries; io=ctx.io)
@@ -1867,7 +1846,7 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}, level::UpgradeLevel;
18671846
end
18681847
update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
18691848
new_apply = download_source(ctx)
1870-
fixups_from_projectfile!(ctx)
1849+
fixups_from_projectfile!(ctx.env)
18711850
download_artifacts(ctx, julia_version=ctx.julia_version)
18721851
write_env(ctx.env; skip_writing_project) # write env before building
18731852
show_update(ctx.env, ctx.registries; io=ctx.io, hidden_upgrades_info = true)
@@ -1913,7 +1892,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec})
19131892

19141893
update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
19151894
new = download_source(ctx)
1916-
fixups_from_projectfile!(ctx)
1895+
fixups_from_projectfile!(ctx.env)
19171896
download_artifacts(ctx; julia_version=ctx.julia_version)
19181897
write_env(ctx.env) # write env before building
19191898
show_update(ctx.env, ctx.registries; io=ctx.io)
@@ -1961,7 +1940,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; err_if_free=true)
19611940

19621941
update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
19631942
new = download_source(ctx)
1964-
fixups_from_projectfile!(ctx)
1943+
fixups_from_projectfile!(ctx.env)
19651944
download_artifacts(ctx)
19661945
write_env(ctx.env) # write env before building
19671946
show_update(ctx.env, ctx.registries; io=ctx.io)
@@ -2574,7 +2553,8 @@ end
25742553

25752554
function is_package_downloaded(manifest_file::String, pkg::PackageSpec; platform=HostPlatform())
25762555
sourcepath = source_path(manifest_file, pkg)
2577-
sourcepath === nothing && return false
2556+
identifier = pkg.name !== nothing ? pkg.name : pkg.uuid
2557+
(sourcepath === nothing) && pkgerror("Could not locate the source code for the $(identifier) package. Are you trying to use a manifest generated by a different version of Julia?")
25782558
isdir(sourcepath) || return false
25792559
check_artifacts_downloaded(sourcepath; platform) || return false
25802560
return true

test/extensions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ using UUIDs
3232
Pkg.status(; extensions=true, mode=Pkg.PKGMODE_MANIFEST, io)
3333
# TODO: Test output when ext deps are loaded etc.
3434
str = String(take!(io))
35-
@test contains(str, "└─ OffsetArraysExt [OffsetArrays]" )
35+
@test contains(str, "OffsetArraysExt [OffsetArrays]" )
3636
@test !any(endswith(".cov"), readdir(joinpath(hdwe_root, "src")))
3737
@test !any(endswith(".cov"), readdir(joinpath(he_root, "src")))
3838
@test !any(endswith(".cov"), readdir(joinpath(he_root, "ext")))

0 commit comments

Comments
 (0)