@@ -128,13 +128,6 @@ function _installer_url()
128128 elseif Compat. Sys. islinux ()
129129 res *= " Linux"
130130 elseif Compat. Sys. iswindows ()
131- if MINICONDA_VERSION == " 3"
132- # Quick fix for:
133- # * https://github.com/JuliaLang/IJulia.jl/issues/739
134- # * https://github.com/ContinuumIO/anaconda-issues/issues/10082
135- # * https://github.com/conda/conda/issues/7789
136- res = " https://repo.continuum.io/miniconda/Miniconda$(MINICONDA_VERSION) -4.5.4-"
137- end
138131 res *= " Windows"
139132 else
140133 error (" Unsuported OS." )
147140" Suppress progress bar in continuous integration environments"
148141_quiet () = get (ENV , " CI" , " false" ) == " true" ? ` -q` : ` `
149142
143+ """
144+ Python version to be used when `MINICONDA_VERSION == "3"`. As it
145+ takes time for conda packages to be registered after new Python is
146+ released, it is useful to delay updating Python interpreter.
147+ See: https://github.com/JuliaPy/Conda.jl/issues/127
148+
149+ Note that https://github.com/JuliaPy/Conda.jl/issues/125 must be
150+ resolved before bumping this to 3.7.
151+ """
152+ const _default_python3 = " python=3.6"
153+
150154" Install miniconda if it hasn't been installed yet; _install_conda(true) installs Conda even if it has already been installed."
151155function _install_conda (env:: Environment , force:: Bool = false )
152156 if force || ! isfile (Conda. conda)
@@ -168,6 +172,10 @@ function _install_conda(env::Environment, force::Bool=false)
168172 run (Cmd (` $installer /S /AddToPath=0 /RegisterPython=0 /D=$PREFIX ` , windows_verbatim= true ))
169173 end
170174 Conda. add_channel (" defaults" )
175+ if MINICONDA_VERSION == " 3"
176+ add (_default_python3, env)
177+ pin (_default_python3, env)
178+ end
171179 # Update conda because conda 4.0 is needed and miniconda download installs only 3.9
172180 runconda (` update $(_quiet ()) -y conda` )
173181 end
@@ -287,4 +295,36 @@ function rm_channel(channel::AbstractString, env::Environment=ROOTENV)
287295 runconda (` config --remove channels $channel --force` , env)
288296end
289297
298+ """
299+ Conda.pin(sepc, [env])
300+
301+ Pin version of given package. Use `Conda.free` to unpin the package.
302+
303+ # Examples
304+ ```
305+ julia> Conda.pin("matplotlib<3")
306+ julia> Conda.pin("pandas=0.23")
307+ julia> Conda.pin("defaults::numpy")
308+ ```
309+ """
310+ function pin (spec:: AbstractString , env:: Environment = ROOTENV)
311+ runconda (` config --add pinned_packages $spec ` , env)
312+ end
313+
314+ """
315+ Conda.free(sepc, [env])
316+
317+ Remove `spec` from `pinned_packages` configuration.
318+
319+ # Examples
320+ ```
321+ julia> Conda.free("matplotlib<3")
322+ julia> Conda.free("pandas=0.23")
323+ julia> Conda.free("defaults::numpy")
324+ ```
325+ """
326+ function free (spec:: AbstractString , env:: Environment = ROOTENV)
327+ runconda (` config --remove pinned_packages $spec ` , env)
328+ end
329+
290330end
0 commit comments