JuliaPy / Conda.jl

Conda managing Julia binary dependencies
Other
171 stars 57 forks source link

Introduce CONDA_JL_CONDA_EXE environment variable #216

Closed mkitti closed 2 years ago

mkitti commented 2 years ago

Here we introduce a new environment variable, CONDA_JL_CONDA_EXE which determines the location of the conda executable at build time. This in turn is saved in deps.jl as the constant CONDA_EXE. This in turn defines the constant Conda.conda. If CONDA_EXE does not exist due to an old deps.jl file, Conda.conda is defined in manner prior to this PR.

The default CONDA_EXE is defined by the following code based on ROOTENV.

        const CONDA_EXE = if Sys.iswindows()
            p = joinpath(ROOTENV, "Script")
            conda_bat = joinpath(p, "conda.bat")
            isfile(conda_bat) ? conda_bat : joinpath(p, "conda.exe")
        else
            joinpath(ROOTENV, "bin", "conda")
        end

Conda.jl also has a method _install_conda which installs conda if the executable is not present. To determine the PREFIX for this installation the following code is used: CONDA_EXE_PREFIX = conda |> dirname |> dirname.

mkitti commented 2 years ago

Could we run the CI to see if there are any current issues?

codecov-commenter commented 2 years ago

Codecov Report

Merging #216 (84c662c) into master (f169018) will decrease coverage by 2.38%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #216      +/-   ##
==========================================
- Coverage   91.83%   89.44%   -2.39%     
==========================================
  Files           1        1              
  Lines         196      199       +3     
==========================================
- Hits          180      178       -2     
- Misses         16       21       +5     
Impacted Files Coverage Δ
src/Conda.jl 89.44% <100.00%> (-2.39%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f169018...84c662c. Read the comment docs.

mkitti commented 2 years ago

Great. Thanks for the help. It looks like this can also be used to use mamba in place of conda.

$ CONDA_JL_CONDA_EXE=~/mambaforge/bin/mamba julia

(@v1.7) pkg> build Conda
    Building Conda → `~/.julia/dev/Conda/deps/build.log`
Precompiling project...
  1 dependency successfully precompiled in 1 seconds (16 already precompiled)

julia> Conda.conda
"/home/mkitti/mambaforge/bin/mamba"

julia> Conda.list()
[ Info: Running `conda list` in root environment
# packages in environment at /home/mkitti/.julia/conda/3:
mkitti commented 2 years ago

@stevengj , would you like to review before we merge this?

mkitti commented 2 years ago

Would anyone object to merging by the end of this week if we do not hearing anything else?

mkitti commented 2 years ago

Thank you for the reviews. Can we merge this?

mkitti commented 2 years ago

Thanks again for studying this pull request. I would like to merge this tomorrow if I there are no further concerns.