From 9de07b7babfa099b88743de2e9b00fa26d768a8b Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 25 Jul 2018 11:39:16 -0400 Subject: [PATCH] move BinDeps support to a separate package (#111) --- README.md | 72 ++++++++------------------------------------ REQUIRE | 1 - src/Conda.jl | 19 +----------- src/bindeps_conda.jl | 43 -------------------------- test/runtests.jl | 2 +- 5 files changed, 14 insertions(+), 123 deletions(-) delete mode 100644 src/bindeps_conda.jl diff --git a/README.md b/README.md index c88e591..98fb397 100644 --- a/README.md +++ b/README.md @@ -3,26 +3,15 @@ [![Build Status -- OS X and Linux](https://travis-ci.org/JuliaPy/Conda.jl.svg?branch=master)](https://travis-ci.org/JuliaPy/Conda.jl) [![Build status -- Windows](https://ci.appveyor.com/api/projects/status/edlxohso05re3v40/branch/master?svg=true)](https://ci.appveyor.com/project/StevenGJohnson/conda-jl) -This package allows one to use [conda](http://conda.pydata.org/) as a binary -provider for Julia. While other binary providers like -[Homebrew.jl](https://github.com/JuliaLang/Homebrew.jl), -[AptGet](https://en.wikipedia.org/wiki/Advanced_Packaging_Tool#apt-get) or -[WinRPM.jl](https://github.com/JuliaLang/WinRPM.jl) are platform-specific, -Conda.jl is a cross-platform alternative. It can also be used without -administrator rights, in contrast to the current Linux-based providers. - -As such, `Conda.jl` primary audience is Julia packages developers who have a -dependency on some native library. +This package allows one to use [conda](http://conda.pydata.org/) as a cross-platform binary provider for Julia for other Julia packages, +especially to install binaries that have complicated dependencies +like Python. `conda` is a package manager which started as the binary package manager for the Anaconda Python distribution, but it also provides arbitrary packages. Instead of the full Anaconda distribution, `Conda.jl` uses the miniconda Python environment, which only includes `conda` and its dependencies. -`Conda.jl` is **NOT** an alternative Julia package manager, nor a way to manage -Python installations. It will not use any pre-existing Anaconda or Python -installation on your machine. - ## Basic functionality You can install this package by running `Pkg.add("Conda")` at the Julia prompt. @@ -37,7 +26,7 @@ Basic package managing utilities are provided in the Conda module: - `Conda.channels(env)`: get the current list of channels; - `Conda.rm_channel(channel, env)`: remove a channel from the list of channels; -Parameter `env` is optional and defaults to `ROOTENV`. See below for more info. +The parameter `env` is optional and defaults to `ROOTENV`. See below for more info. ### Conda environments @@ -68,48 +57,12 @@ environment.) ## BinDeps integration: using Conda.jl as a package author Conda.jl can be used as a `Provider` for -[BinDeps](https://github.com/JuliaLang/BinDeps.jl) with the `Conda.Manager` -type. You first need to write a [conda -recipe](http://conda.pydata.org/docs/building/recipe.html), and upload the -corresponding build to [binstar](https://binstar.org/). Then, add Conda in your -REQUIRE file, and add the following to your `deps/build.jl` file: - -```julia -using BinDeps -@BinDeps.setup -netcdf = library_dependency("netcdf", aliases = ["libnetcdf","libnetcdf4"]) - -... - -using Conda -provides(Conda.Manager, "libnetcdf", netcdf) -``` - -If your dependency is available in another channel than the default one, you -should register that channel. - -```julia -using Conda -Conda.add_channel("my_channel") -provides(Conda.Manager, "libnetcdf", netcdf) -``` - -If the binary dependency is only available for some OS, give this information to -BinDeps: - -```julia -provides(Conda.Manager, "libnetcdf", netcdf, os=:Linux) -``` - -To tell BinDeps to install the package to an environment different from the -root environment, use `EnvManager`. - -```julia -provides(Conda.EnvManager{:my_env}, "libnetcdf", netcdf) -``` +[BinDeps](https://github.com/JuliaLang/BinDeps.jl) with the +[CondaBinDeps](https://github.com/JuliaPackaging/CondaBinDeps.jl) +package. -## Using an already existing Conda installation -To use an already existing Conda installation, first create an environment for +## Using a pre-existing Conda installation +To use a pre-existing Conda installation, first create an environment for `Conda.jl` and then set the `CONDA_JL_HOME` environment variable to the full path of the environment. You have to rebuild `Conda.jl` and many of the packages that use it after this. @@ -137,13 +90,12 @@ variable on [TravisCI](https://docs.travis-ci.com/user/environment-variables/) a ## Bugs and suggestions -Conda have been tested on Linux, OS X, and Windows. It should work on all these -platforms. +Conda has been tested on Linux, OS X, and Windows. Please report any bug or suggestion as an -[issue](https://github.com/Luthaf/Conda.jl/issues) +[github issue](https://github.com/JuliaPy/Conda.jl/issues) -## Licence +## License The Conda.jl package is licensed under the MIT Expat license, and is copyrighted by Guillaume Fraux and contributors. diff --git a/REQUIRE b/REQUIRE index f9ed355..1d0a382 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,5 +1,4 @@ julia 0.6 -BinDeps Compat 0.62.0 JSON VersionParsing diff --git a/src/Conda.jl b/src/Conda.jl index 2d8554f..dbddf41 100644 --- a/src/Conda.jl +++ b/src/Conda.jl @@ -2,8 +2,7 @@ __precompile__() """ The Conda module provides access to the [conda](http://conda.pydata.org/) packages -manager. Its main purpose is to be used as a BinDeps provider, to install binary -dependencies of other Julia packages. +manager to install binary dependencies of other Julia packages. The main functions in Conda are: @@ -14,20 +13,6 @@ The main functions in Conda are: - `Conda.add_channel(channel)`: add a channel to the list of channels; - `Conda.channels()`: get the current list of channels; - `Conda.rm_channel(channel)`: remove a channel from the list of channels; - -To use Conda as a binary provider for BinDeps, the `Conda.Manager` type is proposed. A -small example looks like this: - -```julia -# Declare dependency -using BinDeps -@BinDeps.setup -netcdf = library_dependency("netcdf", aliases = ["libnetcdf","libnetcdf4"]) - -using Conda -# Use alternative conda channel. -Conda.add_channel("my_channel") -provides(Conda.Manager, "libnetcdf", netcdf) ``` """ module Conda @@ -295,6 +280,4 @@ function rm_channel(channel::AbstractString, env::Environment=ROOTENV) runconda(`config --remove channels $channel --force`, env) end -include("bindeps_conda.jl") - end diff --git a/src/bindeps_conda.jl b/src/bindeps_conda.jl deleted file mode 100644 index 21111b9..0000000 --- a/src/bindeps_conda.jl +++ /dev/null @@ -1,43 +0,0 @@ -# This file contains the necessary ingredients to create a PackageManager for BinDeps -using BinDeps - -struct EnvManager{T} <: BinDeps.PackageManager - packages::Vector{String} -end - -"Manager for root environment" -const Manager = EnvManager{Symbol(PREFIX)} - -function Base.show(io::IO, manager::EnvManager) - write(io, "Conda packages: ", join(manager.packages, ", ")) -end - -BinDeps.can_use(::Type{EnvManager}) = true - -function BinDeps.package_available(manager::EnvManager{T}) where {T} - pkgs = manager.packages - # For each package, see if we can get info about it. If not, fail out - for pkg in pkgs - if !exists(pkg, T) - return false - end - end - return true -end - -BinDeps.libdir(m::EnvManager{T}, ::Any) where {T} = lib_dir(T) -BinDeps.bindir(m::EnvManager{T}, ::Any) where {T} = bin_dir(T) - -BinDeps.provider(::Type{EnvManager{T}}, packages::AbstractVector{<:AbstractString}; opts...) where {T} = EnvManager{T}(packages) -BinDeps.provider(::Type{EnvManager{T}}, packages::AbstractString; opts...) where {T} = EnvManager{T}([packages]) - -function BinDeps.generate_steps(dep::BinDeps.LibraryDependency, manager::EnvManager, opts) - pkgs = manager.packages - ()->install(pkgs, manager) -end - -function install(pkgs, manager::EnvManager{T}) where {T} - for pkg in pkgs - add(pkg, T) - end -end diff --git a/test/runtests.jl b/test/runtests.jl index a15cf53..a8fa7e4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using Conda, BinDeps, Compat, VersionParsing +using Conda, Compat, VersionParsing using Compat.Test Conda.update()