Skip to content

Commit

Permalink
Additional workarounds for jupyter-kernelspec.exe
Browse files Browse the repository at this point in the history
This proposed change amends and extends the previously included (so-called) hacks for Windows that were added for issue JuliaLang#363 (that are waiting on issue JuliaLang#448 for the jupyter project).  These changes allow for IJulia to work a version of Python that has been downloaded from python.org, where jupyter was pip installed with a version recent enough to include jupyter-kernelspec.exe and jupyter-notebook.exe, and where the end user has set the JUPYTER environment variable either at the system level or in ENV within their Julia session prior to building IJulia via Pkg.build.

If the issues that led to the discussion in JuliaLang#363 and jupyter issue JuliaLang#448 have been addressed, then the changes in this commit and PR can likely be ignored.
  • Loading branch information
AndyGreenwell committed Apr 21, 2016
1 parent 1c365bf commit 6ae5e81
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,26 @@ catch
end
python = abspath(Conda.PYTHONDIR, "python.exe")
else
jk_path = readchomp(`where.exe $jupyter-kernelspec`)
jn_path = readchomp(`where.exe $jupyter-notebook`)
# jupyter-kernelspec should start with "#!/path/to/python":
python = strip(chomp(open(readline, jk_path, "r"))[3:end])
# strip quotes, if any
if python[1] == python[end] == '"'
python = python[2:end-1]
jupyter_dir = splitdir(jupyter)[1]
jks_exe = joinpath(jupyter_dir, "jupyter-kernelspec.exe")
if !isfile(jks_exe)
jk_path = readchomp(`where.exe $jupyter-kernelspec`)
jn_path = readchomp(`where.exe $jupyter-notebook`)
# jupyter-kernelspec should start with "#!/path/to/python":
python = strip(chomp(open(readline, jk_path, "r"))[3:end])
# strip quotes, if any
if python[1] == python[end] == '"'
python = python[2:end-1]
end
else
jn_path = joinpath(jupyter_dir, "jupyter-notebook.exe")
end
end
run(`$python $jk_path install --replace --user $juliakspec`)
if isfile(jks_exe)
run(`$jks_exe install --replace --user $juliakspec`)
else
run(`$python $jk_path install --replace --user $juliakspec`)
end
if endswith(jn_path, ".exe")
push!(notebook, jn_path)
else
Expand Down

0 comments on commit 6ae5e81

Please sign in to comment.