Skip to content

Commit

Permalink
Merge pull request #99 from JuliaLang/kc/fix_deprecations
Browse files Browse the repository at this point in the history
fix deprecations
  • Loading branch information
KristofferC authored Feb 9, 2018
2 parents 4bd1379 + 0bdbf47 commit dda682f
Show file tree
Hide file tree
Showing 74 changed files with 996 additions and 4,520 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: julia

julia:
- 0.6
- nightly

os:
Expand Down
25 changes: 25 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,29 @@ The Pkg3.jl package is licensed under the MIT "Expat" License:
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>
The file PlatformEngines.jl is under the following license:

The BinaryProvider.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2017: SimonDanisch.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>
7 changes: 7 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ name = "Pkg3"
repo = "https://github.com/StefanKarpinski/Pkg3.jl.git"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand Down
6 changes: 3 additions & 3 deletions bin/Pkg2/Pkg2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module Pkg2

struct PkgError <: Exception
msg::AbstractString
ex::Nullable{Exception}
ex::Union{Exception, Nothing}
end
PkgError(msg::AbstractString) = PkgError(msg, Nullable{Exception}())
PkgError(msg::AbstractString) = PkgError(msg, nothing)
function Base.showerror(io::IO, pkgerr::PkgError)
print(io, pkgerr.msg)
if !isnull(pkgerr.ex)
if pkgerr.ex !== nothing
pkgex = get(pkgerr.ex)
if isa(pkgex, CompositeException)
for cex in pkgex
Expand Down
12 changes: 6 additions & 6 deletions bin/Pkg2/reqs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ struct Requirement <: Line
system::Vector{AbstractString}

function Requirement(content::AbstractString)
fields = split(replace(content, r"#.*$", ""))
fields = split(replace(content, r"#.*$" => ""))
system = AbstractString[]
while !isempty(fields) && fields[1][1] == '@'
push!(system,shift!(fields)[2:end])
push!(system, popfirst!(fields)[2:end])
end
isempty(fields) && throw(PkgError("invalid requires entry: $content"))
package = shift!(fields)
all(field->ismatch(Base.VERSION_REGEX, field), fields) ||
package = popfirst!(fields)
all(field->contains(field, Base.VERSION_REGEX), fields) ||
throw(PkgError("invalid requires entry for $package: $content"))
versions = VersionNumber[fields...]
versions = VersionNumber.(fields)
issorted(versions) || throw(PkgError("invalid requires entry for $package: $content"))
new(content, package, VersionSet(versions), system)
end
Expand All @@ -37,7 +37,7 @@ end
function read(readable::Union{IO,Base.AbstractCmd})
lines = Line[]
for line in eachline(readable)
push!(lines, ismatch(r"^\s*(?:#|$)", line) ? Comment(line) : Requirement(line))
push!(lines, contains(line, r"^\s*(?:#|$)") ? Comment(line) : Requirement(line))
end
return lines
end
Expand Down
10 changes: 4 additions & 6 deletions bin/Pkg2/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module Types
export VersionInterval, VersionSet
import Base: show, isempty, in, intersect, union!, union, ==, hash, copy, deepcopy_internal

import Pkg3.iswindows

struct VersionInterval
lower::VersionNumber
upper::VersionNumber
Expand Down Expand Up @@ -73,7 +71,7 @@ function VersionSet(versions::Vector{VersionNumber})
else
isodd(length(versions)) && push!(versions, typemax(VersionNumber))
while !isempty(versions)
push!(intervals, VersionInterval(shift!(versions), shift!(versions)))
push!(intervals, VersionInterval(popfirst!(versions), popfirst!(versions)))
end
end
VersionSet(intervals)
Expand All @@ -83,8 +81,8 @@ VersionSet(versions::VersionNumber...) = VersionSet(VersionNumber[versions...])
const empty_versionset = VersionSet(VersionInterval[])

# Windows console doesn't like Unicode
const _empty_symbol = @static iswindows() ? "empty" : ""
const _union_symbol = @static iswindows() ? " or " : ""
const _empty_symbol = @static Sys.iswindows() ? "empty" : ""
const _union_symbol = @static Sys.iswindows() ? " or " : ""
show(io::IO, s::VersionSet) = isempty(s) ? print(io, _empty_symbol) :
join(io, s.intervals, _union_symbol)
isempty(s::VersionSet) = all(isempty, s.intervals)
Expand Down Expand Up @@ -125,6 +123,6 @@ end

==(A::VersionSet, B::VersionSet) = A.intervals == B.intervals
hash(s::VersionSet, h::UInt) = hash(s.intervals, h + (0x2fd2ca6efa023f44 % UInt))
deepcopy_internal(vs::VersionSet, ::ObjectIdDict) = copy(vs)
deepcopy_internal(vs::VersionSet, ::IdDict) = copy(vs)

end # module
2 changes: 1 addition & 1 deletion bin/generate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function write_toml(f::Function, names::String...)
end
end

toml_key(str::String) = ismatch(r"[^\w-]", str) ? repr(str) : str
toml_key(str::String) = contains(str, r"[^\w-]") ? repr(str) : str
toml_key(strs::String...) = join(map(toml_key, [strs...]), '.')

prefix = joinpath(homedir(), ".julia", "registries", "Uncurated")
Expand Down
12 changes: 6 additions & 6 deletions bin/loadmeta.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env julia

using Base: thispatch, thisminor, nextpatch, nextminor
using Base.LinAlg: checksquare
using Base.Random: UUID
import LinearAlgebra: checksquare
import UUIDs
using Pkg3.Types
using Pkg3.Types: uuid_package, uuid_registry, uuid5

Expand Down Expand Up @@ -43,7 +43,7 @@ function load_requires(path::String)
versions = versions requires[r.package].versions
systems = systems requires[r.package].systems
end
requires[r.package] = Require(versions, systems)
requires[r.package] = Require(versions, Symbol.(systems))
end
return requires
end
Expand Down Expand Up @@ -121,12 +121,12 @@ julia_versions(vi::VersionInterval) = julia_versions(v->v in vi)

macro clean(ex) :(x = $(esc(ex)); $(esc(:clean)) &= x; x) end

function prune!(pkgs::Associative{String,Package})
function prune!(pkgs::AbstractDict{String,Package})
# remove unsatisfiable versions
while true
clean = true
filter!(pkgs) do pkg, p
filter!(p.versions) do ver, v
filter!(pkgs) do (pkg, p)
filter!(p.versions) do (ver, v)
@clean ver == thispatch(ver) > v"0.0.0" &&
all(v.requires) do kv
req, r = kv
Expand Down
6 changes: 3 additions & 3 deletions bin/sha1map.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env julia

using Pkg3.TOML
using Base: LibGit2
using LibGit2

function sha1map(pkgs::Dict{String,Package})
f = joinpath(@__DIR__, "sha1map.toml")
Expand All @@ -19,15 +19,15 @@ function sha1map(pkgs::Dict{String,Package})
repo_path = joinpath(homedir(), ".julia", "upstream", uuid)
repo = ispath(repo_path) ? LibGit2.GitRepo(repo_path) : begin
updated = true
info("Cloning [$uuid] $pkg")
@info("Cloning [$uuid] $pkg")
LibGit2.clone(p.url, repo_path, isbare=true)
end
end
if !updated
try LibGit2.GitObject(repo, git_commit_hash)
catch err
err isa LibGit2.GitError && err.code == LibGit2.Error.ENOTFOUND || rethrow(err)
info("Updating $pkg from $(p.url)")
@info("Updating $pkg from $(p.url)")
LibGit2.fetch(repo, remoteurl=p.url, refspecs=["+refs/*:refs/remotes/cache/*"])
end
end
Expand Down
Loading

0 comments on commit dda682f

Please sign in to comment.