Skip to content

Commit

Permalink
removed more compat code
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Oct 10, 2024
1 parent e0e07bd commit 204efec
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/TestBundledExport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
6 changes: 3 additions & 3 deletions src/packages/Packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down
9 changes: 2 additions & 7 deletions src/packages/PkgCompat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/runner/PlutoRunner/src/display/Exception.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions src/runner/PlutoRunner/src/display/syntax error.jl
Original file line number Diff line number Diff line change
@@ -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" :
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 204efec

Please sign in to comment.