From 5987404880926c02053197cb69c601b501e9405f Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 17 Nov 2017 11:43:07 +0100 Subject: [PATCH 1/5] fix BinaryProvider deprecations --- ext/BinaryProvider/REQUIRE | 2 +- ext/BinaryProvider/src/BinDepsIntegration.jl | 4 ++-- ext/BinaryProvider/src/BinaryPackage.jl | 2 +- ext/BinaryProvider/src/BinaryProvider.jl | 6 ++++-- ext/BinaryProvider/src/OutputCollector.jl | 4 ++-- ext/BinaryProvider/src/PlatformEngines.jl | 13 ++++++------- ext/BinaryProvider/src/PlatformNames.jl | 14 +++++++++++++- ext/BinaryProvider/src/Prefix.jl | 12 ++++++------ ext/BinaryProvider/src/Products.jl | 14 +++++++------- ext/BinaryProvider/test/runtests.jl | 16 ++++++++-------- 10 files changed, 50 insertions(+), 37 deletions(-) diff --git a/ext/BinaryProvider/REQUIRE b/ext/BinaryProvider/REQUIRE index f8981b77cb007..00d58fea7ed8d 100644 --- a/ext/BinaryProvider/REQUIRE +++ b/ext/BinaryProvider/REQUIRE @@ -1,3 +1,3 @@ julia 0.6 SHA -Compat 0.27.0 +Compat 0.35.0 diff --git a/ext/BinaryProvider/src/BinDepsIntegration.jl b/ext/BinaryProvider/src/BinDepsIntegration.jl index 5a9cadda85142..2450315acebc5 100644 --- a/ext/BinaryProvider/src/BinDepsIntegration.jl +++ b/ext/BinaryProvider/src/BinDepsIntegration.jl @@ -3,7 +3,7 @@ import BinDeps: Binaries, can_use, package_available, bindir, libdir, generate_steps, LibraryDependency, provider, provides import Base: show -type BP <: Binaries +mutable struct BP <: Binaries url::String hash::String prefix::Prefix @@ -14,7 +14,7 @@ show(io::IO, p::BP) = write(io, "BinaryProvider for $(p.url)") # We are cross-platform baby, and we never say no to a party can_use(::Type{BP}) = true package_available(p::BP) = true -libdir(p::BP, dep) = @static if is_windows() +libdir(p::BP, dep) = @static if Compat.Sys.iswindows() joinpath(p.prefix, "bin") else joinpath(p.prefix, "lib") diff --git a/ext/BinaryProvider/src/BinaryPackage.jl b/ext/BinaryProvider/src/BinaryPackage.jl index 00b294b6f3f83..61c6dbd2998e0 100644 --- a/ext/BinaryProvider/src/BinaryPackage.jl +++ b/ext/BinaryProvider/src/BinaryPackage.jl @@ -13,7 +13,7 @@ There exist `install()`, `uninstall()` and `satisfied()` methods for `BinaryPackage` objects, similar to the lower-level versions that take direct `url` and `hash` arguments. """ -immutable BinaryPackage +struct BinaryPackage url::String hash::String platform::Platform diff --git a/ext/BinaryProvider/src/BinaryProvider.jl b/ext/BinaryProvider/src/BinaryProvider.jl index e2b1943ee4aeb..6b6c3b364cebc 100644 --- a/ext/BinaryProvider/src/BinaryProvider.jl +++ b/ext/BinaryProvider/src/BinaryProvider.jl @@ -1,5 +1,7 @@ module BinaryProvider +import Pkg3: iswindows, isapple, islinux + # Include our subprocess running funtionality include("OutputCollector.jl") # External utilities such as downloading/decompressing tarballs @@ -19,7 +21,7 @@ include("BinaryPackage.jl") function __init__() - global global_prefix + #global global_prefix # Initialize our global_prefix # global_prefix = Prefix(joinpath(dirname(@__FILE__), "../", "global_prefix")) @@ -30,7 +32,7 @@ function __init__() # If we're on a julia that's too old, then fixup the color mappings # if !haskey(Base.text_colors, :default) - # Base.text_colors[:default] = Base.color_normal + # Base.text_colors[:default] = Base.color_normal # end end diff --git a/ext/BinaryProvider/src/OutputCollector.jl b/ext/BinaryProvider/src/OutputCollector.jl index b0e44d616e603..040622adfb60f 100644 --- a/ext/BinaryProvider/src/OutputCollector.jl +++ b/ext/BinaryProvider/src/OutputCollector.jl @@ -5,7 +5,7 @@ import Base: wait, merge export OutputCollector, merge, stdout, stderr, tail, tee -immutable LineStream +struct LineStream pipe::Pipe lines::Vector{Tuple{Float64,String}} task::Task @@ -79,7 +79,7 @@ OutputCollector A `run()` wrapper class that captures subprocess `stdout` and `stderr` streams independently, resynthesizing and colorizing the streams appropriately. """ -type OutputCollector +mutable struct OutputCollector cmd::Base.AbstractCmd P::Base.AbstractPipe stdout_linestream::LineStream diff --git a/ext/BinaryProvider/src/PlatformEngines.jl b/ext/BinaryProvider/src/PlatformEngines.jl index 89c5c3fd499ea..eaf62da6735b8 100644 --- a/ext/BinaryProvider/src/PlatformEngines.jl +++ b/ext/BinaryProvider/src/PlatformEngines.jl @@ -137,7 +137,7 @@ function probe_platform_engines!(;verbose::Bool = false) # download_engines is a list of (test_cmd, download_opts_functor) # The probulator will check each of them by attempting to run `$test_cmd`, # and if that works, will set the global download functions appropriately. - const download_engines = [ + download_engines = [ (`curl --help`, (url, path) -> `curl -C - -\# -f -o $path -L $url`), (`wget --help`, (url, path) -> `wget -c -O $path $url`), (`fetch --help`, (url, path) -> `fetch -f $path $url`), @@ -175,17 +175,17 @@ function probe_platform_engines!(;verbose::Bool = false) # will check each of them by attempting to run `$test_cmd`, and if that # works, will set the global compression functions appropriately. gen_7z = (p) -> (unpack_7z(p), package_7z(p), list_7z(p), parse_7z_list) - const compression_engines = Tuple[ + compression_engines = Tuple[ (`tar --help`, unpack_tar, package_tar, list_tar, parse_tar_list), ] # sh_engines is just a list of Cmds-as-paths - const sh_engines = [ + sh_engines = [ `sh` ] # For windows, we need to tweak a few things, as the tools available differ - @static if is_windows() + @static if iswindows() # For download engines, we will most likely want to use powershell. # Let's generate a functor to return the necessary powershell magics # to download a file, given a path to the powershell executable @@ -215,11 +215,11 @@ function probe_platform_engines!(;verbose::Bool = false) prepend!(compression_engines, [(`7z --help`, gen_7z("7z")...)]) # On windows, we bundle 7z with Julia, so try invoking that directly - const exe7z = joinpath(JULIA_HOME, "7z.exe") + exe7z = joinpath(JULIA_HOME, "7z.exe") prepend!(compression_engines, [(`$exe7z --help`, gen_7z(exe7z)...)]) # And finally, we want to look for sh as busybox as well: - const busybox = joinpath(JULIA_HOME, "busybox.exe") + busybox = joinpath(JULIA_HOME, "busybox.exe") prepend!(sh_engines, [(`$busybox sh`)]) end @@ -540,4 +540,3 @@ function download_verify_unpack(url::AbstractString, rm(tarball_path) end end - diff --git a/ext/BinaryProvider/src/PlatformNames.jl b/ext/BinaryProvider/src/PlatformNames.jl index c998e39bcab65..79b36c6657d67 100644 --- a/ext/BinaryProvider/src/PlatformNames.jl +++ b/ext/BinaryProvider/src/PlatformNames.jl @@ -124,6 +124,18 @@ function supported_platforms() ] end +# Compat doesn't use the Base definitions for whatever terrible reason, so we'll overload +# both, ensuring the user gets our definitions regardless of whether they use Sys.is* or +# Compat.Sys.is*. +#if isdefined(Base.Sys, :isapple) +# Base.Sys.isapple(p::Platform) = p isa MacOS +# Base.Sys.islinux(p::Platform) = p isa Linux +# Base.Sys.iswindows(p::Platform) = p isa Windows +# end +# Compat.Sys.isapple(p::Platform) = p isa MacOS +# Compat.Sys.islinux(p::Platform) = p isa Linux +# Compat.Sys.iswindows(p::Platform) = p isa Windows + """ platform_key(machine::AbstractString = Sys.MACHINE) @@ -183,7 +195,7 @@ E.g. returns `true` for a path like `"usr/lib/libfoo.so.3.5"`, but returns `false` for a path like `"libbar.so.f.a"`. """ function valid_dl_path(path::AbstractString, platform::Platform) - const dlext_regexes = Dict( + dlext_regexes = Dict( # On Linux, libraries look like `libnettle.so.6.3.0` "so" => r"^(.*).so(\.[\d]+){0,3}$", # On OSX, libraries look like `libnettle.6.3.dylib` diff --git a/ext/BinaryProvider/src/Prefix.jl b/ext/BinaryProvider/src/Prefix.jl index 176b7b2f23b38..644ab296284b2 100644 --- a/ext/BinaryProvider/src/Prefix.jl +++ b/ext/BinaryProvider/src/Prefix.jl @@ -29,7 +29,7 @@ Usage example: function temp_prefix(func::Function) # Helper function to create a docker-mountable temporary directory function _tempdir() - @static if is_apple() + @static if isapple() # Docker, on OSX at least, can only mount from certain locations by # default, so we ensure all our temporary directories live within # those locations so that they are accessible by Docker. @@ -50,7 +50,7 @@ end # This is the default prefix that things get saved to, it is initialized within # __init__() on first module load. global_prefix = nothing -immutable Prefix +struct Prefix path::String """ @@ -85,7 +85,7 @@ Splits a string such as the `PATH` environment variable into a list of strings according to the path separation rules for the current platform. """ function split_PATH(PATH::AbstractString = ENV["PATH"]) - @static if is_windows() + @static if iswindows() return split(PATH, ";") else return split(PATH, ":") @@ -98,8 +98,8 @@ end Given a list of strings, return a joined string suitable for the `PATH` environment variable appropriate for the current platform. """ -function join_PATH{S<:AbstractString}(paths::Vector{S}) - @static if is_windows() +function join_PATH(paths::Vector{S}) where S<:AbstractString + @static if iswindows() return join(paths, ";") else return join(paths, ":") @@ -122,7 +122,7 @@ Returns the library directory for the given `prefix` (not ethat this differs between unix systems and windows systems). """ function libdir(prefix::Prefix) - @static if is_windows() + @static if iswindows() return joinpath(prefix, "bin") else return joinpath(prefix, "lib") diff --git a/ext/BinaryProvider/src/Products.jl b/ext/BinaryProvider/src/Products.jl index 2264b8ccf65ee..527a7f51cf0a2 100644 --- a/ext/BinaryProvider/src/Products.jl +++ b/ext/BinaryProvider/src/Products.jl @@ -12,7 +12,7 @@ will be installed to, and its name, e.g. to build a `LibraryProduct` that refers to `"/lib/libnettle.so"`, the "directory" would be "/lib", and the "libname" would be "libnettle". """ -immutable LibraryProduct <: Product +struct LibraryProduct <: Product dir_path::String libname::String @@ -119,7 +119,7 @@ non-Windows platforms, it will check for the executable bit being set. On Windows platforms, it will check that the file ends with ".exe", (adding it on automatically, if it is not already present). """ -immutable ExecutableProduct <: Product +struct ExecutableProduct <: Product path::AbstractString """ @@ -173,7 +173,7 @@ function locate(ep::ExecutableProduct; platform::Platform = platform_key(), # If the file is not executable, fail out (unless we're on windows since # windows doesn't honor these permissions on its filesystems) - @static if !is_windows() + @static if !iswindows() if uperm(path) & 0x1 == 0 if verbose info("$(path) is not executable, reporting unsatisfied") @@ -188,7 +188,7 @@ end """ A `FileProduct` represents a file that simply must exist to be satisfied. """ -immutable FileProduct <: Product +struct FileProduct <: Product path::AbstractString end @@ -255,12 +255,12 @@ the user to re-run `Pkg.build("package_name")`. """ macro write_deps_file(capture...) # props to @tshort for his macro wizardry - const names = :($(capture)) - const products = esc(Expr(:tuple, capture...)) + names = :($(capture)) + products = esc(Expr(:tuple, capture...)) # We have to create this dummy_source, because we cannot, in a single line, # have both `@__FILE__` and `__source__` interpreted by the same julia. - const dummy_source = VERSION >= v"0.7.0-" ? __source__.file : "" + dummy_source = VERSION >= v"0.7.0-" ? __source__.file : "" return quote # First pick up important pieces of information from the call-site diff --git a/ext/BinaryProvider/test/runtests.jl b/ext/BinaryProvider/test/runtests.jl index faa32d889968b..d7facf140df6c 100644 --- a/ext/BinaryProvider/test/runtests.jl +++ b/ext/BinaryProvider/test/runtests.jl @@ -75,7 +75,7 @@ BinaryProvider.probe_platform_engines!(;verbose=true) end # Next, test a command that kills itself (NOTE: This doesn't work on windows. sigh.) - @static if !is_windows() + @static if !iswindows() cd("output_tests") do oc = OutputCollector(sh(`./kill.sh`)) @@ -145,8 +145,8 @@ end # Test that we can indeed ask if something is linux or windows, etc... @test Compat.Sys.islinux(Linux(:aarch64)) @test !Compat.Sys.islinux(Windows(:x86_64)) - @test Compat.Sys.iswindows(Windows(:i686)) - @test !Compat.Sys.iswindows(Linux(:x86_64)) + @test iswindows(Windows(:i686)) + @test !iswindows(Linux(:x86_64)) @test Compat.Sys.isapple(MacOS()) @test !Compat.Sys.isapple(Linux(:ppc64le)) @@ -155,7 +155,7 @@ end isbasesomething(p) = Sys.islinux(p) || Sys.iswindows(p) || Sys.isapple(p) @test all(isbasesomething, supported_platforms()) end - issomething(p) = Compat.Sys.islinux(p) || Compat.Sys.iswindows(p) || + issomething(p) = Compat.Sys.islinux(p) || iswindows(p) || Compat.Sys.isapple(p) @test all(issomething, supported_platforms()) @@ -201,7 +201,7 @@ end # Test we can run the script we dropped within this prefix. Once again, # something about Windows | busybox | Julia won't pick this up even though # the path clearly points to the file. :( - @static if !is_windows() + @static if !iswindows() @test success(sh(`$(ppt_path)`)) @test success(sh(`prefix_path_test.sh`)) end @@ -234,7 +234,7 @@ end mkpath(bindir(prefix)) touch(e_path) @test satisfied(ef, verbose=true) - @static if !is_windows() + @static if !iswindows() # Windows doesn't care about executable bit, grumble grumble @test !satisfied(e, verbose=true, platform=Linux(:x86_64)) end @@ -260,7 +260,7 @@ end # But if it is from a different platform, simple existence will be # enough to satisfy a LibraryProduct - @static if is_windows() + @static if iswindows() l_path = joinpath(libdir(prefix), "libfoo.so") touch(l_path) @test satisfied(l, verbose=true, platform=Linux(:x86_64)) @@ -347,7 +347,7 @@ end # Test that we can inspect the contents of the tarball contents = list_tarball_files(tarball_path) - const libdir_name = is_windows() ? "bin" : "lib" + const libdir_name = iswindows() ? "bin" : "lib" @test joinpath("bin", "bar.sh") in contents @test joinpath(libdir_name, "baz.so") in contents From ec1c4ff3b691802e81bb3f40fbab5f8a2d9a6332 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 17 Nov 2017 11:43:19 +0100 Subject: [PATCH 2/5] fix TOML deprecations --- ext/TOML/src/parser.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/TOML/src/parser.jl b/ext/TOML/src/parser.jl index 56ecb26367024..e763270d96919 100644 --- a/ext/TOML/src/parser.jl +++ b/ext/TOML/src/parser.jl @@ -643,6 +643,7 @@ function array(p::Parser, st::Int) !expect(p, '[') && return NONE() ret = Any[] rettype = Any + expected = Any while true # Break out early if we see the closing bracket @@ -657,9 +658,7 @@ function array(p::Parser, st::Int) pend = nextpos(p) valtype = isa(pvalue, Array) ? Array : typeof(pvalue) - expected = rettype === Any ? valtype : expected - if valtype != expected error(p, pstart, pend, "expected type `$expected`, found type `$valtype`") else From af5a2f81248f69122d51a156269e2f508d172b38 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 17 Nov 2017 11:43:33 +0100 Subject: [PATCH 3/5] fix TerminalMenus deprecations --- ext/TerminalMenus/src/MultiSelectMenu.jl | 2 +- ext/TerminalMenus/src/RadioMenu.jl | 2 +- ext/TerminalMenus/src/TerminalMenus.jl | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/TerminalMenus/src/MultiSelectMenu.jl b/ext/TerminalMenus/src/MultiSelectMenu.jl index e210cccbda137..e3ae58213fb46 100644 --- a/ext/TerminalMenus/src/MultiSelectMenu.jl +++ b/ext/TerminalMenus/src/MultiSelectMenu.jl @@ -25,7 +25,7 @@ You like the following fruits: ``` """ -type MultiSelectMenu <: AbstractMenu +mutable struct MultiSelectMenu <: AbstractMenu options::Array{String,1} pagesize::Int pageoffset::Int diff --git a/ext/TerminalMenus/src/RadioMenu.jl b/ext/TerminalMenus/src/RadioMenu.jl index dd0b198b36b41..0217255ce4d3d 100644 --- a/ext/TerminalMenus/src/RadioMenu.jl +++ b/ext/TerminalMenus/src/RadioMenu.jl @@ -17,7 +17,7 @@ Your favorite fruit is blueberry! ``` """ -type RadioMenu <: AbstractMenu +mutable struct RadioMenu <: AbstractMenu options::Array{String,1} pagesize::Int pageoffset::Int diff --git a/ext/TerminalMenus/src/TerminalMenus.jl b/ext/TerminalMenus/src/TerminalMenus.jl index 857787ae8f22e..bbc4a96e10aa2 100644 --- a/ext/TerminalMenus/src/TerminalMenus.jl +++ b/ext/TerminalMenus/src/TerminalMenus.jl @@ -1,10 +1,12 @@ module TerminalMenus +import Pkg3.iswindows + terminal = nothing # The user terminal function __init__() global terminal - terminal = Base.Terminals.TTYTerminal(get(ENV, "TERM", is_windows() ? "" : "dumb"), STDIN, STDOUT, STDERR) + terminal = Base.Terminals.TTYTerminal(get(ENV, "TERM", iswindows() ? "" : "dumb"), STDIN, STDOUT, STDERR) end include("util.jl") From 10ff6c4b00a10e969f8f2c74716ac967de5fcfcd Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 17 Nov 2017 11:43:47 +0100 Subject: [PATCH 4/5] upgrade Pkg3 and fix deprecations --- src/Operations.jl | 37 ++++++++++++++++++++++++++++--------- src/Pkg3.jl | 23 +++++++++++++---------- src/REPLMode.jl | 4 ++++ 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/Operations.jl b/src/Operations.jl index 0fb3d78fd8552..14ea84452c27c 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -134,7 +134,7 @@ function deps_graph(env::EnvCache, pkgs::Vector{PackageSpec}) d = get_or_make(Dict{String,UUID}, dependencies, v) r = get_or_make(Dict{String,VersionSpec}, compatibility, v) q = Dict(u => get_or_make(VersionSpec, r, p) for (p, u) in d) - VERSION in get_or_make(VersionSpec, r, "julia") || continue + # VERSION in get_or_make(VersionSpec, r, "julia") || continue deps[uuid][v] = (h, q) for (p, u) in d u in uuids || push!(uuids, u) @@ -351,11 +351,21 @@ function prune_manifest(env::EnvCache) end clean && break end - filter!(env.manifest) do _, infos - filter!(infos) do info - haskey(info, "uuid") && UUID(info["uuid"]) ∈ keep + if VERSION < v"0.7.0-DEV.1393" + filter!(env.manifest) do _, infos + filter!(infos) do info + haskey(info, "uuid") && UUID(info["uuid"]) ∈ keep + end + !isempty(infos) + end + else + filter!(env.manifest) do _infos # (_, info) doesn't parse on 0.6 + _, infos = _infos + filter!(infos) do info + haskey(info, "uuid") && UUID(info["uuid"]) ∈ keep + end + !isempty(infos) end - !isempty(infos) end end @@ -388,7 +398,8 @@ function apply_versions(env::EnvCache, pkgs::Vector{PackageSpec})::Vector{UUID} end end - max_name = maximum(strwidth(names[pkg.uuid]) for pkg in pkgs) + textwidth = VERSION < v"0.7.0-DEV.1930" ? Base.strwidth : Base.textwidth + max_name = maximum(textwidth(names[pkg.uuid]) for pkg in pkgs) for _ in 1:length(pkgs) r = take!(results) @@ -466,7 +477,8 @@ function build_versions(env::EnvCache, uuids::Vector{UUID}) cmd = ``` $(Base.julia_cmd()) -O0 --color=no --history-file=no --startup-file=$(Base.JLOptions().startupfile != 2 ? "yes" : "no") - --compilecache=$(Base.JLOptions().use_compilecache != 0 ? "yes" : "no") + --compilecache=$((VERSION < v"0.7.0-DEV.1735" ? Base.JLOptions().use_compilecache : + Base.JLOptions().use_compiled_modules) != 0 ? "yes" : "no") --eval $code ``` open(log_file, "w") do log @@ -526,8 +538,15 @@ function rm(env::EnvCache, pkgs::Vector{PackageSpec}) end # delete drops from project n = length(env.project["deps"]) - filter!(env.project["deps"]) do _, uuid - UUID(uuid) ∉ drop + if VERSION < v"0.7.0-DEV.1393" + filter!(env.project["deps"]) do _, uuid + UUID(uuid) ∉ drop + end + else + filter!(env.project["deps"]) do _uuid # (_, uuid) doesn't parse on 0.6 + _, uuid = _uuid + UUID(uuid) ∉ drop + end end if length(env.project["deps"]) == n info("No changes") diff --git a/src/Pkg3.jl b/src/Pkg3.jl index a925f6b0272ec..c676d02e00730 100644 --- a/src/Pkg3.jl +++ b/src/Pkg3.jl @@ -7,13 +7,15 @@ depots() = DEPOTS const USE_LIBGIT2_FOR_ALL_DOWNLOADS = false const NUM_CONCURRENT_DOWNLOADS = 8 +iswindows() = @static VERSION < v"0.7-" ? Sys.is_windows() : Sys.iswindows() +isapple() = @static VERSION < v"0.7-" ? Sys.is_apple() : Sys.isapple() +islinux() = @static VERSION < v"0.7-" ? Sys.is_linux() : Sys.islinux() + # load snapshotted dependencies include("../ext/BinaryProvider/src/BinaryProvider.jl") include("../ext/TOML/src/TOML.jl") include("../ext/TerminalMenus/src/TerminalMenus.jl") -iswindows() = @static VERSION < v"0.7-" ? Sys.is_windows() : Sys.iswindows() - include("Pkg2/Pkg2.jl") include("Types.jl") include("Display.jl") @@ -40,7 +42,14 @@ function Base.julia_cmd(julia::AbstractString) return cmd end -function _find_in_path(name::String, wd::Union{Void,String}) +if VERSION < v"0.7.0-DEV.2303" + Base.find_in_path(name::String, wd::Void) = _find_package(name, nothing) + Base.find_in_path(name::String, wd::String) = _find_package(name, nothing) +else + Base.find_package(name::String) = _find_package(name) +end + +function _find_package(name::String, wd::Union{Void,String}) isabspath(name) && return name base = name if endswith(name, ".jl") @@ -48,10 +57,6 @@ function _find_in_path(name::String, wd::Union{Void,String}) else name = string(base, ".jl") end - if wd !== nothing - path = joinpath(wd, name) - Base.isfile_casesensitive(path) && return path - end info = Pkg3.Operations.package_env_info(base, verb = "use") info == nothing && @goto find_global @@ -87,12 +92,10 @@ function _find_in_path(name::String, wd::Union{Void,String}) @label install Pkg3.Operations.ensure_resolved(env, pkgspec, true) Pkg3.Operations.add(env, pkgspec) - return _find_in_path(name, wd) + return _find_package(name) end return nothing end -Base.find_in_path(name::String, wd::Void) = _find_in_path(name, wd) -Base.find_in_path(name::String, wd::String) = _find_in_path(name, wd) end # module diff --git a/src/REPLMode.jl b/src/REPLMode.jl index 7dff6d2affa4b..c68fd1634204a 100644 --- a/src/REPLMode.jl +++ b/src/REPLMode.jl @@ -398,6 +398,10 @@ function create_mode(repl, main) prompt_suffix = "", sticky = true) + if VERSION >= v"0.7.0-DEV.1747" + pkg_mode.repl = repl + end + hp = main.hist hp.mode_mapping[:pkg] = pkg_mode pkg_mode.hist = hp From 3734fd91e7fd86cdae6e0d1bd2f6adfab39311c8 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 24 Nov 2017 10:33:39 +0100 Subject: [PATCH 5/5] fixes on 0.7 fixup v0.7 --- ext/TOML/src/TOML.jl | 4 ++++ ext/TOML/test/runtests.jl | 6 +++++- src/Pkg2/query.jl | 5 +++-- src/Pkg2/types.jl | 1 + src/Pkg3.jl | 18 ++++++++++++++---- test/runtests.jl | 9 +++++++-- 6 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ext/TOML/src/TOML.jl b/ext/TOML/src/TOML.jl index 5a44ae21955a9..5dd3aff5f07d4 100644 --- a/ext/TOML/src/TOML.jl +++ b/ext/TOML/src/TOML.jl @@ -1,5 +1,9 @@ module TOML + if Base.isdeprecated(Base, :Dates) + import Dates + end + include("parser.jl") include("print.jl") diff --git a/ext/TOML/test/runtests.jl b/ext/TOML/test/runtests.jl index 7fd08df9c01c3..1600e2512426a 100644 --- a/ext/TOML/test/runtests.jl +++ b/ext/TOML/test/runtests.jl @@ -1,7 +1,11 @@ using TOML import TOML: linecol, whitespace, comment, newline, expect, lookup, Parser, parse -using Base.Test +if Base.isdeprecated(Base, :Test) + using Test +else + using Base.Test +end macro testval(s, v) f = "foo = $s" diff --git a/src/Pkg2/query.jl b/src/Pkg2/query.jl index 912972b8e058b..0e45f580ef2a5 100644 --- a/src/Pkg2/query.jl +++ b/src/Pkg2/query.jl @@ -4,6 +4,7 @@ module Query import ..PkgError using ..Types +import Pkg3.equalto # If there are explicitly required packages, dicards all versions outside # the allowed range. @@ -145,7 +146,7 @@ function prune_versions(reqs::Requires, deps::Dict{String,Dict{VersionNumber,Ava vmaskp[vn] = falses(luds) end for (vn,a) in fdepsp - vmind = findfirst(uniqdepssets, a.requires) + vmind = findfirst(equalto(a.requires), uniqdepssets) @assert vmind > 0 vm = vmaskp[vn] vm[vmind] = true @@ -175,7 +176,7 @@ function prune_versions(reqs::Requires, deps::Dict{String,Dict{VersionNumber,Ava nc = length(vmask0_uniq) classes = [VersionNumber[] for c0 = 1:nc] for (vn,vm) in vmaskp - c0 = findfirst(vmask0_uniq, vm) + c0 = findfirst(equalto(vm), vmask0_uniq) push!(classes[c0], vn) end map(sort!, classes) diff --git a/src/Pkg2/types.jl b/src/Pkg2/types.jl index 1ee9edfbd9358..b25bc69d7c76c 100644 --- a/src/Pkg2/types.jl +++ b/src/Pkg2/types.jl @@ -6,6 +6,7 @@ export VersionInterval, VersionSet, Requires, Available, Fixed, merge_requires!, ResolveBacktraceItem, ResolveBacktrace import Base: show, isempty, in, intersect, union!, union, ==, hash, copy, deepcopy_internal, push! +import Pkg3.equalto import ...iswindows struct VersionInterval diff --git a/src/Pkg3.jl b/src/Pkg3.jl index c676d02e00730..96ca5dd768f5c 100644 --- a/src/Pkg3.jl +++ b/src/Pkg3.jl @@ -11,6 +11,16 @@ iswindows() = @static VERSION < v"0.7-" ? Sys.is_windows() : Sys.iswindows() isapple() = @static VERSION < v"0.7-" ? Sys.is_apple() : Sys.isapple() islinux() = @static VERSION < v"0.7-" ? Sys.is_linux() : Sys.islinux() +# Backport of Equalto +if !isdefined(Base, :EqualTo) + struct EqualTo{T} <: Function + x::T + EqualTo(x::T) where {T} = new{T}(x) + end + (f::EqualTo)(y) = isequal(f.x, y) + const equalto = EqualTo +end + # load snapshotted dependencies include("../ext/BinaryProvider/src/BinaryProvider.jl") include("../ext/TOML/src/TOML.jl") @@ -43,13 +53,13 @@ function Base.julia_cmd(julia::AbstractString) end if VERSION < v"0.7.0-DEV.2303" - Base.find_in_path(name::String, wd::Void) = _find_package(name, nothing) - Base.find_in_path(name::String, wd::String) = _find_package(name, nothing) + Base.find_in_path(name::String, wd::Void) = _find_package(name) + Base.find_in_path(name::String, wd::String) = _find_package(name) else - Base.find_package(name::String) = _find_package(name) + Base.find_package(name::String) = _find_package(name, ) end -function _find_package(name::String, wd::Union{Void,String}) +function _find_package(name::String) isabspath(name) && return name base = name if endswith(name, ".jl") diff --git a/test/runtests.jl b/test/runtests.jl index d883f00a6514c..de43253d139b8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,12 @@ using Pkg3 -using Base.Test -using Pkg3.Types +using Pkg3.Type +if Base.isdeprecated(Main, :Test) + using Test +else + using Base.Test +end +using Base.Test function temp_pkg_dir(fn::Function) local project_path try