Skip to content

Commit 1ba2b8d

Browse files
authored
store prefs in depot_path/prefs (#589)
* store prefs in depot_path/prefs As a stopgap until we get proper package options (JuliaLang/Juleps#38), store PYTHON preference in depot_path/prefs/PyCall so that they aren't forgotten when PyCall is updated * whoops
1 parent 0bdcc10 commit 1ba2b8d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

deps/build.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ function whichfirst(args...)
141141
return ""
142142
end
143143

144+
const prefsfile = VERSION < v"0.7" ? "PYTHON" : joinpath(first(DEPOT_PATH), "prefs", "PyCall")
145+
mkpath(dirname(prefsfile))
146+
144147
try # make sure deps.jl file is removed on error
145148
python = try
146-
let py = get(ENV, "PYTHON", isfile("PYTHON") ? readchomp("PYTHON") :
149+
let py = get(ENV, "PYTHON", isfile(prefsfile) ? readchomp(prefsfile) :
147150
(Compat.Sys.isunix() && !Compat.Sys.isapple()) || Sys.ARCH (:i686, :x86_64) ?
148151
whichfirst("python3", "python") : "Conda"),
149152
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
227230
""")
228231

229232
# Make subsequent builds (e.g. Pkg.update) use the same Python by default:
230-
writeifchanged("PYTHON", use_conda ? "Conda" : isfile(programname) ? programname : python)
233+
writeifchanged(prefsfile, use_conda ? "Conda" : isfile(programname) ? programname : python)
231234

232235
#########################################################################
233236

0 commit comments

Comments
 (0)