@@ -222,21 +222,42 @@ 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! (env:: EnvCache )
225+ function fixups_from_projectfile! (ctx:: Context )
226+ env = ctx. env
226227 for pkg in values (env. manifest)
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
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
236237 if ! haskey (p. deps, name)
237238 delete! (pkg. deps, name)
238239 end
239240 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
240261 end
241262 end
242263 prune_manifest (env)
@@ -1658,7 +1679,7 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}, new_git=Set{UUID}();
16581679 man_pkgs, deps_map = _resolve (ctx. io, ctx. env, ctx. registries, pkgs, preserve, ctx. julia_version)
16591680 update_manifest! (ctx. env, man_pkgs, deps_map, ctx. julia_version)
16601681 new_apply = download_source (ctx)
1661- fixups_from_projectfile! (ctx. env )
1682+ fixups_from_projectfile! (ctx)
16621683
16631684 # After downloading resolutionary packages, search for (Julia)Artifacts.toml files
16641685 # and ensure they are all downloaded and unpacked as well:
@@ -1705,7 +1726,7 @@ function develop(ctx::Context, pkgs::Vector{PackageSpec}, new_git::Set{UUID};
17051726 pkgs, deps_map = _resolve (ctx. io, ctx. env, ctx. registries, pkgs, preserve, ctx. julia_version)
17061727 update_manifest! (ctx. env, pkgs, deps_map, ctx. julia_version)
17071728 new_apply = download_source (ctx)
1708- fixups_from_projectfile! (ctx. env )
1729+ fixups_from_projectfile! (ctx)
17091730 download_artifacts (ctx; platform= platform, julia_version= ctx. julia_version)
17101731 write_env (ctx. env) # write env before building
17111732 show_update (ctx. env, ctx. registries; io= ctx. io)
@@ -1846,7 +1867,7 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}, level::UpgradeLevel;
18461867 end
18471868 update_manifest! (ctx. env, pkgs, deps_map, ctx. julia_version)
18481869 new_apply = download_source (ctx)
1849- fixups_from_projectfile! (ctx. env )
1870+ fixups_from_projectfile! (ctx)
18501871 download_artifacts (ctx, julia_version= ctx. julia_version)
18511872 write_env (ctx. env; skip_writing_project) # write env before building
18521873 show_update (ctx. env, ctx. registries; io= ctx. io, hidden_upgrades_info = true )
@@ -1892,7 +1913,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec})
18921913
18931914 update_manifest! (ctx. env, pkgs, deps_map, ctx. julia_version)
18941915 new = download_source (ctx)
1895- fixups_from_projectfile! (ctx. env )
1916+ fixups_from_projectfile! (ctx)
18961917 download_artifacts (ctx; julia_version= ctx. julia_version)
18971918 write_env (ctx. env) # write env before building
18981919 show_update (ctx. env, ctx. registries; io= ctx. io)
@@ -1940,7 +1961,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; err_if_free=true)
19401961
19411962 update_manifest! (ctx. env, pkgs, deps_map, ctx. julia_version)
19421963 new = download_source (ctx)
1943- fixups_from_projectfile! (ctx. env )
1964+ fixups_from_projectfile! (ctx)
19441965 download_artifacts (ctx)
19451966 write_env (ctx. env) # write env before building
19461967 show_update (ctx. env, ctx. registries; io= ctx. io)
@@ -2553,8 +2574,7 @@ end
25532574
25542575function is_package_downloaded (manifest_file:: String , pkg:: PackageSpec ; platform= HostPlatform ())
25552576 sourcepath = source_path (manifest_file, pkg)
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?" )
2577+ sourcepath === nothing && return false
25582578 isdir (sourcepath) || return false
25592579 check_artifacts_downloaded (sourcepath; platform) || return false
25602580 return true
0 commit comments