diff --git a/src/Conda.jl b/src/Conda.jl index 610cd85..e9e391b 100644 --- a/src/Conda.jl +++ b/src/Conda.jl @@ -32,37 +32,23 @@ using JSON "Prefix for installation of all the packages." const PREFIX = abspath(dirname(@__FILE__), "..", "deps", "usr") """Returns the directory for the binary files of a package. Attention on unix - `bindir` and `scriptsdir` returns the same path while on windows it is two separate directories. - Use `scriptdir()` to ex. get numpy's f2py or ipython""" -@unix_only begin function bindir(package) - packages = _installed_packages_dict() - haskey(packages, package) || error("Package '$package' not found") - joinpath(PREFIX, "pkgs", packages[package][2], "bin") - end -end + `Conda.BINDIR` and `Conda.SCRIPTDIR` returns the same path while on windows it is two separate directories. + Use `Conda.SCRIPTDIR` to ex. get the folder for numpy's f2py or ipython""" +@unix_only const BINDIR = joinpath(PREFIX, "bin") """Returns the directory for the scripts files of a package. Attention on unix - `bindir` and `scriptsdir` returns the same path while on windows it is two separate directories. - Use `scriptdir()` to ex. get numpy's f2py or ipython""" -scriptsdir(package) = bindir(package) + `Conda.BINDIR` and `Conda.SCRIPTDIR` returns the same path while on windows it is two separate directories. + Use `Conda.SCRIPTDIR` to ex. get the folder for numpy's f2py or ipython""" +@unix_only const SCRIPTDIR = joinpath(PREFIX, "bin") """Returns the directory for the binary files of a package. Attention on unix - `bindir` and `scriptsdir` returns the same path while on windows it is two separate directories. - Use `scriptdir()` to ex. get numpy's f2py or ipython""" -@windows_only function bindir(package) - packages = _installed_packages_dict() - haskey(packages, package) || error("Package '$package' not found") - joinpath(PREFIX, "pkgs", packages[package][2], "Library", "bin") -end + `Conda.BINDIR` and `Conda.SCRIPTDIR` returns the same path while on windows it is two separate directories. + Use `Conda.SCRIPTDIR` to ex. get the folder for numpy's f2py or ipython""" +@windows_only const BINDIR = joinpath(PREFIX, "Library", "bin") """Returns the directory for the scripts files of a package. Attention on unix - `bindir` and `scriptsdir` returns the same path while on windows it is two separate directories. - Use `scriptdir()` to ex. get numpy's f2py or ipython""" -@windows_only function scriptsdir(package) - packages = _installed_packages_dict() - haskey(packages, package) || error("Package '$package' not found") - joinpath(PREFIX, "pkgs", packages[package][2], "Scripts") -end + `Conda.BINDIR` and `Conda.SCRIPTDIR` returns the same path while on windows it is two separate directories. + Use `Conda.SCRIPTDIR` to ex. get the folder for numpy's f2py or ipython""" +@windows_only const SCRIPTDIR = joinpath(PREFIX, "Scripts") -@unix_only const conda = joinpath(PREFIX, "bin", "conda") -@windows_only const conda = joinpath(PREFIX, "Scripts", "conda") +const conda = joinpath(SCRIPTDIR, "conda") CHANNELS = AbstractString[] additional_channels() = ["--channel " * channel for channel in CHANNELS] diff --git a/test/runtests.jl b/test/runtests.jl index 29c6f58..1a36410 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,7 +16,7 @@ end @test isfile(curl_path) -@test isfile(joinpath(Conda.bindir("curl"), basename(curl_path))) +@test isfile(joinpath(Conda.BINDIR, basename(curl_path))) Conda.rm("curl") @unix_only @test !isfile(curl_path) @@ -25,4 +25,8 @@ if already_installed Conda.add("curl") end -@test isfile(joinpath(Conda.scriptsdir("conda"), "conda" * @windows ? ".exe": "")) \ No newline at end of file +@test isfile(joinpath(Conda.SCRIPTDIR, "conda" * @windows ? ".exe": "")) + +Conda.add("jupyter=1.0.0") +@test v"4.0.0" == convert(VersionNumber, chomp(readall(`$(joinpath(Conda.SCRIPTDIR, "jupyter")) kernelspec --version`))) +