Skip to content

Commit

Permalink
Julia 0.7 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff authored and nalimilan committed Aug 26, 2018
1 parent e79c91e commit 4951e5a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ deps/downloads
deps/src
deps/usr
deps/deps.jl
deps/build.log
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ os:
- osx
julia:
- 0.7
- 1.0
- nightly
notifications:
email: false
Expand Down
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.7-
BinaryProvider 0.3.0
julia 0.7
BinaryProvider 0.4.1
39 changes: 23 additions & 16 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-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"
- julia_version: 0.7
- julia_version: 1.0
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

matrix:
allow_failures:
- julia_version: nightly

branches:
only:
- master
- /release-.*/
- /v(\d+)\.(\d+)\.(\d+)/

notifications:
- provider: Email
Expand All @@ -17,19 +25,18 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"StringEncodings\"); Pkg.build(\"StringEncodings\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"StringEncodings\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

# # Uncomment to support code coverage upload. Should only be enabled for packages
# # which would have coverage gaps without running on Windows
# on_success:
# - echo "%JL_CODECOV_SCRIPT%"
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
21 changes: 11 additions & 10 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Libdl
# Check for an iconv implementation with the GNU (non-POSIX) behavior:
# EILSEQ is returned when a sequence cannot be converted to target encoding,
# instead of succeeding and only returning the number of invalid conversions
Expand All @@ -6,25 +7,25 @@
# Implementations with this behavior include glibc, GNU libiconv (on which Mac
# OS X's is based) and win_iconv.
function validate_iconv(lib, iconv_open, iconv_close, iconv)
h = Libdl.dlopen_e(lib)
h = dlopen_e(lib)
h == C_NULL && return false
# Needed to check libc
f = Libdl.dlsym_e(h, iconv_open)
f = dlsym_e(h, iconv_open)
f == C_NULL && return false

cd = ccall(f, Ptr{Void}, (Cstring, Cstring), "ASCII", "UTF-8")
cd == Ptr{Void}(-1) && return false
cd = ccall(f, Ptr{Nothing}, (Cstring, Cstring), "ASCII", "UTF-8")
cd == Ptr{Nothing}(-1) && return false

s = "café"
a = Vector{UInt8}(sizeof(s))
a = Vector{UInt8}(undef, sizeof(s))
inbufptr = Ref{Ptr{UInt8}}(pointer(s))
inbytesleft = Ref{Csize_t}(sizeof(s))
outbufptr = Ref{Ptr{UInt8}}(pointer(a))
outbytesleft = Ref{Csize_t}(length(a))
ret = ccall(Libdl.dlsym_e(h, iconv), Csize_t,
(Ptr{Void}, Ptr{Ptr{UInt8}}, Ref{Csize_t}, Ptr{Ptr{UInt8}}, Ref{Csize_t}),
ret = ccall(dlsym_e(h, iconv), Csize_t,
(Ptr{Nothing}, Ptr{Ptr{UInt8}}, Ref{Csize_t}, Ptr{Ptr{UInt8}}, Ref{Csize_t}),
cd, inbufptr, inbytesleft, outbufptr, outbytesleft)
ccall(Libdl.dlsym_e(h, iconv_close), Void, (Ptr{Void},), cd) == -1 && return false
ccall(dlsym_e(h, iconv_close), Nothing, (Ptr{Nothing},), cd) == -1 && return false

return ret == -1 % Csize_t && Libc.errno() == Libc.EILSEQ
end
Expand Down Expand Up @@ -60,7 +61,7 @@ download_info = Dict(

# Detect already present libc iconv or libiconv
# (notably for Linux, Mac OS and other Unixes)
found_iconv = false
global found_iconv = false
for lib in ("libc", "libc-bin", "libiconv", "iconv")
if lib in ("libc", "libc-bin")
global iconv_open = :iconv_open
Expand All @@ -72,7 +73,7 @@ for lib in ("libc", "libc-bin", "libiconv", "iconv")
global iconv = :libiconv
end
if validate_iconv(lib, iconv_open, iconv_close, iconv)
found_iconv = true
global found_iconv = true
write(joinpath(@__DIR__, "deps.jl"),
"""
## This file autogenerated by Pkg.build(\\"StringEncodings\\").
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for (s, enc) in (("noël", "ISO-8859-1"),
end

# Test that attempt to close stream in the middle of incomplete sequence throws
let s = "a string チャネルパートナーの選択", a = Vector{UInt8}(s)
let s = "a string チャネルパートナーの選択", a = unsafe_wrap(Vector{UInt8}, s)
# First, correct version
p = StringEncoder(IOBuffer(), "UTF-16LE")
write(p, a)
Expand Down

0 comments on commit 4951e5a

Please sign in to comment.