From 204efece212983b8cab4ed0244741bbf4d1175e8 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Thu, 10 Oct 2024 17:00:33 +0200 Subject: [PATCH] removed more compat code --- .github/workflows/TestBundledExport.yml | 4 ++-- src/packages/Packages.jl | 6 +++--- src/packages/PkgCompat.jl | 9 ++------- src/runner/PlutoRunner/src/display/Exception.jl | 2 +- src/runner/PlutoRunner/src/display/syntax error.jl | 5 +---- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/TestBundledExport.yml b/.github/workflows/TestBundledExport.yml index 0ab892fd34..93262824db 100644 --- a/.github/workflows/TestBundledExport.yml +++ b/.github/workflows/TestBundledExport.yml @@ -12,9 +12,9 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: - version: "1.8" + version: "1.10" - name: Generate exports and check for warnings run: | diff --git a/src/packages/Packages.jl b/src/packages/Packages.jl index 13bf3517e7..9b1f63a431 100644 --- a/src/packages/Packages.jl +++ b/src/packages/Packages.jl @@ -7,7 +7,7 @@ import LoggingExtras import .Configuration: CompilerOptions, _merge_notebook_compiler_options, _convert_to_flags const tiers = unique(( - PkgCompat.PRESERVE_ALL_INSTALLED, + Pkg.PRESERVE_ALL_INSTALLED, Pkg.PRESERVE_ALL, Pkg.PRESERVE_DIRECT, Pkg.PRESERVE_SEMVER, @@ -289,7 +289,7 @@ function sync_nbpkg_core( # changed_versions=Dict{String,Pair}(), restart_recommended=👺 || ( (!isempty(to_remove) && old_manifest_keys != new_manifest_keys) || - used_tier ∉ (Pkg.PRESERVE_ALL, PkgCompat.PRESERVE_ALL_INSTALLED) + used_tier ∉ (Pkg.PRESERVE_ALL, Pkg.PRESERVE_ALL_INSTALLED) ), restart_required=👺 || ( used_tier ∈ (Pkg.PRESERVE_SEMVER, Pkg.PRESERVE_NONE) @@ -303,7 +303,7 @@ function sync_nbpkg_core( return ( did_something=👺 || (use_plutopkg_old != use_plutopkg_new), - used_tier=PkgCompat.PRESERVE_ALL_INSTALLED, + used_tier=Pkg.PRESERVE_ALL_INSTALLED, # changed_versions=Dict{String,Pair}(), restart_recommended=👺 || false, restart_required=👺 || false, diff --git a/src/packages/PkgCompat.jl b/src/packages/PkgCompat.jl index 50ff1d491b..58ef62af6f 100644 --- a/src/packages/PkgCompat.jl +++ b/src/packages/PkgCompat.jl @@ -8,9 +8,6 @@ import Pkg.Types: VersionRange import RegistryInstances import ..Pluto -const PRESERVE_ALL_INSTALLED = isdefined(Pkg, :PRESERVE_ALL_INSTALLED) ? Pkg.PRESERVE_ALL_INSTALLED : Pkg.PRESERVE_ALL - - @static if isdefined(Pkg,:REPLMode) && isdefined(Pkg.REPLMode,:complete_remote_package) const REPLMode = Pkg.REPLMode else @@ -60,9 +57,7 @@ I tried to only use public API, except: ### -const PkgContext = if isdefined(Pkg, :Context) - Pkg.Context -elseif isdefined(Pkg, :Types) && isdefined(Pkg.Types, :Context) +const PkgContext = if isdefined(Pkg, :Types) && isdefined(Pkg.Types, :Context) Pkg.Types.Context elseif isdefined(Pkg, :API) && isdefined(Pkg.API, :Context) Pkg.API.Context @@ -341,7 +336,7 @@ end # (🐸 "Public API", but using PkgContext) function _package_versions_from_path(registry_entry_fullpath::AbstractString)::Vector{VersionNumber} # compat - vd = @static if isdefined(Pkg, :Operations) && isdefined(Pkg.Operations, :load_versions) && hasmethod(Pkg.Operations.load_versions, (String,)) + vd = @static if hasmethod(Pkg.Operations.load_versions, (String,)) Pkg.Operations.load_versions(registry_entry_fullpath) else Pkg.Operations.load_versions(PkgContext(), registry_entry_fullpath) diff --git a/src/runner/PlutoRunner/src/display/Exception.jl b/src/runner/PlutoRunner/src/display/Exception.jl index cb0b2650b2..a53601cab6 100644 --- a/src/runner/PlutoRunner/src/display/Exception.jl +++ b/src/runner/PlutoRunner/src/display/Exception.jl @@ -34,7 +34,7 @@ end source_package(::Any) = nothing function format_output(val::CapturedException; context=default_iocontext) - if has_julia_syntax && val.ex isa PrettySyntaxError + if val.ex isa PrettySyntaxError dict = convert_parse_error_to_dict(val.ex.ex.detail) return dict, MIME"application/vnd.pluto.parseerror+object"() end diff --git a/src/runner/PlutoRunner/src/display/syntax error.jl b/src/runner/PlutoRunner/src/display/syntax error.jl index 901a75427d..339f19a511 100644 --- a/src/runner/PlutoRunner/src/display/syntax error.jl +++ b/src/runner/PlutoRunner/src/display/syntax error.jl @@ -1,7 +1,4 @@ -const has_julia_syntax = isdefined(Base, :JuliaSyntax) && fieldcount(Base.Meta.ParseError) == 2 - - # @codemirror/lint has only three levels function convert_julia_syntax_level(level) level == :error ? "error" : @@ -171,7 +168,7 @@ function throw_syntax_error(@nospecialize(syntax_err)) syntax_err isa String && (syntax_err = "syntax: $syntax_err") syntax_err isa Exception || (syntax_err = ErrorException(syntax_err)) - if has_julia_syntax && syntax_err isa Base.Meta.ParseError && syntax_err.detail isa Base.JuliaSyntax.ParseError + if syntax_err isa Base.Meta.ParseError && syntax_err.detail isa Base.JuliaSyntax.ParseError syntax_err = PrettySyntaxError(syntax_err) end