From 8ef0e58072ff893eefbee593d0cc618a3227e3ef Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Mon, 21 Sep 2020 10:54:26 +0200 Subject: [PATCH] make into a package --- .gitignore | 1 + .travis.yml | 14 ++++++++++++++ LICENSE | 21 +++++++++++++++++++++ Project.toml | 12 ++++++++++++ README.md | 19 +++++++++++++++++++ src/{grisu.jl => Grisu.jl} | 12 ++++++------ test/runtests.jl | 5 ++--- 7 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 Project.toml create mode 100644 README.md rename src/{grisu.jl => Grisu.jl} (97%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba39cc5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Manifest.toml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..58fb246 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +# Documentation: http://docs.travis-ci.com/user/languages/julia +language: julia +notifications: + email: false +julia: + - 1.3 + - 1 + - nightly +os: + - linux + - osx + - windows +arch: + - x64 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3db1a30 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Kristoffer and contributors + +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. diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..97828a8 --- /dev/null +++ b/Project.toml @@ -0,0 +1,12 @@ +name = "Grisu" +uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe" +version = "1.0.0" + +[compat] +julia = "1" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..7888b18 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Grisu + +[![Build Status](https://travis-ci.com/JuliaAttic/Grisu.jl.svg?branch=master)](https://travis-ci.com/JuliaAttic/Grisu.jl) + +The (internal) Grisu module was removed in Julia 1.6. However, some packages +relies on this module. To keep this working, the Grisu module was filtered out +as a normal package that can be depended on. + +Use it as follows, add a dependency on Grisu and use this instead of normally +loading it: + +```julia +if isdefined(Base, :Grisu) + const Grisu = Base.Grisu +else + import Grisu +end +``` + diff --git a/src/grisu.jl b/src/Grisu.jl similarity index 97% rename from src/grisu.jl rename to src/Grisu.jl index a311c15..2650a40 100644 --- a/src/grisu.jl +++ b/src/Grisu.jl @@ -9,12 +9,12 @@ const SHORTEST = 1 const FIXED = 2 const PRECISION = 3 -include("grisu/float.jl") -include("grisu/fastshortest.jl") -include("grisu/fastprecision.jl") -include("grisu/fastfixed.jl") -include("grisu/bignums.jl") -include("grisu/bignum.jl") +include("float.jl") +include("fastshortest.jl") +include("fastprecision.jl") +include("fastfixed.jl") +include("bignums.jl") +include("bignum.jl") const DIGITS = Vector{UInt8}(undef, 309+17) const BIGNUMS = [Bignums.Bignum(),Bignums.Bignum(),Bignums.Bignum(),Bignums.Bignum()] diff --git a/test/runtests.jl b/test/runtests.jl index 46e9eab..9d3ebab 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,5 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -using Base.Grisu +using Test +using Grisu function trimrep(buffer) len = length(unsafe_string(pointer(buffer)))