From a0937b755fce184dd7542d018135a38c3bf07a3b Mon Sep 17 00:00:00 2001 From: Shashi Gowda Date: Wed, 25 Jul 2018 06:23:21 +0530 Subject: [PATCH] do JSON-based Jupyter config properly --- deps/build.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/deps/build.jl b/deps/build.jl index bf54be0b..b42a16c0 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -30,6 +30,25 @@ function install_ijulia_config() $END_MARKER """ write(config_file, config_str) + config_file_json = joinpath(homedir(), ".jupyter", "jupyter_notebook_config.json") + + if isfile(config_file_json) + dict = try + JSON.parse(read(config_file_json, String)) + catch err + println(STDERR, "Error parsing Jupyter config file $config_file_json - fix it and build again or delete it to enable WebIO") + @goto jsondone + end + app = Base.@get! dict "NotebookApp" Dict() + nbext = Base.@get! app "nbserver_extensions" Dict() + nbext["jlstaticserve"] = true + open(config_file_json, "w") do io + prettyio = JSON.Writer.PrettyContext(io, 4) + JSON.print(prettyio, dict) + end + end + @label jsondone + write("load_paths.json", loadpath) end