Skip to content

Commit

Permalink
Specify channel when adding package. (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
rofinn authored and stevengj committed Jan 31, 2019
1 parent 3f681ee commit 3d84627
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Conda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ end
const PkgOrPkgs = Union{AbstractString, AbstractVector{<: AbstractString}}

"Install a new package or packages."
function add(pkg::PkgOrPkgs, env::Environment=ROOTENV)
runconda(`install $(_quiet()) -y $pkg`, env)
function add(pkg::PkgOrPkgs, env::Environment=ROOTENV; channel::AbstractString="")
c = isempty(channel) ? `` : `-c $channel`
runconda(`install $(_quiet()) -y $c $pkg`, env)
end

"Uninstall a package or packages."
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ Conda.rm_channel("foo", env)

@test Conda.channels(env) == ["defaults"]

# Add a package from a specific channel
Conda.add("requests", env; channel="conda-forge")

@testset "Batch install and uninstall" begin
Conda.add(["affine", "ansi2html"], env)
installed = Conda._installed_packages(env)
Expand Down

0 comments on commit 3d84627

Please sign in to comment.