From 44e7434aae71ee358fcb5541c077165b0c2feeae Mon Sep 17 00:00:00 2001 From: David Varela <00.varela.david@gmail.com> Date: Sun, 2 Sep 2018 13:52:07 -0700 Subject: [PATCH 01/14] Rewrite test to avoid AppVeyor error (cherry picked from commit fdc0a0f59f30e345041b20106fe995dfd7d11ea5) (cherry picked from commit 29b63dd22159a938578b0f80a8e33e8ceba7ec1b) --- stdlib/Pkg/test/pkg.jl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/stdlib/Pkg/test/pkg.jl b/stdlib/Pkg/test/pkg.jl index 6cd249e682052..50cd6ac186631 100644 --- a/stdlib/Pkg/test/pkg.jl +++ b/stdlib/Pkg/test/pkg.jl @@ -354,7 +354,6 @@ temp_pkg_dir() do project_path end end -#= temp_pkg_dir() do project_path @testset "valid project file names" begin extract_uuid(toml_path) = begin @@ -370,6 +369,8 @@ temp_pkg_dir() do project_path end cd(project_path) do + target_dir = mktempdir() + uuid = nothing mktempdir() do tmp; cd(tmp) do pkg_name = "FooBar" # create a project and grab its uuid @@ -381,20 +382,21 @@ temp_pkg_dir() do project_path Pkg.activate(abspath(pkg_name)) # add an example project to populate manifest file Pkg.add("Example") - Pkg.activate() # change away from default names - mv(joinpath(pkg_name, "Project.toml"), joinpath(pkg_name, "JuliaProject.toml")) - mv(joinpath(pkg_name, "Manifest.toml"), joinpath(pkg_name, "JuliaManifest.toml")) - # make sure things still work - Pkg.develop(PackageSpec(url = abspath(pkg_name))) - @test isinstalled((name=pkg_name, uuid=UUID(uuid))) - Pkg.rm(pkg_name) - @test !isinstalled((name=pkg_name, uuid=UUID(uuid))) + ## note: this is written awkwardly because a `mv` here causes failures on AppVeyor + cp(joinpath(pkg_name, "src"), joinpath(target_dir, "src")) + cp(joinpath(pkg_name, "Project.toml"), joinpath(target_dir, "JuliaProject.toml")) + cp(joinpath(pkg_name, "Manifest.toml"), joinpath(target_dir, "JuliaManifest.toml")) end end + Pkg.activate() + # make sure things still work + Pkg.REPLMode.pkgstr("dev $target_dir") + @test isinstalled((name="FooBar", uuid=UUID(uuid))) + Pkg.rm("FooBar") + @test !isinstalled((name="FooBar", uuid=UUID(uuid))) end # cd project_path end # @testset end -=# temp_pkg_dir() do project_path @testset "invalid repo url" begin From 3d4426a2bd240d392bc2d20ece92a09d737fa80d Mon Sep 17 00:00:00 2001 From: sunoru Date: Tue, 4 Sep 2018 10:25:46 -0400 Subject: [PATCH 02/14] Fix the statements for checking repeat in packages' UUID. (cherry picked from commit d3a1bfa7c85cc491c8cf57d3789f20886fd12cab) (cherry picked from commit 20efc39707e9859b8c8c999c8dc5b33016b5a9c1) --- stdlib/Pkg/src/Types.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/Pkg/src/Types.jl b/stdlib/Pkg/src/Types.jl index 0b989386b0458..284993bacb9df 100644 --- a/stdlib/Pkg/src/Types.jl +++ b/stdlib/Pkg/src/Types.jl @@ -786,7 +786,7 @@ end # Disambiguate name/uuid package specifications using project info. function project_deps_resolve!(env::EnvCache, pkgs::AbstractVector{PackageSpec}) uuids = env.project["deps"] - names = Dict(uuid => name for (uuid, name) in uuids) + names = Dict(uuid => name for (name, uuid) in uuids) length(uuids) < length(names) && # TODO: handle this somehow? pkgerror("duplicate UUID found in project file's [deps] section") for pkg in pkgs From 6333ee419e8f87039c94717037e4d1caf01d8e52 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 6 Sep 2018 01:03:24 -0700 Subject: [PATCH 03/14] Close the braces in docstring (cherry picked from commit e3236594c52e4c344fe5d1b899988560e9dbdf96) (cherry picked from commit caaa3905cd06ed621ba23ffa3c20a9a38da24cb0) --- stdlib/Pkg/src/Pkg.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stdlib/Pkg/src/Pkg.jl b/stdlib/Pkg/src/Pkg.jl index 818e45e9aacb4..dbca8c257fd15 100644 --- a/stdlib/Pkg/src/Pkg.jl +++ b/stdlib/Pkg/src/Pkg.jl @@ -74,7 +74,7 @@ const UpgradeLevel = Types.UpgradeLevel # Define new variables so tab comleting Pkg. works. """ - Pkg.add(pkg::Union{String, Vector{String}) + Pkg.add(pkg::Union{String, Vector{String}}) Pkg.add(pkg::Union{PackageSpec, Vector{PackageSpec}}) Add a package to the current project. This package will be available using the @@ -94,7 +94,7 @@ See also [`PackageSpec`](@ref). const add = API.add """ - Pkg.rm(pkg::Union{String, Vector{String}) + Pkg.rm(pkg::Union{String, Vector{String}}) Pkg.rm(pkg::Union{PackageSpec, Vector{PackageSpec}}) Remove a package from the current project. If the `mode` of `pkg` is @@ -107,7 +107,7 @@ const rm = API.rm """ Pkg.update(; level::UpgradeLevel=UPLEVEL_MAJOR, mode::PackageMode = PKGMODE_PROJECT) - Pkg.update(pkg::Union{String, Vector{String}) + Pkg.update(pkg::Union{String, Vector{String}}) Pkg.update(pkg::Union{PackageSpec, Vector{PackageSpec}}) Update a package `pkg`. If no posistional argument is given, update all packages in the manifest if `mode` is `PKGMODE_MANIFEST` and packages in both manifest and project if `mode` is `PKGMODE_PROJECT`. @@ -162,7 +162,7 @@ const gc = API.gc """ Pkg.build() - Pkg.build(pkg::Union{String, Vector{String}) + Pkg.build(pkg::Union{String, Vector{String}}) Pkg.build(pkgs::Union{PackageSpec, Vector{PackageSpec}}) Run the build script in `deps/build.jl` for `pkg` and all of the dependencies in @@ -178,7 +178,7 @@ const build = API.build const installed = API.installed """ - Pkg.pin(pkg::Union{String, Vector{String}) + Pkg.pin(pkg::Union{String, Vector{String}}) Pkg.pin(pkgs::Union{Packagespec, Vector{Packagespec}}) Pin a package to the current version (or the one given in the `packagespec` or a certain @@ -187,7 +187,7 @@ git revision. A pinned package is never updated. const pin = API.pin """ - Pkg.free(pkg::Union{String, Vector{String}) + Pkg.free(pkg::Union{String, Vector{String}}) Pkg.free(pkgs::Union{Packagespec, Vector{Packagespec}}) Free a package which removes a `pin` if it exists, or if the package is tracking a path, @@ -203,7 +203,7 @@ const free = API.free """ - Pkg.develop(pkg::Union{String, Vector{String}) + Pkg.develop(pkg::Union{String, Vector{String}}) Pkg.develop(pkgs::Union{Packagespec, Vector{Packagespec}}) Make a package available for development by tracking it by path. From 9705bac510831c1a03bd80eadc30675e4883e537 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Tue, 11 Sep 2018 16:06:00 +0200 Subject: [PATCH 04/14] Throw PkgError instead of ErrorException when looking for the project file. (cherry picked from commit 7c9f041603a257c960999bb9202194d04174b057) (cherry picked from commit d4a66a095c7f1d4da77dec48771dc28289949d72) --- stdlib/Pkg/src/Types.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/Pkg/src/Types.jl b/stdlib/Pkg/src/Types.jl index 284993bacb9df..1099d3012da9c 100644 --- a/stdlib/Pkg/src/Types.jl +++ b/stdlib/Pkg/src/Types.jl @@ -240,13 +240,13 @@ function find_project_file(env::Union{Nothing,String}=nothing) project_file = nothing if env isa Nothing project_file = Base.active_project() - project_file == nothing && error("no active project") + project_file == nothing && pkgerror("no active project") elseif startswith(env, '@') project_file = Base.load_path_expand(env) - project_file === nothing && error("package environment does not exist: $env") + project_file === nothing && pkgerror("package environment does not exist: $env") elseif env isa String if isdir(env) - isempty(readdir(env)) || error("environment is a package directory: $env") + isempty(readdir(env)) || pkgerror("environment is a package directory: $env") project_file = joinpath(env, Base.project_names[end]) else project_file = endswith(env, ".toml") ? abspath(env) : From 4b74adf92f8932f962046d92a02971f919289a02 Mon Sep 17 00:00:00 2001 From: David Varela <00.varela.david@gmail.com> Date: Tue, 11 Sep 2018 11:40:30 -0700 Subject: [PATCH 05/14] Fix typo in help docs (cherry picked from commit 34a1867933af3e02a7ce6648c5a4bf9e69e17de7) (cherry picked from commit 3b2880cfeae06b08e9b74e2c2b0c84a5289f581f) --- stdlib/Pkg/src/REPLMode.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/Pkg/src/REPLMode.jl b/stdlib/Pkg/src/REPLMode.jl index 744df6d24b13b..3edbc61883e79 100644 --- a/stdlib/Pkg/src/REPLMode.jl +++ b/stdlib/Pkg/src/REPLMode.jl @@ -1174,7 +1174,7 @@ The `startup.jl` file is disabled during building unless julia is started with ` resolve Resolve the project i.e. run package resolution and update the Manifest. This is useful in case the dependencies of developed -packages have changed causing the current Manifest to_indices be out of sync. +packages have changed causing the current Manifest to be out of sync. """, ),( CMD_ACTIVATE, ["activate"], From dc696b2060608294d65100c2dd693c799644b496 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 6 Sep 2018 15:21:02 -0700 Subject: [PATCH 06/14] Don't mutate argument passed to Pkg.add (cherry picked from commit 1cdbe0e08cb576f8bae58573da7eb69308cae89c) (cherry picked from commit 97af750d3fe766014259025927fbfd9c734ab3f9) --- stdlib/Pkg/src/API.jl | 7 +++++++ stdlib/Pkg/test/pkg.jl | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/stdlib/Pkg/src/API.jl b/stdlib/Pkg/src/API.jl index b95f4d3e33527..00c83abf7a8c8 100644 --- a/stdlib/Pkg/src/API.jl +++ b/stdlib/Pkg/src/API.jl @@ -29,6 +29,7 @@ add_or_develop(pkgs::Vector{String}; kwargs...) = add_or_develop([che add_or_develop(pkgs::Vector{PackageSpec}; kwargs...) = add_or_develop(Context(), pkgs; kwargs...) function add_or_develop(ctx::Context, pkgs::Vector{PackageSpec}; mode::Symbol, shared::Bool=true, kwargs...) + pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members Context!(ctx; kwargs...) # All developed packages should go through handle_repos_develop so just give them an empty repo @@ -73,6 +74,7 @@ rm(pkgs::Vector{String}; kwargs...) = rm([PackageSpec(pkg) for pkg in rm(pkgs::Vector{PackageSpec}; kwargs...) = rm(Context(), pkgs; kwargs...) function rm(ctx::Context, pkgs::Vector{PackageSpec}; mode=PKGMODE_PROJECT, kwargs...) + pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members for pkg in pkgs # TODO only overwrite pkg.mode if default value ? pkg.mode = mode @@ -166,6 +168,7 @@ up(pkgs::Vector{PackageSpec}; kwargs...) = up(Context(), pkgs; kwargs...) function up(ctx::Context, pkgs::Vector{PackageSpec}; level::UpgradeLevel=UPLEVEL_MAJOR, mode::PackageMode=PKGMODE_PROJECT, do_update_registry=true, kwargs...) + pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members for pkg in pkgs # TODO only override if they are not already set pkg.mode = mode @@ -205,6 +208,7 @@ pin(pkgs::Vector{String}; kwargs...) = pin([PackageSpec(pkg) for pkg pin(pkgs::Vector{PackageSpec}; kwargs...) = pin(Context(), pkgs; kwargs...) function pin(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...) + pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members Context!(ctx; kwargs...) ctx.preview && preview_info() project_deps_resolve!(ctx.env, pkgs) @@ -219,6 +223,7 @@ free(pkgs::Vector{String}; kwargs...) = free([PackageSpec(pkg) for pk free(pkgs::Vector{PackageSpec}; kwargs...) = free(Context(), pkgs; kwargs...) function free(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...) + pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members Context!(ctx; kwargs...) ctx.preview && preview_info() registry_resolve!(ctx.env, pkgs) @@ -250,6 +255,7 @@ test(pkgs::Vector{String}; kwargs...) = test([PackageSpec(pkg) for p test(pkgs::Vector{PackageSpec}; kwargs...) = test(Context(), pkgs; kwargs...) function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs...) + pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members Context!(ctx; kwargs...) ctx.preview && preview_info() if isempty(pkgs) @@ -423,6 +429,7 @@ build(pkg::Array{Union{}, 1}) = build(PackageSpec[]) build(pkg::PackageSpec) = build([pkg]) build(pkgs::Vector{PackageSpec}) = build(Context(), pkgs) function build(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...) + pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members Context!(ctx; kwargs...) ctx.preview && preview_info() diff --git a/stdlib/Pkg/test/pkg.jl b/stdlib/Pkg/test/pkg.jl index 50cd6ac186631..8b034afece3a0 100644 --- a/stdlib/Pkg/test/pkg.jl +++ b/stdlib/Pkg/test/pkg.jl @@ -508,6 +508,16 @@ end @test Pkg.Types.pathrepr(path) == "`@stdlib/Test`" end + +temp_pkg_dir() do project_path + @testset "Pkg.add should not mutate" begin + package_names = ["JSON"] + packages = PackageSpec.(package_names) + Pkg.add(packages) + @test [p.name for p in packages] == package_names + end +end + include("repl.jl") include("api.jl") From d60b82bd55b00c6fcb198dab8b87c9a4c26be98e Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Sat, 15 Sep 2018 11:41:19 -0400 Subject: [PATCH 07/14] Fix spelling of "precompile" (cherry picked from commit 44adf6c89a09695f73556b0f1636b9aaf06dea0e) (cherry picked from commit e9ae5e2738aa7fc33d33430657e17e275170b1e7) --- stdlib/Pkg/src/API.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/Pkg/src/API.jl b/stdlib/Pkg/src/API.jl index 00c83abf7a8c8..5399dfccb4544 100644 --- a/stdlib/Pkg/src/API.jl +++ b/stdlib/Pkg/src/API.jl @@ -496,7 +496,7 @@ function precompile(ctx::Context) sourcepath = Base.locate_package(pkg) if sourcepath == nothing # XXX: this isn't supposed to be fatal - pkgerror("couldn't find path to $(pkg.name) when trying to precompilie project") + pkgerror("couldn't find path to $(pkg.name) when trying to precompile project") end stale = true for path_to_try in paths::Vector{String} From 7112453b732b38e2234d4ccc951be91c86b29f9c Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Mon, 17 Sep 2018 10:24:13 -0400 Subject: [PATCH 08/14] fix type in isjoinable (cherry picked from commit cbe0d1ff735787553e24a2187f132c10d932b9da) (cherry picked from commit 7c4c62b3d91b225b94eea9e44b0efb64e01d0d82) --- stdlib/Pkg/src/versions.jl | 2 +- stdlib/Pkg/test/pkg.jl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/Pkg/src/versions.jl b/stdlib/Pkg/src/versions.jl index c088c7de2c1a1..3ef108678654b 100644 --- a/stdlib/Pkg/src/versions.jl +++ b/stdlib/Pkg/src/versions.jl @@ -66,7 +66,7 @@ stricterupper(a::VersionBound, b::VersionBound) = isless_uu(a, b) ? a : b # `2.3.4` can be joined with `2.3.5` etc. function isjoinable(up::VersionBound, lo::VersionBound) - up.n == 0 && up.lo == 0 && return true + up.n == 0 && lo.n == 0 && return true if up.n == lo.n n = up.n for i = 1:(n - 1) diff --git a/stdlib/Pkg/test/pkg.jl b/stdlib/Pkg/test/pkg.jl index 8b034afece3a0..c8efbda2386da 100644 --- a/stdlib/Pkg/test/pkg.jl +++ b/stdlib/Pkg/test/pkg.jl @@ -88,6 +88,9 @@ import Pkg.Types: semver_spec, VersionSpec @test_throws ErrorException semver_spec("^^0.2.3") @test_throws ErrorException semver_spec("^^0.2.3.4") @test_throws ErrorException semver_spec("0.0.0") + + @test Pkg.Types.isjoinable(Pkg.Types.VersionBound((1,5)), Pkg.Types.VersionBound((1,6))) + @test !(Pkg.Types.isjoinable(Pkg.Types.VersionBound((1,5)), Pkg.Types.VersionBound((1,6,0)))) end # TODO: Should rewrite these tests not to rely on internals like field names From 258b8940d27db52dd4d9f19d33bb7a73191cc7a9 Mon Sep 17 00:00:00 2001 From: David Varela <00.varela.david@gmail.com> Date: Wed, 12 Sep 2018 16:53:59 -0700 Subject: [PATCH 09/14] Only complete directories on `add`/`dev` (cherry picked from commit 076c74d94440452de99b3d8c7fe41926a406f4b5) (cherry picked from commit d0dfde4337ce1ef8cbd43da36a6b2ace28d80c6b) --- stdlib/Pkg/src/REPLMode.jl | 3 ++- stdlib/Pkg/test/repl.jl | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/stdlib/Pkg/src/REPLMode.jl b/stdlib/Pkg/src/REPLMode.jl index 3edbc61883e79..d786a77d5569c 100644 --- a/stdlib/Pkg/src/REPLMode.jl +++ b/stdlib/Pkg/src/REPLMode.jl @@ -764,7 +764,8 @@ end function complete_local_path(s, i1, i2) cmp = REPL.REPLCompletions.complete_path(s, i2) - [REPL.REPLCompletions.completion_text(p) for p in cmp[1]], cmp[2], !isempty(cmp[1]) + completions = filter!(isdir, [REPL.REPLCompletions.completion_text(p) for p in cmp[1]]) + return completions, cmp[2], !isempty(completions) end function complete_installed_package(s, i1, i2, project_opt) diff --git a/stdlib/Pkg/test/repl.jl b/stdlib/Pkg/test/repl.jl index 3b7cf7e5fa74f..1b6b1bb0cde2c 100644 --- a/stdlib/Pkg/test/repl.jl +++ b/stdlib/Pkg/test/repl.jl @@ -462,6 +462,10 @@ temp_pkg_dir() do project_path; cd(project_path) do @test apply_completion("add ./tes") == (Sys.iswindows() ? "add ./testdir\\\\" : "add ./testdir/") c, r = test_complete("dev ./") @test (Sys.iswindows() ? ("testdir\\\\" in c) : ("testdir/" in c)) + # dont complete files + touch("README.md") + c, r = test_complete("add RE") + @test !("README.md" in c) end # testset end end From 1b0926a00814950a577b06dc2c415c2fca2ad2d0 Mon Sep 17 00:00:00 2001 From: Christof Stocker Date: Tue, 28 Aug 2018 11:33:23 +0200 Subject: [PATCH 10/14] add support for ssh protocol (cherry picked from commit d3b54bbf690c4707a52b9eaec31f24701fb7e6c7) (cherry picked from commit c46d13e30f4d32daea3eb9a9b28091afcadd7446) --- stdlib/Pkg/src/GitTools.jl | 9 +++++++-- stdlib/Pkg/test/pkg.jl | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/stdlib/Pkg/src/GitTools.jl b/stdlib/Pkg/src/GitTools.jl index acd988ead9bd9..d480f46b02f03 100644 --- a/stdlib/Pkg/src/GitTools.jl +++ b/stdlib/Pkg/src/GitTools.jl @@ -75,8 +75,13 @@ setprotocol!(proto::Union{Nothing, AbstractString}=nothing) = GIT_PROTOCOL[] = p # TODO: extend this to more urls function normalize_url(url::AbstractString) m = match(GITHUB_REGEX, url) - (m === nothing || GIT_PROTOCOL[] === nothing) ? - url : "$(GIT_PROTOCOL[])://github.com/$(m.captures[1]).git" + if m === nothing || GIT_PROTOCOL[] === nothing + url + elseif GIT_PROTOCOL[] == "ssh" + "ssh://git@github.com/$(m.captures[1]).git" + else + "$(GIT_PROTOCOL[])://github.com/$(m.captures[1]).git" + end end function clone(url, source_path; header=nothing, kwargs...) diff --git a/stdlib/Pkg/test/pkg.jl b/stdlib/Pkg/test/pkg.jl index c8efbda2386da..cf6b063c02b4a 100644 --- a/stdlib/Pkg/test/pkg.jl +++ b/stdlib/Pkg/test/pkg.jl @@ -262,6 +262,23 @@ temp_pkg_dir() do project_path end end end + mktempdir() do devdir + withenv("JULIA_PKG_DEVDIR" => devdir) do + try + https_url = "https://github.com/JuliaLang/Example.jl.git" + ssh_url = "ssh://git@github.com/JuliaLang/Example.jl.git" + @test Pkg.GitTools.normalize_url(https_url) == https_url + Pkg.setprotocol!("ssh") + @test Pkg.GitTools.normalize_url(https_url) == ssh_url + # TODO: figure out how to test this without + # having to deploy a ssh key on github + #Pkg.develop("Example") + #@test isinstalled(TEST_PKG) + finally + Pkg.setprotocol!() + end + end + end end @testset "check logging" begin From 4a72ad43a588f1091200ec7fd6812530e11831ab Mon Sep 17 00:00:00 2001 From: Mary McGrath Date: Tue, 4 Sep 2018 15:48:57 -0400 Subject: [PATCH 11/14] Update project.toml compat example Adding this PR here instead of [JuliaLang](https://github.com/JuliaLang/julia/pull/28947) per @KristofferC (cherry picked from commit 96736153524144d83e9d6458feae7a39be7d1b7d) (cherry picked from commit ac5965bf9a8a5b4de535e3b3e2bc4668719fd51b) --- stdlib/Pkg/docs/src/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/Pkg/docs/src/index.md b/stdlib/Pkg/docs/src/index.md index f3556bb4c4f48..562fc5d187a1d 100644 --- a/stdlib/Pkg/docs/src/index.md +++ b/stdlib/Pkg/docs/src/index.md @@ -734,6 +734,7 @@ Compatibility for a dependency is entered in the `Project.toml` file as for exam ```toml [compat] +julia = "1.0" Example = "0.4.3" ``` From de7c7c335649a66d4b62759df3312e415bf273c1 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Mon, 17 Sep 2018 17:33:15 -0400 Subject: [PATCH 12/14] only look up name from url if it is unset (cherry picked from commit 3a0e2ab727380ccb2c9b284282223e94ee4af2cc) (cherry picked from commit e9de77f2da8a403c63ba4cc937195b793b6a0abc) --- stdlib/Pkg/src/Types.jl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/stdlib/Pkg/src/Types.jl b/stdlib/Pkg/src/Types.jl index 1099d3012da9c..3ddcaeb009d4a 100644 --- a/stdlib/Pkg/src/Types.jl +++ b/stdlib/Pkg/src/Types.jl @@ -708,14 +708,16 @@ function parse_package!(ctx, pkg, project_path) if !isempty(ctx.old_pkg2_clone_name) # remove when legacy CI script support is removed pkg.name = ctx.old_pkg2_clone_name else - # This is an old style package, get the name from src/PackageName - if isdir_windows_workaround(pkg.repo.url) - m = match(reg_pkg, abspath(pkg.repo.url)) - else - m = match(reg_pkg, pkg.repo.url) + # This is an old style package, if not set, get the name from src/PackageName + if !has_name(pkg) + if isdir_windows_workaround(pkg.repo.url) + m = match(reg_pkg, abspath(pkg.repo.url)) + else + m = match(reg_pkg, pkg.repo.url) + end + m === nothing && pkgerror("cannot determine package name from URL or path: $(pkg.repo.url), provide a name argument to `PackageSpec`") + pkg.name = m.captures[1] end - m === nothing && pkgerror("cannot determine package name from URL or path: $(pkg.repo.url)") - pkg.name = m.captures[1] end reg_uuids = registered_uuids(env, pkg.name) is_registered = !isempty(reg_uuids) From 794c1f1c09ea72ec423f022f7ab865ede5bb1250 Mon Sep 17 00:00:00 2001 From: David Varela Date: Tue, 18 Sep 2018 07:47:08 -0700 Subject: [PATCH 13/14] Reword `activate` docs (#742) (cherry picked from commit ac84b7fcf6b3b18fb02e2c79f7e204d598ee860a) (cherry picked from commit 854cf42190f1be2cd7036539a76dfbb555cfa7f5) --- stdlib/Pkg/src/Pkg.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/stdlib/Pkg/src/Pkg.jl b/stdlib/Pkg/src/Pkg.jl index dbca8c257fd15..0e2ffc0859cac 100644 --- a/stdlib/Pkg/src/Pkg.jl +++ b/stdlib/Pkg/src/Pkg.jl @@ -270,16 +270,16 @@ that is modified by executing package commands. The logic for what path is activated is as follows: * If `shared` is `true`, the first existing environment named `s` from the depots - in the depot stack will be activated. If no such environment exists yet, - activate it in the first depot. - * If `s` is a path that exist, that environment will be activated. - * If `s` is a package name in the current project activate that is tracking a path, - activate the environment at that path. - * If `s` is a non-existing path, activate that path. - -If no argument is given to `activate`, activate the home project, -which is the one specified by either `--project` command line when starting julia, -or `JULIA_PROJECT` environment variable. + in the depot stack will be activated. If no such environment exists, + create and activate that environment in the first depot. + * If `s` is an existing path, then activate the environment at that path. + * If `s` is a package in the current project and `s` is tracking a path, then + activate the environment at the tracked path. + * Else, `s` is interpreted as a non-existing path, activate that path. + +If no argument is given to `activate`, then activate the home project. +The home project is specified by either the `--project` command line option to +the julia executable, or the `JULIA_PROJECT` environment variable. # Examples ``` From a416c9f0c1474d8726cd8b37315e4b3f92d037fd Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Tue, 18 Sep 2018 10:54:54 -0400 Subject: [PATCH 14/14] only do a radiobutton if we are in interactive mode (#735) (cherry picked from commit 8e91d902458b9dbeab76fa7194ee58d1a6137334) (cherry picked from commit 909508ab4b4458b6f58c0a870bd3b7f896e5a818) --- stdlib/Pkg/src/Types.jl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/stdlib/Pkg/src/Types.jl b/stdlib/Pkg/src/Types.jl index 3ddcaeb009d4a..8376a93711332 100644 --- a/stdlib/Pkg/src/Types.jl +++ b/stdlib/Pkg/src/Types.jl @@ -1056,12 +1056,16 @@ function registered_uuid(env::EnvCache, name::String)::UUID end end length(choices_cache) == 1 && return choices_cache[1][1] - # prompt for which UUID was intended: - menu = RadioMenu(choices) - choice = request("There are multiple registered `$name` packages, choose one:", menu) - choice == -1 && return UUID(zero(UInt128)) - env.paths[choices_cache[choice][1]] = [choices_cache[choice][2]] - return choices_cache[choice][1] + if isinteractive() + # prompt for which UUID was intended: + menu = RadioMenu(choices) + choice = request("There are multiple registered `$name` packages, choose one:", menu) + choice == -1 && return UUID(zero(UInt128)) + env.paths[choices_cache[choice][1]] = [choices_cache[choice][2]] + return choices_cache[choice][1] + else + pkgerror("there are multiple registered `$name` packages, explicitly set the uuid") + end end # Determine current name for a given package UUID