Skip to content

Commit

Permalink
Merge pull request #110 from JuliaCollections/teh/j1.0
Browse files Browse the repository at this point in the history
Unbreak Julia 1.0
  • Loading branch information
oscardssmith authored Jun 23, 2022
2 parents 8970a89 + 46a51f7 commit 69faf4e
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0' # 1.0 is only partially tested; in the next breaking release, add [compat] 'julia = "1.6"' and drop this
- '1.6'
- '1'
- 'nightly'
Expand Down
4 changes: 1 addition & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name = "AbstractTrees"
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
version = "0.4.1"
authors = ["Keno Fischer <[email protected]>"]

[deps]
version = "0.4.2"

[compat]
julia = "1"
Expand Down
5 changes: 5 additions & 0 deletions src/AbstractTrees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ include("iteration.jl")
include("builtins.jl")
include("printing.jl")

# Julia 1.0 support (delete when we no longer support it)
if !isdefined(Base, :isnothing)
isnothing(x) = x === nothing
end


#interface
export ParentLinks, StoredParents, ImplicitParents
Expand Down
2 changes: 1 addition & 1 deletion src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function is not available.
Equivalence is established with the `equiv` function. Note that new methods should also define `equiv` or calls
may fall back to the default method.
"""
isdescendant(node1, node2; equiv=()) = !equiv(node1, node2) && intree(node1, node2; equiv)
isdescendant(node1, node2; equiv=()) = !equiv(node1, node2) && intree(node1, node2; equiv=equiv)


"""
Expand Down
4 changes: 2 additions & 2 deletions src/printing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ function print_tree(printnode::Function, io::IO, node;
end

print_tree(printnode, io, child;
maxdepth, indicate_truncation, charset, printkeys,
depth=depth+1, prefix=child_prefix
maxdepth=maxdepth, indicate_truncation=indicate_truncation, charset=charset,
printkeys=printkeys, depth=depth+1, prefix=child_prefix
)
end
end
Expand Down
1 change: 1 addition & 0 deletions test/examples.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Ensure that we can run all files in the examples directory with no errors.
# Note: fstree doesn't work on Julia 1.0

exampledir = joinpath(dirname(@__DIR__), "examples")
examples = readdir(exampledir)
Expand Down
3 changes: 3 additions & 0 deletions test/examples/binarytree.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using AbstractTrees

if !isdefined(Base, :isnothing) # Julia 1.0 support
using AbstractTrees: isnothing
end

mutable struct BinaryNode{T}
data::T
Expand Down
3 changes: 2 additions & 1 deletion test/examples/fstree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ AbstractTrees.printnode(io::IO, d::Directory) = print(io, basename(d.path))
AbstractTrees.printnode(io::IO, f::File) = print(io, basename(f.path))

function mk_tree_test_dir(f, parentdir=tempdir(); prefix="jl_")
mktempdir(parentdir; prefix) do path
# While Julia 1.0 can parse this, `mktempdir` does not support the `prefix` kw
mktempdir(parentdir; prefix=prefix) do path
cd(path) do
open(io -> write(io, "test1"), "f1"; write=true)
mkdir("A")
Expand Down
6 changes: 4 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ using AbstractTrees, Test

@testset "Builtins" begin include("builtins.jl") end
@testset "Custom tree types" begin include("trees.jl") end
@testset "Printing" begin include("printing.jl") end

if Base.VERSION >= v"1.6"
# Printing tests use `findall` variants that are not supported on Julia 1.0
@testset "Printing" begin include("printing.jl") end
end
2 changes: 1 addition & 1 deletion test/trees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ end
include(joinpath(@__DIR__,"examples","fstree.jl"))

@testset "FSNode" begin
mk_tree_test_dir() do path
Base.VERSION >= v"1.6" && mk_tree_test_dir() do path
tree = Directory(".")

ls = nodevalue.((collect Leaves)(tree))
Expand Down

2 comments on commit 69faf4e

@oscardssmith
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/62967

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.2 -m "<description of version>" 69faf4e96166dff3b4ae8369ca8c54fc7de975bc
git push origin v0.4.2

Please sign in to comment.