From 8ebe784ff40633509253113226e5f54ff77527df Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 5 Jun 2018 09:47:44 -0500 Subject: [PATCH 1/9] Add Julia 0.7 to CI --- .travis.yml | 3 ++- appveyor.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c33681c83..2680d8beb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,8 @@ os: - osx - linux julia: - - "0.6" + - 0.6 + - 0.7 - nightly notifications: email: false diff --git a/appveyor.yml b/appveyor.yml index 007171fc0..6e87bb7af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,8 @@ environment: matrix: - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" From 860e3e06bab7488e55e54d80d6e638de09e43fed Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 5 Jun 2018 09:48:45 -0500 Subject: [PATCH 2/9] Address JULIA_HOME deprecation --- REQUIRE | 2 +- src/tzdata/archive.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/REQUIRE b/REQUIRE index 03e404cd1..0c4a7e8d7 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,5 +1,5 @@ julia 0.6 -Compat 0.62 +Compat 0.66 Mocking 0.4.1 Nullables 0.0.3 @windows LightXML 0.2 diff --git a/src/tzdata/archive.jl b/src/tzdata/archive.jl index 47e784e5c..e33bc818b 100644 --- a/src/tzdata/archive.jl +++ b/src/tzdata/archive.jl @@ -1,7 +1,7 @@ import Compat: @static, Sys, devnull if Sys.iswindows() - const exe7z = joinpath(JULIA_HOME, "7z.exe") + const exe7z = joinpath(Sys.BINDIR, "7z.exe") end """ From 117c007fc40f431cca210e3db1103d1a11bc3788 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 5 Jun 2018 10:39:09 -0500 Subject: [PATCH 3/9] Address broadcasting update --- src/arithmetic.jl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/arithmetic.jl b/src/arithmetic.jl index 3791bfb91..82ed64d81 100644 --- a/src/arithmetic.jl +++ b/src/arithmetic.jl @@ -1,6 +1,13 @@ -import Base: +, -, .+, .-, broadcast +import Base: +, -, .+, .- import Compat: @static +if VERSION < v"0.7.0-DEV.4955" + import Base: broadcast + const broadcasted = broadcast +else + import Base.Broadcast: broadcasted +end + # ZonedDateTime arithmetic (+)(x::ZonedDateTime) = x (-)(x::ZonedDateTime, y::ZonedDateTime) = x.utc_datetime - y.utc_datetime @@ -18,7 +25,7 @@ function (-)(zdt::ZonedDateTime, p::TimePeriod) return ZonedDateTime(zdt.utc_datetime - p, timezone(zdt); from_utc=true) end -function broadcast(::typeof(+), r::StepRange{ZonedDateTime}, p::DatePeriod) +function broadcasted(::typeof(+), r::StepRange{ZonedDateTime}, p::DatePeriod) start, step, stop = first(r), Base.step(r), last(r) # Since the localtime + period can result in an invalid local datetime when working with @@ -42,4 +49,4 @@ function broadcast(::typeof(+), r::StepRange{ZonedDateTime}, p::DatePeriod) return StepRange(start, step, stop) end -broadcast(::typeof(-), r::StepRange{ZonedDateTime}, p::DatePeriod) = broadcast(+, r, -p) +broadcasted(::typeof(-), r::StepRange{ZonedDateTime}, p::DatePeriod) = broadcast(+, r, -p) From 42764c47a79012b2af0ff428207320749b13a0dd Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 5 Jun 2018 10:40:50 -0500 Subject: [PATCH 4/9] Address in-place broadcast assignment --- src/utils.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.jl b/src/utils.jl index f3f9d6705..4b604e834 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -48,7 +48,7 @@ function optional(ex::Expr) if i in dynamic name, value = arg.args new_sig[i] = name - default[dynamic .== i] = value + default[dynamic .== i] .= value else new_sig[i] = arg end From d061d91a892f5f643733df9c89bf36b04c5b1118 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 5 Jun 2018 10:45:17 -0500 Subject: [PATCH 5/9] Address iteration protocol update --- src/parse.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/parse.jl b/src/parse.jl index 1fc62b55e..2c81d2d50 100644 --- a/src/parse.jl +++ b/src/parse.jl @@ -8,13 +8,18 @@ else nullable(T::Type, x) = x # Ignore nullable container type T end +# https://github.com/JuliaLang/julia/pull/25261 +if VERSION < v"0.7.0-DEV.5126" + iterate(str::String, i::Int) = next(str, i) +end + function tryparsenext_fixedtz(str, i, len, min_width::Int=1, max_width::Int=0) tz_start, tz_end = i, 0 min_pos = min_width <= 0 ? i : i + min_width - 1 max_pos = max_width <= 0 ? len : min(chr2ind(str, ind2chr(str,i) + max_width - 1), len) state = 1 @inbounds while i <= max_pos - c, ii = next(str, i) + c, ii = iterate(str, i)::Tuple{Char, Int} if state == 1 && (c == '-' || c == '+') state = 2 tz_end = i @@ -49,7 +54,7 @@ function tryparsenext_tz(str, i, len, min_width::Int=1, max_width::Int=0) min_pos = min_width <= 0 ? i : i + min_width - 1 max_pos = max_width <= 0 ? len : min(chr2ind(str, ind2chr(str,i) + max_width - 1), len) @inbounds while i <= max_pos - c, ii = next(str, i) + c, ii = iterate(str, i)::Tuple{Char, Int} if c == '/' || c == '_' || isalpha(c) tz_end = i else From faf3631ce1999263e935d7555ede271030780622 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 5 Jun 2018 10:47:53 -0500 Subject: [PATCH 6/9] Address isalpha deprecation --- src/parse.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parse.jl b/src/parse.jl index 2c81d2d50..9da94c909 100644 --- a/src/parse.jl +++ b/src/parse.jl @@ -1,5 +1,6 @@ import Compat.Dates: DateFormat, DatePart, tryparsenext, format, min_width, max_width, default_format +using Compat: isletter # Handle Nullable deprecation on Julia 0.7 if VERSION < v"0.7.0-DEV.3017" @@ -55,7 +56,7 @@ function tryparsenext_tz(str, i, len, min_width::Int=1, max_width::Int=0) max_pos = max_width <= 0 ? len : min(chr2ind(str, ind2chr(str,i) + max_width - 1), len) @inbounds while i <= max_pos c, ii = iterate(str, i)::Tuple{Char, Int} - if c == '/' || c == '_' || isalpha(c) + if c == '/' || c == '_' || isletter(c) tz_end = i else break From 342f8d54c75e6e81a7173ee07b0ad9dad407e8e2 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Wed, 6 Jun 2018 10:42:04 -0500 Subject: [PATCH 7/9] Switch from LightXML to EzXML Making the switch as EzXML has better support for Julia 0.7 --- REQUIRE | 2 +- src/winzone/WindowsTimeZoneIDs.jl | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/REQUIRE b/REQUIRE index 0c4a7e8d7..d8f076d0f 100644 --- a/REQUIRE +++ b/REQUIRE @@ -2,4 +2,4 @@ julia 0.6 Compat 0.66 Mocking 0.4.1 Nullables 0.0.3 -@windows LightXML 0.2 +@windows EzXML 0.6 diff --git a/src/winzone/WindowsTimeZoneIDs.jl b/src/winzone/WindowsTimeZoneIDs.jl index 434580a28..242903d81 100644 --- a/src/winzone/WindowsTimeZoneIDs.jl +++ b/src/winzone/WindowsTimeZoneIDs.jl @@ -3,7 +3,7 @@ module WindowsTimeZoneIDs using Compat: @info import ...TimeZones: DEPS_DIR -using LightXML +using EzXML # A mapping of Windows timezone names to Olson timezone names. # Details on the contents of this file can be found at: @@ -17,27 +17,21 @@ isdir(WINDOWS_XML_DIR) || mkdir(WINDOWS_XML_DIR) function compile(xml_file::AbstractString) # Get the timezone conversions from the file - xdoc = parse_file(xml_file) - xroot = root(xdoc) - windows_zones = find_element(xroot, "windowsZones") - map_timezones = find_element(windows_zones, "mapTimezones") - map_zones = get_elements_by_tagname(map_timezones, "mapZone") + doc = readxml(xml_file) + + # Territory "001" is the global default + map_zones = find(doc, "//mapZone[@territory='001']") # TODO: Eliminate the Etc/* POSIX names here? See Windows section of `localzone` # Dictionary to store the windows to time zone conversions translation = Dict{String,String}() for map_zone in map_zones - # Territory "001" is the global default - if attribute(map_zone, "territory") == "001" - win_name = attribute(map_zone, "other") - posix_name = attribute(map_zone, "type") - translation[win_name] = posix_name - end + win_name = map_zone["other"] + posix_name = map_zone["type"] + translation[win_name] = posix_name end - free(xdoc) - return translation end From c1e096164aa23c1b02b1052b979920e09f06b63c Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Wed, 6 Jun 2018 11:01:12 -0500 Subject: [PATCH 8/9] Force Mocking to be enabled Allows us to no longer use Mocking from within the Travis CI file which only available within TimeZones in Julia 0.7 --- .travis.yml | 4 +--- test/runtests.jl | 18 +++++------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2680d8beb..433a0b106 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,7 @@ script: - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi # Avoid setting JULIA_TZ_VERSION if the deps/build.jl file has been modified - git fetch origin +:refs/remotes/origin/HEAD; if ! git diff --quiet origin/HEAD HEAD -- deps/build.jl; then unset JULIA_TZ_VERSION; fi - - julia -e 'Pkg.clone(pwd()); Pkg.build("TimeZones")' - - OPTIONS=$(julia -e 'using Mocking; print(DISABLE_COMPILED_MODULES_STR)') - - julia $OPTIONS -e 'Pkg.test("TimeZones"; coverage=true)' + - julia -e 'Pkg.clone(pwd()); Pkg.build("TimeZones"); Pkg.test("TimeZones"; coverage=true)' after_success: - julia -e 'cd(Pkg.dir("TimeZones")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'; - julia -e 'cd(Pkg.dir("TimeZones")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())' diff --git a/test/runtests.jl b/test/runtests.jl index ae970d6b2..1368fcb9b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,21 +1,13 @@ using Mocking -using Compat: occursin, @info, @warn +Mocking.enable(force=true) +const compiled_modules_enabled = false -compiled_modules_enabled = Mocking.compiled_modules_enabled() -if compiled_modules_enabled - flag = Mocking.COMPILED_MODULES_FLAG - @warn "`julia` not started with `--$flag=no`. Disabling tests that require Mocking" -else - Mocking.enable() -end - -VERSION < v"0.7-" && import Compat: Test -using Test +import Compat: Sys, occursin, @info, @warn +using Compat.Unicode +using Compat.Test using TimeZones import TimeZones: PKG_DIR, ARCHIVE_DIR import TimeZones.TZData: ZoneDict, RuleDict, tzparse, resolve, build -import Compat: Sys -using Compat.Unicode using Nullables const TZDATA_VERSION = "2016j" From 0dac2edce193eaa18d7c4df11ecabf4b87be902f Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Wed, 6 Jun 2018 14:14:39 -0500 Subject: [PATCH 9/9] Allow Windows failures on 0.7 --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 6e87bb7af..ac31427e0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,9 @@ environment: matrix: allow_failures: + # Failing due to https://github.com/bicycle1885/EzXML.jl/issues/66 + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"