Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin implementing null backend #29

Merged
merged 5 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ by setting the environment variable `JULIA_CONDAPKG_BACKEND` to one of the follo
[MicroMamba.jl](https://github.com/cjdoris/MicroMamba.jl).
- `System`: Use a pre-installed Conda. If `JULIA_CONDAPKG_EXE` is set, that is used.
Otherwise we look for `conda`, `mamba` or `micromamba` in your `PATH`.
- `Null`: Don't use `CondaPkg.jl` to manage dependencies,
eg. If you are using a pre-existing conda installation that satisfies the dependencies of your project.
There are no guarantees that things won't break if you do this.

The default backend is an implementation detail, but is currently `MicroMamba`.

Expand Down
5 changes: 5 additions & 0 deletions src/backend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function backend()
end
if backend == "MicroMamba"
STATE.backend = :MicroMamba
elseif backend == "Null"
STATE.backend = :Null
elseif backend == "System"
ok = false
for exe in (exe == "" ? ["micromamba", "mamba", "conda"] : [exe])
Expand Down Expand Up @@ -36,6 +38,9 @@ function conda_cmd(args=``; io::IO=stderr)
b = backend()
if b == :MicroMamba
MicroMamba.cmd(args, io=io)
elseif b == :Null
@error "Backend is 'Null' - no action taken"
return nothing
kescobo marked this conversation as resolved.
Show resolved Hide resolved
elseif b == :System
`$(STATE.condaexe) $args`
else
Expand Down
1 change: 1 addition & 0 deletions src/env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This file defines functions for interacting with the environment, such as `withe
"Activate" the Conda environment by modifying the given dict of environment variables.
"""
function activate!(e)
backend() == :Null && return e
old_path = get(e, "PATH", "")
d = envdir()
path_sep = Sys.iswindows() ? ';' : ':'
Expand Down