diff --git a/deps/build.jl b/deps/build.jl index 7bd4b393..85fed4cd 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -141,9 +141,12 @@ function whichfirst(args...) return "" end +const prefsfile = VERSION < v"0.7" ? "PYTHON" : joinpath(first(DEPOT_PATH), "prefs", "PyCall") +mkpath(dirname(prefsfile)) + try # make sure deps.jl file is removed on error python = try - let py = get(ENV, "PYTHON", isfile("PYTHON") ? readchomp("PYTHON") : + let py = get(ENV, "PYTHON", isfile(prefsfile) ? readchomp(prefsfile) : (Compat.Sys.isunix() && !Compat.Sys.isapple()) || Sys.ARCH ∉ (:i686, :x86_64) ? whichfirst("python3", "python") : "Conda"), vers = isempty(py) || py == "Conda" ? v"0.0" : vparse(pyconfigvar(py,"VERSION","0.0")) @@ -227,7 +230,7 @@ try # make sure deps.jl file is removed on error """) # Make subsequent builds (e.g. Pkg.update) use the same Python by default: - writeifchanged("PYTHON", use_conda ? "Conda" : isfile(programname) ? programname : python) + writeifchanged(prefsfile, use_conda ? "Conda" : isfile(programname) ? programname : python) #########################################################################