Skip to content

Commit

Permalink
drop more 0.6 code (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored Sep 4, 2018
1 parent 34190dd commit 283bba1
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 38 deletions.
2 changes: 1 addition & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ kspec_cmd, = installkernel("Julia")
# "kernelspec" with "notebook":
notebook = kspec_cmd.exec
n = notebook[end]
ki = VERSION < v"0.7.0-DEV.3252" ? rsearch(n, "kernelspec") : findlast("kernelspec", n)
ki = findlast("kernelspec", n)
notebook[end] = n[1:prevind(n,first(ki))] * "notebook" * n[nextind(n,last(ki)):end]

#######################################################################
Expand Down
12 changes: 6 additions & 6 deletions deps/kspec.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#######################################################################
# Install Jupyter kernel-spec file.

copy_config(src, dest) = Compat.cp(src, joinpath(dest, basename(src)), force=true)
copy_config(src, dest) = cp(src, joinpath(dest, basename(src)), force=true)

"""
installkernel(name, options...; specname=replace(lowercase(name), " "=>"-")
Expand Down Expand Up @@ -40,8 +40,8 @@ function installkernel(name::AbstractString, julia_options::AbstractString...;

juliakspec = joinpath(tempdir(), spec_name)
try
binary_name = Compat.Sys.iswindows() ? "julia.exe" : "julia"
kernelcmd_array = String[joinpath(Compat.Sys.BINDIR,"$binary_name"), "-i",
binary_name = Sys.iswindows() ? "julia.exe" : "julia"
kernelcmd_array = String[joinpath(Sys.BINDIR,"$binary_name"), "-i",
"--startup-file=yes", "--color=yes"]
append!(kernelcmd_array, julia_options)
ijulia_dir = get(ENV, "IJULIA_DIR", dirname(@__DIR__)) # support non-Pkg IJulia installs
Expand All @@ -65,7 +65,7 @@ function installkernel(name::AbstractString, julia_options::AbstractString...;
copy_config(joinpath(ijulia_dir,"deps","logo-32x32.png"), juliakspec)
copy_config(joinpath(ijulia_dir,"deps","logo-64x64.png"), juliakspec)

Compat.@info("Installing $name kernelspec $spec_name")
@info("Installing $name kernelspec $spec_name")

# remove these hacks when
# https://github.com/jupyter/notebook/issues/448 is closed and the fix
Expand All @@ -75,13 +75,13 @@ function installkernel(name::AbstractString, julia_options::AbstractString...;
run(`$jupyter kernelspec install --replace --user $juliakspec`)
push!(kspec_cmd, jupyter, "kernelspec")
catch
@static if Compat.Sys.isunix()
@static if Sys.isunix()
run(`$jupyter-kernelspec install --replace --user $juliakspec`)
push!(kspec_cmd, jupyter * "-kernelspec")
end

# issue #363:
@static if Compat.Sys.iswindows()
@static if Sys.iswindows()
jupyter_dir = dirname(jupyter)
jks_exe = ""
if jupyter_dir == abspath(Conda.SCRIPTDIR)
Expand Down
10 changes: 4 additions & 6 deletions src/IJulia.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
VERSION < v"0.7.0-beta2.199" && __precompile__()

"""
**IJulia** is a [Julia-language](http://julialang.org/) backend
combined with the [Jupyter](http://jupyter.org/) interactive
Expand Down Expand Up @@ -113,7 +111,7 @@ process manager.)
"""
function notebook(; dir=homedir(), detached=false)
inited && error("IJulia is already running")
if Compat.Sys.isapple() # issue #551 workaround, remove after macOS 10.12.6 release?
if Sys.isapple() # issue #551 workaround, remove after macOS 10.12.6 release?
withenv("BROWSER"=>"open") do
p = run(Cmd(`$notebook_cmd`, detach=true, dir=dir); wait=false)
end
Expand Down Expand Up @@ -276,7 +274,7 @@ Remove a function `f()` from the list of functions to
execute after executing any notebook cell.
"""
pop_postexecute_hook(f::Function) =
splice!(postexecute_hooks, Compat.findlast(isequal(f), postexecute_hooks))
splice!(postexecute_hooks, findlast(isequal(f), postexecute_hooks))

const preexecute_hooks = Function[]
"""
Expand All @@ -293,7 +291,7 @@ Remove a function `f()` from the list of functions to
execute before executing any notebook cell.
"""
pop_preexecute_hook(f::Function) =
splice!(preexecute_hooks, Compat.findlast(isequal(f), preexecute_hooks))
splice!(preexecute_hooks, findlast(isequal(f), preexecute_hooks))

# similar, but called after an error (e.g. to reset plotting state)
const posterror_hooks = Function[]
Expand All @@ -311,7 +309,7 @@ Remove a function `f()` from the list of functions to
execute after an error occurs when a notebook cell is evaluated.
"""
pop_posterror_hook(f::Function) =
splice!(posterror_hooks, Compat.findlast(isequal(f), posterror_hooks))
splice!(posterror_hooks, findlast(isequal(f), posterror_hooks))

#######################################################################

Expand Down
12 changes: 2 additions & 10 deletions src/handlers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,8 @@ function complete_request(socket, msg)
end

codestart = find_parsestart(code, cursorpos)
@static if VERSION >= v"0.7.0-beta.207"
comps_, positions = REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1, current_module[])
else
comps_, positions = REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1)
end
@static if isdefined(REPLCompletions, :completion_text)
comps = unique!(REPLCompletions.completion_text.(comps_)) # julia#26930
else
comps = comps_
end
comps_, positions = REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1, current_module[])
comps = unique!(REPLCompletions.completion_text.(comps_)) # julia#26930
# positions = positions .+ (codestart - 1) on Julia 0.7
positions = (first(positions) + codestart - 1):(last(positions) + codestart - 1)
metadata = Dict()
Expand Down
2 changes: 1 addition & 1 deletion src/inline.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Base: display, redisplay

struct InlineDisplay <: Compat.AbstractDisplay end
struct InlineDisplay <: AbstractDisplay end

# supported MIME types for inline display in IPython, in descending order
# of preference (descending "richness")
Expand Down
6 changes: 3 additions & 3 deletions src/kernel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import IJulia
using InteractiveUtils

# workaround #60:
if IJulia.Compat.Sys.isapple()
ENV["PATH"] = IJulia.Compat.Sys.BINDIR*":"*ENV["PATH"]
if Sys.isapple()
ENV["PATH"] = Sys.BINDIR*":"*ENV["PATH"]
end

IJulia.init(ARGS)
Expand All @@ -13,7 +13,7 @@ import IJulia: ans, In, Out, clear_history

pushdisplay(IJulia.InlineDisplay())

ccall(:jl_exit_on_sigint, IJulia.Compat.Cvoid, (Cint,), 0)
ccall(:jl_exit_on_sigint, Cvoid, (Cint,), 0)

# the size of truncated output to show should not depend on the terminal
# where the kernel is launched, since the display is elsewhere
Expand Down
6 changes: 1 addition & 5 deletions src/magics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ function magics_help(code::AbstractString)
end
end

@static if VERSION < v"0.7.0-DEV.3589" # julia#25738
using Base.Markdown
else
using Markdown
end
using Markdown

const magic_help_string = """
Julia does not use the IPython `%magic` syntax. To interact
Expand Down
2 changes: 1 addition & 1 deletion test/comm.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Compat.Test
using Test
import IJulia: Comm, comm_target


Expand Down
2 changes: 1 addition & 1 deletion test/execute_request.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Compat.Test
using Test

import IJulia: helpmode, error_content, docdict

Expand Down
4 changes: 2 additions & 2 deletions test/msg.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Compat.Test
using Test
import IJulia: Msg
using Compat.Dates
using Dates

idents = ["idents"]
header = Dict("msg_id"=>"c673eed8-7c36-47f4-82af-df8ec546a87d",
Expand Down
3 changes: 1 addition & 2 deletions test/stdio.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Compat.Test
using Test
using IJulia
using Compat: occursin

mktemp() do path, io
redirect_stdout(IJulia.IJuliaStdio(io, "stdout")) do
Expand Down

0 comments on commit 283bba1

Please sign in to comment.