Skip to content
Open
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
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name = "FileIO"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.20.0"
version = "1.21.0"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

Expand Down Expand Up @@ -36,8 +35,9 @@ ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "ColorTypes", "CodecZlib", "CSVFiles", "Downloads", "FilePathsBase", "HTTP", "Random", "Test"]
test = ["Aqua", "ColorTypes", "CodecZlib", "CSVFiles", "Downloads", "FilePathsBase", "HTTP", "Pkg", "Random", "Test"]
1 change: 0 additions & 1 deletion src/FileIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export DataFormat,

import Base.showerror
using Base: RefValue, PkgId
using Pkg
using UUIDs
using Requires

Expand Down
31 changes: 7 additions & 24 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,13 @@ for add_ in (:add_loader, :add_saver)
end
end
if id === nothing
# Look it up in the registries. The tricky part here is supporting different Julia versions
ctx = Pkg.API.Context()
uuids = UUID[]
@static if Base.VERSION >= v"1.2"
if hasfield(typeof(ctx), :registries)
for reg in ctx.registries
append!(uuids, Pkg.Registry.uuids_from_name(reg, pkgname))
end
else
ctx = Pkg.API.Context!(ctx)
if isdefined(Pkg.Types, :find_registered!) && hasmethod(Pkg.Types.find_registered!, (typeof(ctx.env), Vector{String}))
Pkg.Types.find_registered!(ctx.env, [pkgname])
elseif isdefined(Pkg.Types, :find_registered!) && hasmethod(Pkg.Types.find_registered!, (typeof(ctx), Vector{String}))
Pkg.Types.find_registered!(ctx, [pkgname])
end
append!(uuids, get(ctx.env.uuids, pkgname, UUID[]))
end
else
Pkg.Types.find_registered!(ctx.env)
append!(uuids, get(ctx.env.uuids, pkgname, UUID[]))
end
isempty(uuids) && throw(ArgumentError("no UUID found for $pkg"))
length(uuids) == 1 || throw(ArgumentError("multiple UUIDs found for $pkg"))
id = PkgId(uuids[1], pkgname)
# See if a package by that name has already been loaded (e.g., a package
# registering itself from its `__init__`)
ids = PkgId[k for k in keys(Base.loaded_modules) if k.name == pkgname]
length(ids) == 1 && (id = only(ids))
end
if id === nothing
throw(ArgumentError("could not resolve package \"$pkgname\" from the active environment; pass it as a Module or as `:$pkgname => uuid`"))
end
end
$add_(sym, id)
Expand Down
Loading