From 7f166919a5785cfc0b072e456a71f97a52fbe3ef Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Fri, 25 Sep 2015 01:09:57 -0700 Subject: [PATCH 1/2] Add test of loading precompiled JSON without DataStructures present --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index be907fc..4ab4924 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,6 @@ sudo: false script: - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - julia -e 'Pkg.clone(pwd()); Pkg.build("JSON"); Pkg.test("JSON"; coverage=true)'; + - julia -e 'using JSON' # loading after precompiled, but without DataStructures present after_success: - julia -e 'cd(Pkg.dir("JSON")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'; From 0716a1ccc00e63461e03851387390fdcd43d0c35 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Fri, 25 Sep 2015 01:12:27 -0700 Subject: [PATCH 2/2] Move conditional dependency on DataStructures into an __init__ function --- src/Parser.jl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Parser.jl b/src/Parser.jl index 1c5182c..060d3af 100644 --- a/src/Parser.jl +++ b/src/Parser.jl @@ -3,12 +3,13 @@ module Parser #JSON using Compat #Define ordered dictionary from DataStructures if present -_HAVE_DATASTRUCTURES = try - using DataStructures - import DataStructures.OrderedDict - true -catch - false +function __init__() + global _HAVE_DATASTRUCTURES = try + @eval import DataStructures.OrderedDict + true + catch + false + end end const TYPES = Any # Union{Dict, Array, AbstractString, Number, Bool, Void} # Types it may encounter