Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise minimum required Julia version from 1.0 to 1.6 #1841

Merged
merged 2 commits into from
Jun 5, 2022
Merged
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
1 change: 0 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0'
- '1.6'
- '1'
- 'nightly'
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Version `v0.28.0` (unreleased)

* The (minimum) required Julia version has been raised from 1.0 to 1.6. For older Julia versions the 0.27.X release can still be used. ([#1835][github-1835], [#1841][github-1841])
* ![Enhancement][badge-enhancement] The `ansicolor` keyword to `HTML()` now defaults to true, meaning that executed outputs from `@example`- and `@repl`-blocks are now by default colored (if they emit colored output). ([#1828][github-1828])

## Version `v0.27.19`
Expand Down Expand Up @@ -1054,8 +1055,10 @@
[github-1829]: https://github.com/JuliaDocs/Documenter.jl/pull/1829
[github-1833]: https://github.com/JuliaDocs/Documenter.jl/pull/1833
[github-1834]: https://github.com/JuliaDocs/Documenter.jl/pull/1834
[github-1835]: https://github.com/JuliaDocs/Documenter.jl/issues/1835
[github-1836]: https://github.com/JuliaDocs/Documenter.jl/pull/1836
[github-1838]: https://github.com/JuliaDocs/Documenter.jl/pull/1838
[github-1841]: https://github.com/JuliaDocs/Documenter.jl/pull/1841
<!-- end of issue link definitions -->

[julia-38079]: https://github.com/JuliaLang/julia/issues/38079
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ANSIColoredPrinters = "0.0.1"
DocStringExtensions = "0.4, 0.5, 0.6, 0.7, 0.8"
IOCapture = "0.2"
JSON = "0.19, 0.20, 0.21"
julia = "1"
julia = "1.6"

[extras]
DocumenterMarkdown = "997ab1e6-3595-5248-9280-8efb232c3433"
Expand Down
8 changes: 3 additions & 5 deletions src/DocTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,9 @@ function eval_repl(block, sandbox, meta::Dict, doc::Documents.Document, page)
for (ex, str) in Utilities.parseblock(input, doc, page; keywords = false, raise=false)
# Input containing a semi-colon gets suppressed in the final output.
result.hide = REPL.ends_with_semicolon(str)
if VERSION >= v"1.5.0-DEV.178"
# Use the REPL softscope for REPL jldoctests,
# see https://github.com/JuliaLang/julia/pull/33864
ex = REPL.softscope!(ex)
end
# Use the REPL softscope for REPL jldoctests,
# see https://github.com/JuliaLang/julia/pull/33864
ex = REPL.softscope!(ex)
c = IOCapture.capture(rethrow = InterruptException) do
Core.eval(sandbox, ex)
end
Expand Down
8 changes: 3 additions & 5 deletions src/Expanders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,9 @@ function Selectors.runner(::Type{REPLBlocks}, x, page, doc)
for (ex, str) in Utilities.parseblock(x.code, doc, page; keywords = false,
linenumbernode = linenumbernode)
input = droplines(str)
if VERSION >= v"1.5.0-DEV.178"
# Use the REPL softscope for REPLBlocks,
# see https://github.com/JuliaLang/julia/pull/33864
ex = REPL.softscope!(ex)
end
# Use the REPL softscope for REPLBlocks,
# see https://github.com/JuliaLang/julia/pull/33864
ex = REPL.softscope!(ex)
c = IOCapture.capture(rethrow = InterruptException, color = ansicolor) do
cd(page.workdir) do
Core.eval(mod, ex)
Expand Down
45 changes: 18 additions & 27 deletions src/Utilities/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,26 +150,24 @@ function parseblock(code::AbstractString, doc, file; skip = 0, keywords = true,
end
cursor = ncursor
end
if VERSION >= v"1.6.0" # required for Meta.parseall(...)
if linenumbernode isa LineNumberNode
exs = Meta.parseall(code; filename=linenumbernode.file).args
@assert length(exs) == 2 * length(results)
for (i, ex) in enumerate(Iterators.partition(exs, 2))
@assert ex[1] isa LineNumberNode
expr = Expr(:toplevel, ex...) # LineNumberNode + expression
# in the REPL each evaluation is considered a new file, e.g.
# REPL[1], REPL[2], ..., so try to mimic that by incrementing
# the counter for each sub-expression in this code block
if linenumbernode.file === Symbol("REPL")
newfile = "REPL[$i]"
# to reset the line counter for each new "file"
lineshift = 1 - ex[1].line
update_linenumbernodes!(expr, newfile, lineshift)
else
update_linenumbernodes!(expr, linenumbernode.file, linenumbernode.line)
end
results[i] = (expr , results[i][2])
if linenumbernode isa LineNumberNode
exs = Meta.parseall(code; filename=linenumbernode.file).args
@assert length(exs) == 2 * length(results)
for (i, ex) in enumerate(Iterators.partition(exs, 2))
@assert ex[1] isa LineNumberNode
expr = Expr(:toplevel, ex...) # LineNumberNode + expression
# in the REPL each evaluation is considered a new file, e.g.
# REPL[1], REPL[2], ..., so try to mimic that by incrementing
# the counter for each sub-expression in this code block
if linenumbernode.file === Symbol("REPL")
newfile = "REPL[$i]"
# to reset the line counter for each new "file"
lineshift = 1 - ex[1].line
update_linenumbernodes!(expr, newfile, lineshift)
else
update_linenumbernodes!(expr, linenumbernode.file, linenumbernode.line)
end
results[i] = (expr , results[i][2])
end
end
results
Expand Down Expand Up @@ -798,14 +796,7 @@ function git_remote_head_branch(varname, root; remotename = "origin", fallback =
cmd = `git remote show $(remotename)`
stderr_output = IOBuffer()
git_remote_output = try
# Older Julia versions don't support pipeline-ing into IOBuffer.
stderr_redirect = if VERSION >= v"1.6.0"
stderr_output
else
write(stderr_output, "(no output redirect on Julia $VERSION)")
devnull
end
read(pipeline(setenv(cmd, env; dir=root); stderr = stderr_redirect), String)
read(pipeline(setenv(cmd, env; dir=root); stderr = stderr_output), String)
catch e
@warn """
Unable to determine $(varname) from remote HEAD branch, defaulting to "$(fallback)".
Expand Down
6 changes: 1 addition & 5 deletions src/Writers/LaTeXWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ const DOCUMENT_STRUCTURE = (

# https://github.com/JuliaLang/julia/pull/32851
function mktempdir(args...; kwargs...)
if VERSION < v"1.3.0-alpha.112"
return Base.mktempdir(args...; kwargs...)
else
return Base.mktempdir(args...; cleanup=false, kwargs...)
end
return Base.mktempdir(args...; cleanup=false, kwargs...)
end

function render(doc::Documents.Document, settings::LaTeX=LaTeX())
Expand Down
16 changes: 3 additions & 13 deletions src/deployconfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,9 @@ function verify_github_pull_repository(repo, prnr)
end

function run_and_capture(cmd)
stdout, stderr = if VERSION < v"1.1"
# On Julia 1.0, we can not pass IOBuffer() to pipeline(), so we're using the workaround
# described here:
# https://discourse.julialang.org/t/how-to-capture-stdout-and-stderr-in-1-1/20712/2
stdout_pipe, stderr_pipe = Pipe(), Pipe()
run(pipeline(cmd; stdout = stdout_pipe, stderr = stderr_pipe))
close(stdout_pipe.in); close(stderr_pipe.in)
stdout, stderr = read(stdout_pipe, String), read(stderr_pipe, String)
else
stdout_buffer, stderr_buffer = IOBuffer(), IOBuffer()
run(pipeline(cmd; stdout = stdout_buffer, stderr = stderr_buffer))
stdout, stderr = String(take!(stdout_buffer)), String(take!(stderr_buffer))
end
stdout_buffer, stderr_buffer = IOBuffer(), IOBuffer()
run(pipeline(cmd; stdout = stdout_buffer, stderr = stderr_buffer))
stdout, stderr = String(take!(stdout_buffer)), String(take!(stderr_buffer))
return (; stdout = stdout, stderr = stderr)
end

Expand Down
10 changes: 1 addition & 9 deletions test/TestUtilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,7 @@ end

function trun(cmd::Base.AbstractCmd)
buffer = IOBuffer()
cmd_redirected = if VERSION < v"1.6.0"
# Okay, older Julia versions have a missing method, which don't allow a redirect:
# MethodError: no method matching rawhandle(::Base.GenericIOBuffer{Array{UInt8,1}})
# Not sure when it was exactly fixed, but 1.6 seems to work fine.
write(buffer, "no output recorded")
cmd
else
pipeline(cmd; stdin = devnull, stdout = buffer, stderr = buffer)
end
cmd_redirected = pipeline(cmd; stdin = devnull, stdout = buffer, stderr = buffer)
try
run(cmd_redirected)
return true
Expand Down
17 changes: 4 additions & 13 deletions test/doctests/doctests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,10 @@ rfile(filename) = joinpath(@__DIR__, "stdouts", filename)
@test is_same_as_file(output, rfile("32.stdout"))
end

if VERSION >= v"1.5.0-DEV.178"
# Julia 1.5 REPL softscope,
# see https://github.com/JuliaLang/julia/pull/33864
run_makedocs(["softscope.md"]) do result, success, backtrace, output
@test success
@test is_same_as_file(output, rfile("41.stdout"))
end
else
# Old REPL scoping behaviour on older Julia version
run_makedocs(["hardscope.md"]) do result, success, backtrace, output
@test success
@test is_same_as_file(output, rfile("42.stdout"))
end
# Tests for special REPL softscope
run_makedocs(["softscope.md"]) do result, success, backtrace, output
@test success
@test is_same_as_file(output, rfile("41.stdout"))
end
end

Expand Down
3 changes: 1 addition & 2 deletions test/doctests/fix/tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ using ..TestUtilities: @quietly
const DocTestFixArray_2468 = Main.ShowWrap("4×1×1 Array{Int64,3}:\n[:, :, 1] =\n 2\n 4\n 6\n 8")
end

# The version check is necessary due to a behaviour change in https://github.com/JuliaLang/julia/pull/32851
mktempdir_nocleanup(dir) = VERSION >= v"1.3.0-alpha.112" ? mktempdir(dir, cleanup = false) : mktempdir(dir)
mktempdir_nocleanup(dir) = mktempdir(dir, cleanup = false)

function normalize_line_endings(filename)
s = read(filename, String)
Expand Down
51 changes: 0 additions & 51 deletions test/doctests/src/hardscope.md

This file was deleted.

8 changes: 2 additions & 6 deletions test/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ module A
end
end

# hasfield was added in Julia 1.2. This definition borrowed from Compat.jl (MIT)
# Note: this can not be inside the testset
(VERSION < v"1.2.0-DEV.272") && (hasfield(::Type{T}, name::Symbol) where T = Base.fieldindex(T, name, false) > 0)

@testset "Utilities" begin
let doc = @doc(length)
a = Documenter.Utilities.filterdocs(doc, Set{Module}())
Expand Down Expand Up @@ -299,7 +295,7 @@ end
end
end

@testset "PR #1634, issue #1655" begin; if VERSION > v"1.6.0"
@testset "PR #1634, issue #1655" begin
let parse(x) = Documenter.Utilities.parseblock(x, nothing, nothing;
linenumbernode=LineNumberNode(123, "testfile.jl")
)
Expand Down Expand Up @@ -337,7 +333,7 @@ end
@test exs[1][1].args[2] == Expr(:call, :+, 1, 1)
end
end
end end
end

@testset "mdparse" begin
mdparse = Documenter.Utilities.mdparse
Expand Down