From 984906e5e954a6569ab86eb9d4b3d1904e4469e4 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 22 Aug 2021 16:25:08 +0200 Subject: [PATCH 1/5] Support Julia 1.3 --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 85b8c93..f598e0e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MeshIO" uuid = "7269a6da-0436-5bbc-96c2-40638cbb6118" author = "Simon Danisch" -version = "0.4.8" +version = "0.4.9" [deps] ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" @@ -13,7 +13,7 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" ColorTypes = "0.8, 0.9, 0.10, 0.11" FileIO = "1.2.4" GeometryBasics = "0.4.1" -julia = "1.4" +julia = "1.3" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" From 6a860f11f7322b1a2fca429b81f98adc402a009a Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 22 Aug 2021 16:26:06 +0200 Subject: [PATCH 2/5] Update CI.yml --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5ed4a12..23e6e72 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: version: - - '1.4' + - '1.3' - '1.6' os: - ubuntu-latest From 282a0bf20e76a4c0198957841f27f27fc5949500 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 22 Aug 2021 22:08:59 +0200 Subject: [PATCH 3/5] Fix errors with Julia 1.3 --- src/MeshIO.jl | 10 ++++++++++ src/io/obj.jl | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/MeshIO.jl b/src/MeshIO.jl index 56ed372..fd03892 100644 --- a/src/MeshIO.jl +++ b/src/MeshIO.jl @@ -41,4 +41,14 @@ if Base.VERSION >= v"1.4.2" _precompile_() end +# `filter(f, ::Tuple)` is not available on Julia 1.3 +# https://github.com/JuliaLang/julia/pull/29259 +function filtertuple(f, xs::Tuple) + return @static if VERSION < v"1.4.0-DEV.551" + Base.afoldl((ys, x) -> f(x) ? (ys..., x) : ys, (), xs...) + else + filter(f, xs) + end +end + end # module diff --git a/src/io/obj.jl b/src/io/obj.jl index 159cfe0..df484ac 100644 --- a/src/io/obj.jl +++ b/src/io/obj.jl @@ -51,7 +51,7 @@ function load(io::Stream{format"OBJ"}; facetype=GLTriangleFace, end point_attributes = Dict{Symbol, Any}() - non_empty_faces = filter(f -> !isempty(f), f_uv_n_faces) + non_empty_faces = filtertuple(!isempty, f_uv_n_faces) if length(non_empty_faces) > 1 N = length(points) From 470cc8b904a394a4cea15671c70bc576267bfbda Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 22 Aug 2021 22:09:24 +0200 Subject: [PATCH 4/5] Reduce imports --- src/MeshIO.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/MeshIO.jl b/src/MeshIO.jl index fd03892..9549b19 100644 --- a/src/MeshIO.jl +++ b/src/MeshIO.jl @@ -3,11 +3,9 @@ module MeshIO using GeometryBasics using ColorTypes using Printf -import FileIO using GeometryBasics: raw, value, decompose_normals, convert_simplex -import FileIO: DataFormat, @format_str, Stream, File, filename, stream -import FileIO: skipmagic, add_format +using FileIO: FileIO, @format_str, Stream, File, stream, skipmagic import Base.show From d0a131e027498d7535c88429bdbf99852d860f6d Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 22 Aug 2021 22:09:35 +0200 Subject: [PATCH 5/5] Fix deprecations --- test/runtests.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 5e51bfe..e68516a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -34,17 +34,17 @@ end end end @testset "PLY ascii and binary" begin - f = File(format"PLY_ASCII", joinpath(tmpdir, "test.ply")) + f = File{format"PLY_ASCII"}(joinpath(tmpdir, "test.ply")) save(f, mesh) mesh_loaded = load(joinpath(tmpdir, "test.ply")) @test mesh_loaded == mesh - save(File(format"PLY_BINARY", joinpath(tmpdir, "test.ply")), mesh) + save(File{format"PLY_BINARY"}(joinpath(tmpdir, "test.ply")), mesh) end @testset "STL ascii and binary" begin - save(File(format"STL_ASCII", joinpath(tmpdir, "test.stl")), mesh) + save(File{format"STL_ASCII"}(joinpath(tmpdir, "test.stl")), mesh) mesh_loaded = load(joinpath(tmpdir, "test.stl")) @test Set(mesh.position) == Set(mesh_loaded.position) - save(File(format"STL_BINARY", joinpath(tmpdir, "test.stl")), mesh) + save(File{format"STL_BINARY"}(joinpath(tmpdir, "test.stl")), mesh) mesh_loaded = load(joinpath(tmpdir, "test.stl")) @test Set(mesh.position) == Set(mesh_loaded.position) end @@ -71,7 +71,7 @@ end @test test_face_indices(msh) mktempdir() do tmpdir - save(File(format"STL_BINARY", joinpath(tmpdir, "test.stl")), msh) + save(File{format"STL_BINARY"}(joinpath(tmpdir, "test.stl")), msh) msh1 = load(joinpath(tmpdir, "test.stl")) @test msh1 isa GLNormalMesh @test faces(msh) == faces(msh1)