Skip to content

Commit

Permalink
Merge pull request #30 from KristofferC/kc/07
Browse files Browse the repository at this point in the history
Upgrade Pkg3 and ext dependencies to 0.7
  • Loading branch information
KristofferC authored Nov 26, 2017
2 parents 490e914 + 3734fd9 commit 0263099
Show file tree
Hide file tree
Showing 22 changed files with 131 additions and 66 deletions.
2 changes: 1 addition & 1 deletion ext/BinaryProvider/REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
julia 0.6
SHA
Compat 0.27.0
Compat 0.35.0
4 changes: 2 additions & 2 deletions ext/BinaryProvider/src/BinDepsIntegration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion ext/BinaryProvider/src/BinaryPackage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions ext/BinaryProvider/src/BinaryProvider.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"))
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions ext/BinaryProvider/src/OutputCollector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions ext/BinaryProvider/src/PlatformEngines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -540,4 +540,3 @@ function download_verify_unpack(url::AbstractString,
rm(tarball_path)
end
end

14 changes: 13 additions & 1 deletion ext/BinaryProvider/src/PlatformNames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`
Expand Down
12 changes: 6 additions & 6 deletions ext/BinaryProvider/src/Prefix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

"""
Expand Down Expand Up @@ -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, ":")
Expand All @@ -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, ":")
Expand All @@ -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")
Expand Down
14 changes: 7 additions & 7 deletions ext/BinaryProvider/src/Products.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

"""
Expand Down Expand Up @@ -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")
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions ext/BinaryProvider/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`))

Expand Down Expand Up @@ -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))

Expand All @@ -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())

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions ext/TOML/src/TOML.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module TOML

if Base.isdeprecated(Base, :Dates)
import Dates
end

include("parser.jl")
include("print.jl")

Expand Down
3 changes: 1 addition & 2 deletions ext/TOML/src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion ext/TOML/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ext/TerminalMenus/src/MultiSelectMenu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You like the following fruits:
```
"""
type MultiSelectMenu <: AbstractMenu
mutable struct MultiSelectMenu <: AbstractMenu
options::Array{String,1}
pagesize::Int
pageoffset::Int
Expand Down
2 changes: 1 addition & 1 deletion ext/TerminalMenus/src/RadioMenu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Your favorite fruit is blueberry!
```
"""
type RadioMenu <: AbstractMenu
mutable struct RadioMenu <: AbstractMenu
options::Array{String,1}
pagesize::Int
pageoffset::Int
Expand Down
4 changes: 3 additions & 1 deletion ext/TerminalMenus/src/TerminalMenus.jl
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Loading

0 comments on commit 0263099

Please sign in to comment.