Skip to content

Commit 0263099

Browse files
authored
Merge pull request #30 from KristofferC/kc/07
Upgrade Pkg3 and ext dependencies to 0.7
2 parents 490e914 + 3734fd9 commit 0263099

22 files changed

+131
-66
lines changed

ext/BinaryProvider/REQUIRE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
julia 0.6
22
SHA
3-
Compat 0.27.0
3+
Compat 0.35.0

ext/BinaryProvider/src/BinDepsIntegration.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BinDeps: Binaries, can_use, package_available, bindir, libdir,
33
generate_steps, LibraryDependency, provider, provides
44
import Base: show
55

6-
type BP <: Binaries
6+
mutable struct BP <: Binaries
77
url::String
88
hash::String
99
prefix::Prefix
@@ -14,7 +14,7 @@ show(io::IO, p::BP) = write(io, "BinaryProvider for $(p.url)")
1414
# We are cross-platform baby, and we never say no to a party
1515
can_use(::Type{BP}) = true
1616
package_available(p::BP) = true
17-
libdir(p::BP, dep) = @static if is_windows()
17+
libdir(p::BP, dep) = @static if Compat.Sys.iswindows()
1818
joinpath(p.prefix, "bin")
1919
else
2020
joinpath(p.prefix, "lib")

ext/BinaryProvider/src/BinaryPackage.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ There exist `install()`, `uninstall()` and `satisfied()` methods for
1313
`BinaryPackage` objects, similar to the lower-level versions that take direct
1414
`url` and `hash` arguments.
1515
"""
16-
immutable BinaryPackage
16+
struct BinaryPackage
1717
url::String
1818
hash::String
1919
platform::Platform

ext/BinaryProvider/src/BinaryProvider.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module BinaryProvider
22

3+
import Pkg3: iswindows, isapple, islinux
4+
35
# Include our subprocess running funtionality
46
include("OutputCollector.jl")
57
# External utilities such as downloading/decompressing tarballs
@@ -19,7 +21,7 @@ include("BinaryPackage.jl")
1921

2022

2123
function __init__()
22-
global global_prefix
24+
#global global_prefix
2325

2426
# Initialize our global_prefix
2527
# global_prefix = Prefix(joinpath(dirname(@__FILE__), "../", "global_prefix"))
@@ -30,7 +32,7 @@ function __init__()
3032

3133
# If we're on a julia that's too old, then fixup the color mappings
3234
# if !haskey(Base.text_colors, :default)
33-
# Base.text_colors[:default] = Base.color_normal
35+
# Base.text_colors[:default] = Base.color_normal
3436
# end
3537
end
3638

ext/BinaryProvider/src/OutputCollector.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Base: wait, merge
55

66
export OutputCollector, merge, stdout, stderr, tail, tee
77

8-
immutable LineStream
8+
struct LineStream
99
pipe::Pipe
1010
lines::Vector{Tuple{Float64,String}}
1111
task::Task
@@ -79,7 +79,7 @@ OutputCollector
7979
A `run()` wrapper class that captures subprocess `stdout` and `stderr` streams
8080
independently, resynthesizing and colorizing the streams appropriately.
8181
"""
82-
type OutputCollector
82+
mutable struct OutputCollector
8383
cmd::Base.AbstractCmd
8484
P::Base.AbstractPipe
8585
stdout_linestream::LineStream

ext/BinaryProvider/src/PlatformEngines.jl

+6-7
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function probe_platform_engines!(;verbose::Bool = false)
137137
# download_engines is a list of (test_cmd, download_opts_functor)
138138
# The probulator will check each of them by attempting to run `$test_cmd`,
139139
# and if that works, will set the global download functions appropriately.
140-
const download_engines = [
140+
download_engines = [
141141
(`curl --help`, (url, path) -> `curl -C - -\# -f -o $path -L $url`),
142142
(`wget --help`, (url, path) -> `wget -c -O $path $url`),
143143
(`fetch --help`, (url, path) -> `fetch -f $path $url`),
@@ -175,17 +175,17 @@ function probe_platform_engines!(;verbose::Bool = false)
175175
# will check each of them by attempting to run `$test_cmd`, and if that
176176
# works, will set the global compression functions appropriately.
177177
gen_7z = (p) -> (unpack_7z(p), package_7z(p), list_7z(p), parse_7z_list)
178-
const compression_engines = Tuple[
178+
compression_engines = Tuple[
179179
(`tar --help`, unpack_tar, package_tar, list_tar, parse_tar_list),
180180
]
181181

182182
# sh_engines is just a list of Cmds-as-paths
183-
const sh_engines = [
183+
sh_engines = [
184184
`sh`
185185
]
186186

187187
# For windows, we need to tweak a few things, as the tools available differ
188-
@static if is_windows()
188+
@static if iswindows()
189189
# For download engines, we will most likely want to use powershell.
190190
# Let's generate a functor to return the necessary powershell magics
191191
# to download a file, given a path to the powershell executable
@@ -215,11 +215,11 @@ function probe_platform_engines!(;verbose::Bool = false)
215215
prepend!(compression_engines, [(`7z --help`, gen_7z("7z")...)])
216216

217217
# On windows, we bundle 7z with Julia, so try invoking that directly
218-
const exe7z = joinpath(JULIA_HOME, "7z.exe")
218+
exe7z = joinpath(JULIA_HOME, "7z.exe")
219219
prepend!(compression_engines, [(`$exe7z --help`, gen_7z(exe7z)...)])
220220

221221
# And finally, we want to look for sh as busybox as well:
222-
const busybox = joinpath(JULIA_HOME, "busybox.exe")
222+
busybox = joinpath(JULIA_HOME, "busybox.exe")
223223
prepend!(sh_engines, [(`$busybox sh`)])
224224
end
225225

@@ -540,4 +540,3 @@ function download_verify_unpack(url::AbstractString,
540540
rm(tarball_path)
541541
end
542542
end
543-

ext/BinaryProvider/src/PlatformNames.jl

+13-1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ function supported_platforms()
124124
]
125125
end
126126

127+
# Compat doesn't use the Base definitions for whatever terrible reason, so we'll overload
128+
# both, ensuring the user gets our definitions regardless of whether they use Sys.is* or
129+
# Compat.Sys.is*.
130+
#if isdefined(Base.Sys, :isapple)
131+
# Base.Sys.isapple(p::Platform) = p isa MacOS
132+
# Base.Sys.islinux(p::Platform) = p isa Linux
133+
# Base.Sys.iswindows(p::Platform) = p isa Windows
134+
# end
135+
# Compat.Sys.isapple(p::Platform) = p isa MacOS
136+
# Compat.Sys.islinux(p::Platform) = p isa Linux
137+
# Compat.Sys.iswindows(p::Platform) = p isa Windows
138+
127139
"""
128140
platform_key(machine::AbstractString = Sys.MACHINE)
129141
@@ -183,7 +195,7 @@ E.g. returns `true` for a path like `"usr/lib/libfoo.so.3.5"`, but returns
183195
`false` for a path like `"libbar.so.f.a"`.
184196
"""
185197
function valid_dl_path(path::AbstractString, platform::Platform)
186-
const dlext_regexes = Dict(
198+
dlext_regexes = Dict(
187199
# On Linux, libraries look like `libnettle.so.6.3.0`
188200
"so" => r"^(.*).so(\.[\d]+){0,3}$",
189201
# On OSX, libraries look like `libnettle.6.3.dylib`

ext/BinaryProvider/src/Prefix.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Usage example:
2929
function temp_prefix(func::Function)
3030
# Helper function to create a docker-mountable temporary directory
3131
function _tempdir()
32-
@static if is_apple()
32+
@static if isapple()
3333
# Docker, on OSX at least, can only mount from certain locations by
3434
# default, so we ensure all our temporary directories live within
3535
# those locations so that they are accessible by Docker.
@@ -50,7 +50,7 @@ end
5050
# This is the default prefix that things get saved to, it is initialized within
5151
# __init__() on first module load.
5252
global_prefix = nothing
53-
immutable Prefix
53+
struct Prefix
5454
path::String
5555

5656
"""
@@ -85,7 +85,7 @@ Splits a string such as the `PATH` environment variable into a list of strings
8585
according to the path separation rules for the current platform.
8686
"""
8787
function split_PATH(PATH::AbstractString = ENV["PATH"])
88-
@static if is_windows()
88+
@static if iswindows()
8989
return split(PATH, ";")
9090
else
9191
return split(PATH, ":")
@@ -98,8 +98,8 @@ end
9898
Given a list of strings, return a joined string suitable for the `PATH`
9999
environment variable appropriate for the current platform.
100100
"""
101-
function join_PATH{S<:AbstractString}(paths::Vector{S})
102-
@static if is_windows()
101+
function join_PATH(paths::Vector{S}) where S<:AbstractString
102+
@static if iswindows()
103103
return join(paths, ";")
104104
else
105105
return join(paths, ":")
@@ -122,7 +122,7 @@ Returns the library directory for the given `prefix` (not ethat this differs
122122
between unix systems and windows systems).
123123
"""
124124
function libdir(prefix::Prefix)
125-
@static if is_windows()
125+
@static if iswindows()
126126
return joinpath(prefix, "bin")
127127
else
128128
return joinpath(prefix, "lib")

ext/BinaryProvider/src/Products.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ will be installed to, and its name, e.g. to build a `LibraryProduct` that
1212
refers to `"/lib/libnettle.so"`, the "directory" would be "/lib", and the
1313
"libname" would be "libnettle".
1414
"""
15-
immutable LibraryProduct <: Product
15+
struct LibraryProduct <: Product
1616
dir_path::String
1717
libname::String
1818

@@ -119,7 +119,7 @@ non-Windows platforms, it will check for the executable bit being set. On
119119
Windows platforms, it will check that the file ends with ".exe", (adding it on
120120
automatically, if it is not already present).
121121
"""
122-
immutable ExecutableProduct <: Product
122+
struct ExecutableProduct <: Product
123123
path::AbstractString
124124

125125
"""
@@ -173,7 +173,7 @@ function locate(ep::ExecutableProduct; platform::Platform = platform_key(),
173173

174174
# If the file is not executable, fail out (unless we're on windows since
175175
# windows doesn't honor these permissions on its filesystems)
176-
@static if !is_windows()
176+
@static if !iswindows()
177177
if uperm(path) & 0x1 == 0
178178
if verbose
179179
info("$(path) is not executable, reporting unsatisfied")
@@ -188,7 +188,7 @@ end
188188
"""
189189
A `FileProduct` represents a file that simply must exist to be satisfied.
190190
"""
191-
immutable FileProduct <: Product
191+
struct FileProduct <: Product
192192
path::AbstractString
193193
end
194194

@@ -255,12 +255,12 @@ the user to re-run `Pkg.build("package_name")`.
255255
"""
256256
macro write_deps_file(capture...)
257257
# props to @tshort for his macro wizardry
258-
const names = :($(capture))
259-
const products = esc(Expr(:tuple, capture...))
258+
names = :($(capture))
259+
products = esc(Expr(:tuple, capture...))
260260

261261
# We have to create this dummy_source, because we cannot, in a single line,
262262
# have both `@__FILE__` and `__source__` interpreted by the same julia.
263-
const dummy_source = VERSION >= v"0.7.0-" ? __source__.file : ""
263+
dummy_source = VERSION >= v"0.7.0-" ? __source__.file : ""
264264

265265
return quote
266266
# First pick up important pieces of information from the call-site

ext/BinaryProvider/test/runtests.jl

+8-8
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ BinaryProvider.probe_platform_engines!(;verbose=true)
7575
end
7676

7777
# Next, test a command that kills itself (NOTE: This doesn't work on windows. sigh.)
78-
@static if !is_windows()
78+
@static if !iswindows()
7979
cd("output_tests") do
8080
oc = OutputCollector(sh(`./kill.sh`))
8181

@@ -145,8 +145,8 @@ end
145145
# Test that we can indeed ask if something is linux or windows, etc...
146146
@test Compat.Sys.islinux(Linux(:aarch64))
147147
@test !Compat.Sys.islinux(Windows(:x86_64))
148-
@test Compat.Sys.iswindows(Windows(:i686))
149-
@test !Compat.Sys.iswindows(Linux(:x86_64))
148+
@test iswindows(Windows(:i686))
149+
@test !iswindows(Linux(:x86_64))
150150
@test Compat.Sys.isapple(MacOS())
151151
@test !Compat.Sys.isapple(Linux(:ppc64le))
152152

@@ -155,7 +155,7 @@ end
155155
isbasesomething(p) = Sys.islinux(p) || Sys.iswindows(p) || Sys.isapple(p)
156156
@test all(isbasesomething, supported_platforms())
157157
end
158-
issomething(p) = Compat.Sys.islinux(p) || Compat.Sys.iswindows(p) ||
158+
issomething(p) = Compat.Sys.islinux(p) || iswindows(p) ||
159159
Compat.Sys.isapple(p)
160160
@test all(issomething, supported_platforms())
161161

@@ -201,7 +201,7 @@ end
201201
# Test we can run the script we dropped within this prefix. Once again,
202202
# something about Windows | busybox | Julia won't pick this up even though
203203
# the path clearly points to the file. :(
204-
@static if !is_windows()
204+
@static if !iswindows()
205205
@test success(sh(`$(ppt_path)`))
206206
@test success(sh(`prefix_path_test.sh`))
207207
end
@@ -234,7 +234,7 @@ end
234234
mkpath(bindir(prefix))
235235
touch(e_path)
236236
@test satisfied(ef, verbose=true)
237-
@static if !is_windows()
237+
@static if !iswindows()
238238
# Windows doesn't care about executable bit, grumble grumble
239239
@test !satisfied(e, verbose=true, platform=Linux(:x86_64))
240240
end
@@ -260,7 +260,7 @@ end
260260

261261
# But if it is from a different platform, simple existence will be
262262
# enough to satisfy a LibraryProduct
263-
@static if is_windows()
263+
@static if iswindows()
264264
l_path = joinpath(libdir(prefix), "libfoo.so")
265265
touch(l_path)
266266
@test satisfied(l, verbose=true, platform=Linux(:x86_64))
@@ -347,7 +347,7 @@ end
347347

348348
# Test that we can inspect the contents of the tarball
349349
contents = list_tarball_files(tarball_path)
350-
const libdir_name = is_windows() ? "bin" : "lib"
350+
const libdir_name = iswindows() ? "bin" : "lib"
351351
@test joinpath("bin", "bar.sh") in contents
352352
@test joinpath(libdir_name, "baz.so") in contents
353353

ext/TOML/src/TOML.jl

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
module TOML
22

3+
if Base.isdeprecated(Base, :Dates)
4+
import Dates
5+
end
6+
37
include("parser.jl")
48
include("print.jl")
59

ext/TOML/src/parser.jl

+1-2
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ function array(p::Parser, st::Int)
643643
!expect(p, '[') && return NONE()
644644
ret = Any[]
645645
rettype = Any
646+
expected = Any
646647
while true
647648

648649
# Break out early if we see the closing bracket
@@ -657,9 +658,7 @@ function array(p::Parser, st::Int)
657658

658659
pend = nextpos(p)
659660
valtype = isa(pvalue, Array) ? Array : typeof(pvalue)
660-
661661
expected = rettype === Any ? valtype : expected
662-
663662
if valtype != expected
664663
error(p, pstart, pend, "expected type `$expected`, found type `$valtype`")
665664
else

ext/TOML/test/runtests.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
using TOML
22
import TOML: linecol, whitespace, comment, newline, expect, lookup, Parser, parse
33

4-
using Base.Test
4+
if Base.isdeprecated(Base, :Test)
5+
using Test
6+
else
7+
using Base.Test
8+
end
59

610
macro testval(s, v)
711
f = "foo = $s"

ext/TerminalMenus/src/MultiSelectMenu.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ You like the following fruits:
2525
```
2626
2727
"""
28-
type MultiSelectMenu <: AbstractMenu
28+
mutable struct MultiSelectMenu <: AbstractMenu
2929
options::Array{String,1}
3030
pagesize::Int
3131
pageoffset::Int

ext/TerminalMenus/src/RadioMenu.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Your favorite fruit is blueberry!
1717
```
1818
1919
"""
20-
type RadioMenu <: AbstractMenu
20+
mutable struct RadioMenu <: AbstractMenu
2121
options::Array{String,1}
2222
pagesize::Int
2323
pageoffset::Int

ext/TerminalMenus/src/TerminalMenus.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module TerminalMenus
22

3+
import Pkg3.iswindows
4+
35
terminal = nothing # The user terminal
46

57
function __init__()
68
global terminal
7-
terminal = Base.Terminals.TTYTerminal(get(ENV, "TERM", is_windows() ? "" : "dumb"), STDIN, STDOUT, STDERR)
9+
terminal = Base.Terminals.TTYTerminal(get(ENV, "TERM", iswindows() ? "" : "dumb"), STDIN, STDOUT, STDERR)
810
end
911

1012
include("util.jl")

0 commit comments

Comments
 (0)