From 4c5f0ced6020614bd64d11cb6ae8e97c665cf785 Mon Sep 17 00:00:00 2001 From: Milan Bouchet-Valat Date: Thu, 11 Feb 2016 22:52:19 +0100 Subject: [PATCH 1/2] Add displaysize() The version with io argument cannot be implemented using tty_size(). --- README.md | 5 +---- src/Compat.jl | 4 ++++ test/runtests.jl | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b2962b80f90bd..584c61389b43b 100644 --- a/README.md +++ b/README.md @@ -133,10 +133,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `super` is now `supertype` [#14338](https://github.com/JuliaLang/julia/pull/14338) - * `qr(A, pivot=b)` is now `qr(A, Val{b})`, likewise for `qrfact` and `qrfact!` - * `readall` and `readbytes` are now `readstring` and `read` [#14660](https://github.com/JuliaLang/julia/pull/14660) * `get_bigfloat_precision` is now `precision(BigFloat)`, `set_precision` is `setprecision` and `with_bigfloat_precision` is now also `setprecision` @@ -144,8 +142,7 @@ Currently, the `@compat` macro supports the following syntaxes: * `get_rounding` is now `rounding`. `set_rounding` and `with_rounding` are now `setrounding` [#13232](https://github.com/JuliaLang/julia/pull/13232) - - +* `Base.tty_size` (which was not exported) is now `displaysize` in Julia 0.5. ## New macros diff --git a/src/Compat.jl b/src/Compat.jl index d8223543f9068..e177e79b0b698 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -820,7 +820,11 @@ if VERSION < v"0.5.0-dev+2228" s = open(filename) EachLine(s, ()->close(s)) end +end +if VERSION < v"0.5.0-dev+2023" + const displaysize = Base.tty_size + export displaysize end diff --git a/test/runtests.jl b/test/runtests.jl index 6cb4dd52bece1..e01dd03493b9b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -818,3 +818,5 @@ for T in (BigFloat, Float64) end end + +@test typeof(displaysize()) == @compat(Tuple{Int, Int}) From 1fac025d19db8aa82190974b5139017413265bd2 Mon Sep 17 00:00:00 2001 From: Milan Bouchet-Valat Date: Thu, 11 Feb 2016 22:56:36 +0100 Subject: [PATCH 2/2] Make version.sh use VERSION file Hardcoding the version means it will often be out of date. --- README.md | 8 ++++---- bin/version.sh | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 584c61389b43b..273095b0140d1 100644 --- a/README.md +++ b/README.md @@ -177,10 +177,10 @@ Currently, the `@compat` macro supports the following syntaxes: If you're adding additional compatibility code to this package, the [`bin/version.sh` script is useful for extracting the version number from a git commit SHA. For example, from the git repository of `julia`, run something like this: ```sh -bash $ /path/to/Compat/bin/version.sh e3aa57efbc6542efbcc7feac9b1309d628ac6f12 -2418 +bash $ /path/to/Compat/bin/version.sh a378b60fe483130d0d30206deb8ba662e93944da +0.5.0-dev+2023 ``` This prints a number `XXXX`, and you can then test whether Julia -is at least this version by `VERSION >= v"0.4.0-dev+XXXX"` (assuming -it is a commit from the 0.4 development cycle). +is at least this version by `VERSION >= v"0.Y.0-dev+XXXX"` (assuming +it is a commit from the 0.Y development cycle). diff --git a/bin/version.sh b/bin/version.sh index ab7bac5ebf416..99e9e31cf396e 100755 --- a/bin/version.sh +++ b/bin/version.sh @@ -1,4 +1,5 @@ #!/bin/bash last_tag=$(git describe --tags --abbrev=0) -echo -n "0.4.0-dev+" -git rev-list $1 ^$last_tag | wc -l | sed -e 's/[^[:digit:]]//g' +ver=$(cat VERSION) +nb=$(git rev-list $1 ^$last_tag | wc -l | sed -e 's/[^[:digit:]]//g') +echo "$ver+$nb"